Skip to content
Agents tracked: 492 Releases (7d): 545 Agent status: 1 with issuesSince last limit reset: Claude 9d · Codex 7d For AI agents: Markdown Updated Nov 20, 2026

OpenAI API

by OpenAI

GPT models for text, images and tools.

Model hosting and inference

WebsitePricingGitHub

1. Price

“Free User must be in an allowed geography $100 / month”

No free tier on the pricing page. As reported on the official pricing page, checked Oct 22, 2026.

developers.openai.com/api/docs/pricing

Checked against the maker's official pages, pricing on Oct 22, 2026. Tap a verdict to see its source.How we checkedReport an error

What OpenAI API does

The OpenAI API is a paid online service that lets your app use OpenAI's GPT models. Your server sends text or a picture and gets back an answer, a summary, neatly sorted data, or a request to run one of your own functions. You pay for each token, a small piece of text, at a price set per model.

  • OpenAI API is one of 41 APIs in the Model hosting and inference category on AgentGid.
  • It is not among the 13 that can be started for free.
  • 6 of them ship an official MCP server; OpenAI API does not.
  • Its official SDK is the 1st most downloaded in the category (152M a week).

What people build with it

Writing help inside your app

Draft replies, product texts or short summaries right inside your app, so people do not copy text back and forth from a chat window.

Turn messages into tidy records

Pull a name, a date and a list of people out of an email or a form message, in exactly the fields your database expects.

Answers that use your own data

Let the assistant look up an order, a booking or an account in your system before it answers, and run the action you allow, such as a refund.

Answers with today's news

Let the model search the web while it answers, for questions about prices, events or anything newer than its training.

Describe photos people upload

Read a receipt, describe a product photo or check what a screenshot shows, and get the result back as text.

Big jobs overnight at half price

Sort thousands of support tickets or product reviews in one batch that finishes within a day, when nobody waits for the answer.

OpenAI API popularity

148M
SDK downloads a week
+18.0% on the 4-week average
11.3K
GitHub stars, openai/openai-node
SDK downloads per weeknpm openai, pypi openai 147,735,189

SDK downloads from npm and PyPI, weekly. Numbers as of Nov 17, 2026.

Pricing

Free tier

None

Cheapest plan

No monthly plan

Usage price

Per 1M tokens: GPT-6 Luna $0.10 in / $0.50 out; GPT-6.1 Sol $2 / $10; GPT-6 Astra $10 / $50

What one action costs

ActionPrice
1M input tokens, GPT-6 Luna (short context, standard)$0.10
1M output tokens, GPT-6 Luna (short context, standard)$0.50
1M input / output tokens, GPT-6.1 Sol (short context, standard)$2.00
1M input / output tokens, GPT-6 Astra (short context, standard)$10.00
1,000 web search tool calls (plus search content tokens at model rates)$10.00

As reported on the official pricing page, checked Oct 22, 2026. Prices change: confirm before you buy. developers.openai.com/api/docs/pricing

Limits

Free tier

Usage limit $100 a month; only in allowed countries

Build tier (after $5 in credit purchases)

Usage limit $500 a month; 5,000 requests and 1,000,000 tokens per minute for Astra, Sol and Terra models

Launch tier (after $100 in credit purchases)

Usage limit $5,000 a month; 10,000 requests and 4,000,000 tokens per minute for Astra, Sol and Terra models

Grow tier (after $500 in credit purchases)

Usage limit $200,000 a month

From the official docs. developers.openai.com/api/docs/guides/rate-limits.md

Key and access

How it signs in

API key sent as a Bearer header from your server (Authorization: Bearer $OPENAI_API_KEY); short-lived workload identity tokens are an option for cloud servers

Environment variable
OPENAI_API_KEY
Safe in browser code
No, keep it on your server
Card at sign-up

Not stated on the pages we read

Steps only a person can do

  • Sign in to the OpenAI platform and create an API key (a project service account key for a deployed app). Put it in .env as OPENAI_API_KEY (kept out of git) and read it on the server only.
  • Add a payment method and buy prepaid credits. No code change; requests start working once credits exist.
  • Set a monthly spend alert or hard spend limit for the project. Handle 429 errors with code project_spend_limit_exceeded by showing a friendly message instead of retrying.

Commercial use and your data

It is a paid online service, not open source; the official code libraries are free under the Apache-2.0 license. You own what you send and what the models return. Your content must not break the law or OpenAI's terms of use.

In a paid app
With conditions

Paid use in your product is the normal case; you own inputs and outputs, and your content must follow the law and OpenAI's Terms of Use and usage policies (the policy pages block automated readers, so read them in a browser).

“You are responsible for ensuring that the content you input to our API does not violate any applicable law or our Terms of Use.” source

client-work
With conditions

Give each client app its own project and service account key instead of a developer's personal key.

“Don't share one developer's key across a team or use that person's identity as the permanent identity of a production application.” source

inside-app-bundle
With conditions

The official libraries are Apache-2.0, so you may ship them in your app with their license notice; the key itself must never be bundled.

“"license":"Apache-2.0"” source

Trains on what you send

