Tutorial

How to get the ChatGPT (OpenAI) API

If you want to “get the ChatGPT API,” the first useful clarification is what that phrase means: there is no product literally named the ChatGPT API. ChatGPT is OpenAI’s consumer chat app; the thing developers build on is the OpenAI API, the programmatic interface to the GPT models. “ChatGPT API” is simply the everyday name people give the OpenAI GPT API, and getting it means obtaining a key and a base URL so your code can call those models. There are two practical routes. You can go to OpenAI directly and use their platform, or you can use an OpenAI-compatible gateway such as Zylo, where one key reaches GPT models alongside Claude, Gemini, and DeepSeek through the same familiar format. This tutorial walks both, then shows the few lines of code that turn a key into a working call. Either way, the goal is the same: a credential and an endpoint your software can send requests to.

Route one: get it from OpenAI directly

The direct route is to obtain a key from OpenAI’s developer platform. You create a developer account — separate from any ChatGPT subscription, since the API is billed on its own usage — generate an API key, and add a billing method, because GPT models bill per token for what you send and receive. You then point your code at OpenAI’s base URL and call a GPT model by name, sending a list of messages and reading back a completion. This is the canonical path and gives you OpenAI’s GPT lineup. The main thing to understand up front is cost: a key is free to create, but usage is metered, and whether any starter allowance applies depends on OpenAI’s current terms rather than anything fixed — is the OpenAI API free walks through what is and is not free so you are not surprised by the first invoice. If all you need is GPT models and nothing else, the direct route is straightforward and complete on its own.

Route two: get it through Zylo

The second route uses an OpenAI-compatible gateway, which is worth it if you want more than one lab’s models behind a single key. With Zylo you sign up with no credit card, generate a free API key, and point your existing OpenAI-style code at https://api.zyloai.net/v1. Because the request format matches the OpenAI SDK, you keep the same client library and simply change the base URL and the key — then call a GPT model by its bare id, such as gpt-5.5. The payoff is reach: the very same key also calls Claude, Gemini, DeepSeek, and more, so switching models is a one-string change rather than a new account and integration. You start free on Basic-tier models with a real Basic allowance — no card — and add credits only when a task needs a premium model like GPT-5.5, which then bills at its base per-token rate. If you are coming from OpenAI, the switch from OpenAI guide shows the exact repointing.

From key to first call

Once you have a key by either route, the first working request is short. Using the OpenAI SDK pattern, you set the API key and the base URL on the client, then send a chat completion request with a model id and a list of messages; the response comes back with the model’s reply, which you read from the first choice. Through Zylo, the only lines that differ from a plain OpenAI setup are the base URL (https://api.zyloai.net/v1) and the key — everything else, including how you build messages and parse the response, stays identical. That is the whole point of an OpenAI-compatible interface: your integration does not care which model answers, so you can prototype on a cheap Basic-tier model and later swap in a premium one by changing a single string. Keep the returned key out of source control and load it from an environment variable. The developer quick start has a copy-ready request you can run immediately.

Costs and honest expectations

Be clear-eyed about cost so the first bill holds no surprises. The key is free on either route; what you pay for is usage, metered in tokens. On Zylo, the free Basic plan needs no card and runs lightweight Basic-tier models — useful for prototyping, but not the frontier. Premium GPT models bill per token from credits on a paid plan: as of June 2026, GPT-5.5 is about $5 input and $30 output per million tokens and GPT-5.4 Mini about $0.75 / $4.50 — point-in-time figures, so confirm against the live pricing page before you budget. Zylo bills these at the model’s base rate with no markup on usage, applying a flat 25 percent platform fee only when you add credits, never on consumption. No reputable provider gives frontier GPT models away for free, so plan for token costs on real workloads. With the key obtained, the base URL set, and the model chosen, you are ready to build — on GPT, and on every other model the same key reaches.

Frequently asked questions

How do I get the ChatGPT API?

Get the OpenAI GPT API either from OpenAI directly, by creating a developer account, generating a key, and adding billing, or through an OpenAI-compatible gateway like Zylo, where you sign up with no card, generate a free key, and point existing OpenAI code at https://api.zyloai.net/v1.

Is the ChatGPT API free?

The key is free to create on either route, but GPT usage is metered per token. Zylo's free Basic plan needs no card and runs lightweight models; premium GPT models bill per token from credits on a paid plan. Frontier GPT models are not free anywhere.

Do I need ChatGPT Plus to use the API?

No. The API is a separate product billed on its own usage, so a ChatGPT subscription is not required. You only need an API key and a base URL, then you call GPT models by name from your own code.

Start building on Zylo

One OpenAI-compatible API for Claude, GPT, Gemini, DeepSeek and more. Free API key, local payments, no card required.

Get free API key