# Your First OpenAI API Request (Responses API)

> Create a key, set OPENAI_API_KEY, and make a working Responses API call in curl, Python, and Node — the API OpenAI recommends for new projects.

- Canonical: https://guides-ai.pages.dev/guides/openai-api-first-request/
- Plate 15.06 · Topic: Building with the API (https://guides-ai.pages.dev/topics/api/)
- Published: 06 Sept 2026 · 3 min read
- Source site: guides-ai — https://guides-ai.pages.dev/

OpenAI has two text endpoints. `/v1/chat/completions` still works, but the **Responses API** (`/v1/responses`) is the one OpenAI recommends for new projects — it handles tools, built-in tools and multi-step turns inside a single call.

## 1. Key and environment variable

```bash
export OPENAI_API_KEY="your-api-key-here"
```

Create the key in the OpenAI dashboard, then put it in the environment. Both SDKs read `OPENAI_API_KEY` automatically, so nothing below hardcodes a key.

## 2. curl

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

One prompt, one response. Note the differences from the Claude API: bearer auth instead of `x-api-key`, `input` instead of `messages`, and no mandatory token limit.

## 3. Python

```bash
pip install openai
```

```python
from openai import OpenAI

client = OpenAI()  # reads OPENAI_API_KEY

response = client.responses.create(
    model="gpt-6-astra",
    input="Explain HTTP 429 in one sentence.",
)

print(response.output_text)
```

`output_text` is a convenience property that concatenates the text output. The full structure lives in `response.output` — a list of items that can include messages, reasoning and tool calls.

## 4. Node

```javascript
import OpenAI from "openai";

const client = new OpenAI(); // reads OPENAI_API_KEY

const response = await client.responses.create({
  model: "gpt-6-astra",
  input: "Explain HTTP 429 in one sentence.",
});

console.log(response.output_text);
```

Install with `npm install openai`. Same request shape as Python — the SDKs mirror the JSON body.

## 5. System-style instructions and multi-turn input

```python
response = client.responses.create(
    model="gpt-6-astra",
    instructions="Answer in one sentence. No preamble.",
    input=[
        {"role": "user", "content": "Why is my API call rate limited?"},
        {"role": "assistant", "content": "Because you exceeded the request quota."},
        {"role": "user", "content": "How do I find the quota?"},
    ],
)
```

`instructions` is the high-level behaviour channel and takes priority over `input`. When you need it inside the conversation instead, `input` accepts a message array with the roles `developer`, `user` and `assistant` — `developer` is the Responses API's system role.

## Picking a model

`gpt-6-astra` is the current flagship; `gpt-5.6-terra` balances intelligence and cost, `gpt-5.6-luna` targets high-volume workloads. Model IDs turn over quickly — copy the exact string from OpenAI's models page rather than from a blog post.

---

Next: [structured outputs](/guides/openai-api-structured-outputs/) · [streaming responses](/guides/stream-llm-responses/).
