# OpenAI API

> OpenAI's own web service. Your code sends it a request and gets a reply.

**Field:** Software Development  
**Category:** AI Engineering  
**Also known as:** OpenAI Responses API, Responses API, OpenAI Chat Completions API

## Think of it like

It is like a phone line to a big helper shop. You call, ask, and hear the answer.

## Definition

The OpenAI API is OpenAI's web service for using its GPT models in your code. For new apps, OpenAI says to use the Responses API. It lives at api.openai.com/v1/responses. The older Chat Completions API still works. Your key goes in a header called Authorization. There are code kits for Python, JavaScript, .NET, Java, Go and Ruby.

## Example

Jack's help bot sends each customer question to the OpenAI API. It uses the Responses API, and the reply text goes straight into the chat window.

## Example code

```bash
curl https://api.openai.com/v1/responses \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6-astra", "input": "Hello there"}'
```

One call to the Responses API. The key goes in the Authorization header.

## Why it matters

Its request shape became a common one. Many other model makers and local tools take calls in that shape.

## Common mistake

Starting a new app on the old Assistants API. OpenAI shut it down on August 26, 2026, so new work goes on the Responses API.

## Three principles

- **Responses API.** The one to use for new apps.
- **A bearer key.** Sent in the Authorization header.
- **Widely copied.** Other tools accept its format.

## Related terms

- [LLM API](https://learn.benibix.com/term/development/llm-api)
- [Claude API](https://learn.benibix.com/term/development/claude-api)
- [OpenAI](https://learn.benibix.com/term/ai/openai)
- [GPT (Generative Pre-trained Transformer)](https://learn.benibix.com/term/ai/gpt)
- [OpenAI-Compatible API](https://learn.benibix.com/term/ai/openai-compatible-api)
- [LiteLLM](https://learn.benibix.com/term/development/litellm)
- [OpenAI Agents SDK](https://learn.benibix.com/term/development/openai-agents-sdk)

## Told apart from

- [OpenAI API vs OpenAI-Compatible API](https://learn.benibix.com/compare/openai-api-vs-openai-compatible-api): People think any server that speaks the OpenAI format is OpenAI's own API. The OpenAI API is a service run by OpenAI, and it runs only its own models. A compatible API is any server that takes calls in the same shape. It might run a model on your laptop, or one from another firm. Your code stays the same, but the model behind it changes.

![Two request cards side by side. On the left, the Claude API: POST to api.anthropic.com/v1/messages, with an x-api-key header, an anthropic-version header and a JSON body with model, max_tokens and messages. On the right, the OpenAI API: POST to api.openai.com/v1/responses, with an Authorization Bearer header and a JSON body with model and input. Under both, the same thing comes back: the reply text and a count of tokens.](https://learn.benibix.com/diagrams/dev6-provider-apis.svg)

---

Source: https://learn.benibix.com/term/development/openai-api
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-20
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
