# Responses

> The OpenAI Responses endpoint POST /v1/responses for GPT models, also used by clients such as Codex. Request examples and streaming events.

`POST https://api.goodapi.tech/v1/responses` is the OpenAI Responses endpoint for GPT models. Requests and responses match the official OpenAI API.

## Request

The headers are the same as for the other endpoints: `Authorization: Bearer sk-...` and `Content-Type: application/json`.

| Field | Description |
|---|---|
| `model` | GPT model name; see [Models and pricing](/en/docs/models) |
| `input` | A string, or an array of messages |
| `stream` | Optional; `true` for streaming |
| `instructions` | Optional; works like a system prompt |

Don't include `max_output_tokens` in the request.

## Example

```bash
curl https://api.goodapi.tech/v1/responses \
  -H "Authorization: Bearer $GOODAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-luna",
    "input": "Introduce yourself in one sentence."
  }'
```

Response (excerpt):

```json
{
  "id": "resp_...",
  "object": "response",
  "status": "completed",
  "model": "gpt-5.6-luna",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "status": "completed",
      "content": [{"type": "output_text", "text": "..."}]
    }
  ],
  "usage": {"input_tokens": 13, "output_tokens": 20, "total_tokens": 33}
}
```

The reply text is in `content[].text` of the `output` item whose `type` is `message`.

## Streaming

With `"stream": true` the response becomes SSE, and each event has an `event:` line and a `data:` line. Common events:

| Event | Meaning |
|---|---|
| `response.created` | Generation started |
| `response.output_text.delta` | Text delta, in the `delta` field |
| `response.output_text.done` | A block of text is complete |
| `response.completed` | Everything is done; includes the full `response` and `usage` |

## Using an SDK

```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["GOODAPI_API_KEY"],
    base_url="https://api.goodapi.tech/v1",
)

response = client.responses.create(
    model="gpt-5.6-luna",
    input="Hello",
)
print(response.output_text)
```

GPT models can also use [Chat Completions](/en/docs/chat-completions).
