{"schema_version":"1.2","slug":"openai-api","url":"https://www.launchpadhq.io/platform/openai-api/guide","data_url":"https://www.launchpadhq.io/data/v1/guides/openai-api.json","title":"Getting Started with the OpenAI API","tagline":"The developer doorway to OpenAI's models — build your own apps on the same AI behind ChatGPT, billed by usage.","archetype":"pick-and-setup","last_reviewed_at":"2026-07-13","changelog_url":"https://platform.openai.com/docs/changelog","how_it_works":"You create an account, generate an API key (a secret credential that identifies your account), and your code sends a request to OpenAI's servers with that key attached. The model's response comes back to your program, which does whatever you wrote it to do with it. You adjust the request and send it again.","what_it_is":["The OpenAI API is how developers build their own software on OpenAI's models (text, images, speech-to-text, text-to-speech, embeddings) — the same underlying models as ChatGPT, but called from your own code instead of a chat window. It's for people writing applications: a chatbot, a summarizer, a coding tool. It is not the ChatGPT app, and a ChatGPT subscription does not include API access — they're separate products with separate billing."],"before_you_start":["There's no real free tier for building. New accounts may get a small one-time trial credit after identity verification; after that it's pay-as-you-go, billed per token — for the text going in and the text coming out, at a per-model rate, with output usually costing more than input. (There's a fringe \"free daily tokens in exchange for sharing your traffic for training\" program — skip it for anything real; see security.)","Set a hard spend limit in the billing dashboard before your first project. Agent-style or high-volume usage can run up a bill fast; a monthly cap is your safety net.","You'll write (or paste) a little code to make your first call — this page assumes you're comfortable with that. If you're not coding yet, start with the ChatGPT app instead."],"getting_set_up_safely":null,"security":[{"kind":"list","label":"Your API key is a password — treat it like one","items":["Anyone with your key can spend your money. Never commit it to a public repo, paste it into a webpage, or share it in a screenshot.","Store it in an environment variable or a secrets manager, not in your code.","If a key leaks, revoke it immediately in the dashboard and issue a new one."]},{"kind":"text","text":"The important data point most beginners get wrong: standard API traffic is NOT used to train OpenAI's models by default (unlike the consumer free ChatGPT). The one exception is the opt-in \"free tokens for data-sharing\" program — that route does use your inputs and outputs for training, so don't use it for anything sensitive or proprietary."},{"kind":"text","text":"You are responsible for what your app produces and for the data you send. Don't send other people's personal or confidential information through the API without the right to do so, and add your own checks on model output before showing it to users."}],"triad":{"best_at":["Building custom apps on OpenAI's models from your own code","Access to a broad toolkit in one place — text, images, speech, embeddings","High-volume or automated tasks where a chat window won't scale","Fine-grained cost control by routing simple work to cheaper models"],"okay_at":["Predictable flat cost (it's usage-based, so bills vary with traffic)","Beginners who don't code (the ChatGPT app is the better entry point)","A ready-made interface (you build the UI; the API is just the engine)"],"avoid":["Exposing your API key anywhere public","Running with no spend limit set","The 'free tokens' data-sharing route for anything sensitive"]},"starter_actions":[{"title":"Create a key and set a budget","what_it_does":"Sign up, generate an API key, and set a monthly hard spend limit in the billing dashboard before you write any code.","why_here":"The budget cap is the single thing that prevents a surprise bill; do it first.","tweak":"Also set a lower \"soft\" alert so you get an email before you hit the ceiling.","prompt":null},{"title":"Store the key safely","what_it_does":"Put your key in an environment variable (not in your code), so it never ends up in a repo or a screenshot.","why_here":"A leaked key is someone spending your money; this is the habit that prevents it.","tweak":"Using GitHub? Add your env file to .gitignore immediately.","prompt":null},{"title":"Pick a cheap model to start","what_it_does":"For learning and testing, choose one of OpenAI's smaller, low-cost models rather than the flagship — it's plenty for a first project and keeps costs near zero.","why_here":"Most simple tasks don't need the most expensive model; starting cheap builds good cost instincts.","tweak":"Move up to a bigger model only when a task actually needs it.","prompt":null},{"title":"Your first call","what_it_does":null,"why_here":"A single round-trip shows the whole loop — key, request, tokens billed, response — with almost no cost.","tweak":"Swap the summarize task for something from a project you have in mind.","prompt":"Send a request that asks the model to summarize a short paragraph of text into one sentence, and print the response."}],"pitfalls":["The API and ChatGPT are separate products. Your ChatGPT Plus subscription does not include API usage; the API is billed on its own.","No spend limit = a real risk. Agent loops and high volume can rack up charges quickly; set a hard cap first.","\"Free\" here has a catch. The only ongoing free route trades your data for model training — fine for throwaway tests, wrong for anything sensitive."],"where_to_next":[{"label":"AI APIs & Developer Services","url":"https://www.launchpadhq.io/discover?category=ai-apis-developer-services"},{"label":"AI Coding & Development","url":"https://www.launchpadhq.io/discover?category=ai-coding-development"}],"tool":{"slug":"openai-api","name":"OpenAI API","url":"https://www.launchpadhq.io/platform/openai-api","data_url":"https://www.launchpadhq.io/data/v1/tools/openai-api.json","category":{"slug":"ai-apis-developer-services","name":"AI APIs & Developer Services"},"cost_tier":"FREEMIUM","lifecycle":"active","free_tier":{"available":true,"summary":"Free: $5 initial credits (new accounts); rate-limited; GPT-4o-mini free tier"},"starting_price":"$2.50/$10 per 1M tokens)","lowest_paid":{"name":"Pay-per-token (GPT-4o","price_text":"$2.50/$10 per 1M tokens)","amount":2.5,"currency":"USD","period":"usage","limits":null,"is_free":false},"data_as_of":"2026-10-26"},"prices_removed":0,"pricing_note":"Prices in this text come from the catalog, the same data as each tool's page and its record (tool.starting_price, tool.lowest_paid, and plans in /data/v1/tools/{slug}.json). Any sentence that typed a price by hand is removed; prices_removed counts them.","generated_at":"2026-10-27T01:59:41.266Z","sponsored":false,"attribution":"Data from Launchpad HQ (https://www.launchpadhq.io). Please credit Launchpad HQ and link to the tool's Launchpad HQ page."}