OpenAI API

The OpenAI API lets programs call OpenAI's models (GPT-6 Astra, GPT-6.1 Sol, GPT-6.1 Terra, GPT-6 Luna, image, voice and transcription models) with an API key, billed per token. New projects use the Responses API through the official SDKs, with documentation at developers.openai.com.

The OpenAI API is the paid developer service for calling OpenAI's models from your own code: you create an API key in the dashboard, install an official SDK (pip install openai or npm install openai), and send a request to the Responses API, paying per token rather than a monthly fee. It is separate from a ChatGPT subscription, with its own billing, usage tiers and rate limits; ChatGPT Plus includes no API usage, though ChatGPT Pro and paid Business seats now come with monthly API credits (below). As of Nov 6, 2026 the flagship models are GPT-6 Astra, GPT-6.1 Sol, GPT-6.1 Terra and GPT-6 Luna, and OpenAI's developer documentation lives at developers.openai.com.

Quick facts

What it is Pay-as-you-go access to OpenAI models over HTTPS, with official SDKs
Documentation developers.openai.com/api/docs
Dashboard and keys platform.openai.com (keys, billing, limits)
Recommended endpoint Responses API ("recommended for all new projects")
Flagship models gpt-6-astra, gpt-6.1-sol, gpt-6.1-terra, gpt-6-luna, as of Nov 6, 2026
Cheapest flagship GPT-6 Luna, $0.10 in and $0.50 out per 1M tokens, as of Nov 6, 2026
Most capable GPT-6 Astra, $10 in and $50 out per 1M tokens, as of Nov 6, 2026
Context window 1,050,000 tokens on all four flagships
Official SDKs Python, JavaScript, .NET, Ruby; Java and Go in beta
Usage tiers Free, Build, Launch, Grow

How do you start using the OpenAI API?

The quickstart takes five steps. Each SDK reads the key from the environment, so you never paste it into code (OpenAI quickstart).

  1. Sign in to the OpenAI developer dashboard (platform.openai.com) and add a payment method or credits. A first purchase of $5 in credits moves an organization from the Free tier to Build.
  2. Select Create an API Key in the dashboard and copy the key once; it is not shown again.
  3. Store it as the environment variable OPENAI_API_KEY: export OPENAI_API_KEY="your_api_key_here" on macOS or Linux, or setx OPENAI_API_KEY "your_api_key_here" in Windows PowerShell.
  4. Install an SDK: pip install openai for Python, npm install openai for JavaScript, dotnet add package OpenAI for .NET, or gem "openai" in a Ruby Gemfile.
  5. Call responses.create with a model and an input. OpenAI's own example asks gpt-6-astra for a one-sentence bedtime story about a unicorn.
from openai import OpenAI

client = OpenAI()  # reads OPENAI_API_KEY
response = client.responses.create(
    model="gpt-6-luna",
    input="Write a one-sentence bedtime story about a unicorn.",
)
print(response)

The example above swaps in GPT-6 Luna, the cheapest flagship, which is a sensible default while testing. The Java SDK (com.openai:openai-java) and the Go SDK (github.com/openai/openai-go/v3) are both labeled beta on the quickstart as of Nov 6, 2026. For trying prompts without code, the quickstart links the Chat Playground at platform.openai.com/chat.

Is the OpenAI API free?

Not in practice. The Free usage tier exists for accounts in an "allowed geography" and carries a $100 monthly usage limit, but every token is still billed at the published prices. A few things cost nothing: the moderation model omni-moderation-latest is free, and the first 1 GB of file search storage is free. For the full price list, see OpenAI API Pricing.

Some ChatGPT plans now pay for part of it. Since Oct 28, 2026, ChatGPT Pro adds $100, $200 or $500 of API credits a month on its $100, $200 and $500 tiers, and paid Business seats add $20 (Standard) or $100 (Premium) each, pooled up to $500 a month per workspace. You link one API organization under Billing in ChatGPT; unused credits expire at the end of the billing period, and they do not raise ChatGPT or Codex limits. Plus, Enterprise and Edu are not eligible (OpenAI Help Center).

Which models can you call?

OpenAI's models page splits the catalog into flagship and specialized models, as of Nov 6, 2026.