“As of March 1, 2023, data sent to the OpenAI API is not used to train or improve OpenAI models (unless you explicitly opt in to share data with us).”

Keeps your data

Safety (abuse monitoring) logs up to 30 days; Responses API results stored at least 30 days unless store is false; Zero Data Retention only for approved customers.

“By default, abuse monitoring logs are generated for all API feature usage and retained for up to 30 days, unless longer retention is required by law, or is reasonably necessary to protect our services or any third party from harm.” source

Where data is stored

Data residency per project for eligible customers (via sales), with a 10% price uplift for newer models.

“Data residency controls are a project configuration option that allow you to configure the location of infrastructure OpenAI uses to provide services.” source

Errors to handle

401 Incorrect API key provided

The key sent with the request is wrong or was revoked.

Check the key in .env or create a new one in the dashboard; do not retry unchanged.

429 Rate limit reached for requests

Too many requests in a short time for your tier.

Slow down and retry after the Retry-After header; retry with backoff.

429 credit_balance_exhausted

The organization has no prepaid credits left.

Top up credits; retrying does not help.

500 Server error

A problem on OpenAI's side.

Retry after a short wait and check status.openai.com if it keeps happening.

503 server_is_overloaded

The chosen model is temporarily overloaded.

Follow Retry-After, then retry with backoff.

Use it from an agent

Our agent check

3 of 6: llms.txt yes, OpenAPI no, SDK yes, MCP no, status page no, AI assistants allowed yes

Checked Nov 13, 2026.

MCP server

OpenAI Docs MCP (documentation only)

claude mcp add --transport http openaiDeveloperDocs https://developers.openai.com/mcp

npm
npm install openai
PyPI
pip install openai

Instructions in its docs to check first

The docs say

“Always use the OpenAI developer documentation MCP server if you need to work with the OpenAI API, plugins, ChatGPT, Codex,… without me having to explicitly ask.”

The docs suggest pasting this standing instruction into AGENTS.md. Ask the person before changing their project's agent instructions; using the docs server for one task needs no file change.

Alternatives

OpenAI API This page

from $0.1No free tier

Gemini API

Pick the Gemini API when you want a free tier to start, or need audio and video input as well as text and images.

Free planFree tier

Mistral AI API

Pick Mistral when you want open-weight models you could later run yourself, behind one paid API.

from $0.5 per million input tokensNo free tier

Groq (LLM inference)

Pick Groq when you want fast answers from open models such as GPT-OSS and Llama, priced per 1M tokens.

from $0.075No free tier

All model hosting and inference APIs

Get started

Tell your AI assistant

“Add the OpenAI API to my app on the server only: read OPENAI_API_KEY from .env, call client.responses.create with a fixed model name, return response.output_text to the page, and never put the key in browser code.”

  1. Create an API key in the OpenAI dashboard and put it in an environment variable on the server.

    export OPENAI_API_KEY="your_api_key_here"

    From developers.openai.com/api/docs/quickstart.md

  2. Install the official package for your language (JavaScript shown; Python is pip install openai).

    npm install openai

    From developers.openai.com/api/docs/quickstart.md

  3. Send a first request from a server-side file and print the answer.

    import OpenAI from "openai";
    const client = new OpenAI();
    
    const response = await client.responses.create({
      model: "gpt-6-astra",
      input: "Write a one-sentence bedtime story about a unicorn.",
    });
    
    console.log(response.output_text);
    

    From developers.openai.com/api/docs/quickstart.md

First request

curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-6-astra",
    "input": "Tell me a three sentence bedtime story about a unicorn."
  }'

Mistakes to avoid

new OpenAI({ dangerouslyAllowBrowser: true }) in a React page with the real key
Call OpenAI from your own server route and send only the answer to the page

The library blocks browsers by default because anyone can read a key shipped to the page and spend your credits.

client.chat.completions.create(...) with tools on gpt-6-astra or gpt-6.1-sol
Use client.responses.create(...) with tools for these models

The newest models need the Responses API for tool calling.

Keeping only the message items of response.output when you build the next turn yourself
Pass previous_response_id, or replay all output items in order (toResponseInputItems() in the JavaScript library)

Dropping reasoning or tool-call items can make the next request fail.

Retrying in a loop on 429 credit_balance_exhausted or a spend-limit error
Read error.code; retry only rate-limit and server errors with backoff, and tell the person to top up for billing errors

Retries cannot fix billing, spend or quota errors.

Deploying the openai package 7.x on Node.js 20
Use Node.js 22 or 24

Node.js 22 is the minimum supported version of the current library.

Questions

How is it billed?

Per token, with separate prices for input and output and for each model. Requests run on prepaid credits.

Does OpenAI train its models on what my app sends?

Not by default. Data sent to the API has not been used for training since March 1, 2023, unless you opt in.

Can I call it straight from the web page?

No. The JavaScript library refuses to run in a browser unless you switch on dangerouslyAllowBrowser, because the key would be exposed. Call it from your server.

Which model should I start with?

The models page suggests GPT-6 Astra if you are unsure, GPT-6.1 Sol to balance quality and cost, and GPT-6 Luna for cheap, high-volume work.

Who owns the text the model writes for me?

You do. The docs say customers own their input and output.