Model API id What OpenAI says it is for Price per 1M tokens (in / out)
GPT-6 Astra gpt-6-astra The most demanding work $10.00 / $50.00
GPT-6.1 Sol gpt-6.1-sol Near-Astra performance at lower cost $2.00 / $10.00
GPT-6.1 Terra gpt-6.1-terra Visual reasoning, computer use and writing, fast $1.00 / $5.00
GPT-6 Luna gpt-6-luna Focused, high-volume tasks $0.10 / $0.50

Source: OpenAI models and OpenAI API pricing, read Nov 6, 2026. Short-context prices (up to 272K input tokens).

All four take text and images in and give text out, with a 1,050,000-token context window and 128,000 tokens of output. Astra and Sol do not accept reasoning effort none; Terra and Luna do (latest model guide).

The specialized models cover other jobs: GPT Image (gpt-image-2.6-sunburst and gpt-image-2.6-flare, released Nov 4, 2026), voice for the Realtime API (gpt-realtime-2.1, gpt-live-1), speech to text (gpt-transcribe and gpt-live-transcribe), embeddings (text-embedding-3-small and -large), and gated models for security and life sciences (GPT-Rosalind and Cyber Models). The open-weight gpt-oss models are listed on their own pages but not on the main models page. Older models such as GPT-5.5, GPT-5.4, GPT-4.1 and GPT-4o still have prices, but many have shutdown dates; see Retired ChatGPT Models and the deprecations page.

The main APIs

Responses API. The core endpoint since Mar 11, 2025: one request can call built-in tools (web search, file search, code interpreter, remote MCP servers, computer use, image generation), keep state with previous_response_id or the Conversations API, and return a typed list of output items. OpenAI calls it "recommended for all new projects" (migration guide). See Responses API.

Chat Completions. The older message-list endpoint "is still supported" (migration guide), but the GPT-6 models accept tool calls only through Responses; Chat Completions works with them without tools (latest model guide).

Realtime API and GPT-Live. Low-latency speech in and speech out over WebRTC in the browser or WebSocket on a server (Realtime guide). GPT-Live 1, a full-duplex voice model, costs $0.05 a minute. See Realtime API.

Audio. Transcription with GPT-Transcribe at an estimated $0.0045 a minute, plus text to speech models that shut down Jan 6, 2027. See Whisper and Audio Models.

Images. Generation and editing at v1/images/generations and v1/images/edits, or as a tool inside Responses. See GPT Image.

Batch API. Upload a file of up to 50,000 requests and get results within 24 hours at 50% lower cost. Flex processing gives the same discount on ordinary calls that can wait. See Batch API.

Embeddings and moderation. text-embedding-3-small costs $0.02 per 1M tokens and returns 1,536 dimensions (embeddings guide); the moderation endpoint checks text and images against 13 categories at no charge.

Agents. The Agents API (a hosted agent harness, public beta since Sep 10, 2026) and the open-source Agents SDK for Python and TypeScript. See Agents SDK.

Fine-tuning. Being wound down: no new users, and existing customers lose job creation on Jan 6, 2027. See Fine-Tuning.

What has been retired

Several API products ended in 2026, and code written against them needs to move.

  • Assistants API: shut down Aug 26, 2026; move to the Responses API and Conversations API.
  • Sora video API: the Sora 2 models and the Videos API shut down Sep 24, 2026 with no replacement, so the API has no video model today (see Sora).
  • DALL-E 2 and DALL-E 3: shut down May 12, 2026 (see DALL-E).
  • Agent Builder, the Evals platform and reusable prompts (v1/prompts): all shut down Nov 30, 2026. ChatKit stays.
  • GPT-4o, GPT-4o mini, GPT-4.1 and GPT-4.1 mini: shut down Jan 14, 2027, with gpt-6-luna as the named replacement.

Prices, limits and speed

Prices are per 1M tokens and split into input, cached input and output. Four processing tiers change the price: Standard; Batch and Flex at half price; Fast (called Priority until Jul 30, 2026) at double; and Ultrafast for Astra and Sol only, at six times Standard (pricing). Prompts over 272K input tokens pay long-context rates. Repeated prompt prefixes are cached: on GPT-6.1 Sol and Terra a cache hit costs 5% of the input price. Full tables are on OpenAI API Pricing.

Rate limits are set per organization and project, by tier. An organization moves up automatically as its total credit purchases grow: Build at $5, Launch at $100, Grow at $500, with monthly usage caps of $500, $5,000 and $200,000 (rate limits guide). See API Rate Limits.

Where else the models run

OpenAI models are also sold through Microsoft Azure and Amazon Bedrock, billed by those clouds rather than by OpenAI (pricing); GPT-5.4 and GPT-5.5 reached Bedrock on Jun 1, 2026, and OpenAI's GPT-6 Astra announcement named both Azure and AWS Bedrock (OpenAI). Regional processing (data residency) adds 10% for models released on or after Mar 5, 2026.

How the API compares

The closest rival is Anthropic's Claude API, which prices its own models in the same ranges and also offers batch and caching discounts. OpenAI API vs Claude API sets them side by side. For coding agents built on these APIs, see Codex and the Codex SDK.

Frequently asked questions

How do I get an OpenAI API key? Sign in to the OpenAI developer dashboard at platform.openai.com, select Create an API Key, and save it as the environment variable OPENAI_API_KEY, which every official SDK reads automatically. Add credits first, since API calls are billed per token.

Is the OpenAI API included in ChatGPT Plus? No. ChatGPT Plus and the OpenAI API are billed separately, and Plus gives no API credits. ChatGPT Pro and paid Business seats do include monthly API credits as of Nov 6, 2026, from $20 per Business Standard seat to $500 on Pro $500; beyond those, API usage is paid per token.

Which OpenAI API model should I use? As of Nov 6, 2026, OpenAI points to GPT-6 Astra for the hardest work, GPT-6.1 Sol for near-Astra quality at one-fifth the price, GPT-6.1 Terra for visual reasoning and computer use, and GPT-6 Luna for cheap high-volume tasks at $0.10 per 1M input tokens.

Should I use the Responses API or Chat Completions? OpenAI recommends the Responses API for all new projects. Chat Completions is still supported, but GPT-6 models need Responses for tool calls, and the built-in tools live only there.

Where are the OpenAI API docs now? The OpenAI API documentation is at developers.openai.com/api/docs, while the dashboard for keys, billing and limits stays at platform.openai.com.

Can I still use the Assistants API? No. OpenAI shut the Assistants API down on Aug 26, 2026; its replacement is the Responses API with the Conversations API for stored threads.

Sources

Moments

API credits, now in ChatGPT Pro and Business plans

OpenAI

  1. Some ChatGPT plans now pay for part of it. Since Oct 28, 2026, ChatGPT Pro adds $100, $200 or $500 of API credits a…

GPT-Live-1 is now in the API

OpenAI

  1. Realtime API and GPT-Live. Low-latency speech in and speech out over WebRTC in the browser or WebSocket on a server…

Introducing gpt-transcribe and gpt-live-transcribe

OpenAI

  1. Audio. Transcription with GPT-Transcribe at an estimated $0.0045 a minute, plus text to speech models that shut down…

Introducing the Agents API

OpenAI

  1. Agents. The Agents API (a hosted agent harness, public beta since Sep 10, 2026) and the open-source Agents SDK for…

Build faster with Ultrafast

OpenAI

  1. Prices are per 1M tokens and split into input, cached input and output. Four processing tiers change the price…

See also

About this page

Last updated Nov 6, 2026 by the Vi.ki team. Page text CC BY-SA 4.0.

Edit History

Hotkeys

/
Jump to the search box
? or Ctrl + /
Open this list
Esc
Close this list, the photo viewer, or the account menu

Video

Space or K
Play or pause
← →
Back or forward 5 seconds
J L
Back or forward 10 seconds
0 to 9
Go to 0% to 90% of the video
, .
Previous or next frame, while paused
M
Mute or unmute
C
Captions on or off
F
Full screen on or off
A D
Previous or next moment

Photo viewer

← → or A D
Previous or next photo
↑ ↓ or W S
Previous or next photo
Home End
First or last photo
I
Show or hide the photo's info
Z
Clickless on or off: a pointer over a thumbnail shows it
N
Compare with the last photo: back to the one shown before this, and N again comes back
Q
Move the thumbnails to the next edge: top, bottom, left and round
, or Ctrl + ,
Open or close the viewer's settings
V
Clickless pan: a zoomed photo follows the pointer, rather than being dragged
Shift
Browse on or off
B
Show or hide the button bar
T
Show or hide the thumbnails
1
100% zoom on or off
0
Rate the photo as no opinion; again takes the answer back
+ -
Rate the photo a step higher or lower
F
Full screen: the photo alone. F again puts everything back.
Back to top