# Create a response (OpenAI Responses)

> POST /v1/responses on BigModel.io. The OpenAI Responses API used by Codex CLI, with streaming and tools. Send the full input each turn; previous_response_id is not supported over HTTP.

Web version: https://bigmodel.io/docs/api-responses · Updated 2026-10-18

`POST https://bigmodel.io/v1/responses`

The OpenAI Responses endpoint, used by [Codex CLI](https://bigmodel.io/docs/codex-cli). OpenAI groups serve it natively and Anthropic groups convert it; chat-only groups (DeepSeek, GLM platforms) return `404`. Over HTTP the gateway is stateless: `previous_response_id` returns `400`, so send the whole conversation in `input` every turn.

## Request

```http
POST https://bigmodel.io/v1/responses
```

### Authentication

| Header | Value |
|---|---|
| `Authorization` | `Bearer $BIGMODEL_API_KEY` |
| `x-api-key` | `$BIGMODEL_API_KEY` |

Send one of these.

### Body

| Field | Type | Required | Description |
|---|---|---|---|
| `model` | string | Yes | Model ID. |
| `input` | string \| array<object> |  | Text or input items. |
| `instructions` | string |  | System instructions. |
| `stream` | boolean |  | Must be a boolean when present. |
| `tools` | array<object> |  |  |
| `reasoning` | object |  |  |
| `reasoning.effort` | string |  |  |
| `previous_response_id` | string |  | Not supported over HTTP (returns 400). Send the whole conversation in `input`. |

## Response

| Status | Meaning |
|---|---|
| `200` | A response object, or Responses SSE events when `stream` is true. |
| `400` | `api_key_in_query_deprecated` (key sent in the query string), or `invalid_request_error`: empty or invalid JSON, missing `model`, a non-boolean `stream`, or another malformed field. |
| `401` | `API_KEY_REQUIRED`, `INVALID_API_KEY`, `API_KEY_DISABLED`, `USER_NOT_FOUND`, `USER_INACTIVE`. |
| `403` | `INSUFFICIENT_BALANCE`, `API_KEY_EXPIRED`, `ACCESS_DENIED` (IP rule), `SUBSCRIPTION_NOT_FOUND`, `SUBSCRIPTION_INVALID`, or a `permission_error` (key without a group, endpoint not allowed for the group). |
| `404` | `not_found_error`: the key group only serves `/v1/chat/completions`. |
| `413` | Request body too large. |
| `429` | `API_KEY_QUOTA_EXHAUSTED`, `USAGE_LIMIT_EXCEEDED` (plan limit), or `rate_limit_exceeded` / `rate_limit_error` (key 5h/1d/7d limit, requests per minute, concurrency, upstream). RPM limits send `Retry-After`. |
| `502` | `upstream_error`: the model provider failed. |
| `503` | `api_error` and similar: no capacity for this model in your group right now, or the model is not served by your group (`No available accounts`). |

With `stream: true` the response is the Responses event stream (`response.created`, `response.output_text.delta`, …, `response.completed`).


## Examples

```bash [cURL]
curl https://bigmodel.io/v1/responses \
  -H "Authorization: Bearer $BIGMODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3",
    "instructions": "You are a concise assistant.",
    "input": "Explain HTTP 429 in one sentence."
  }'
```

```python [Python]
import os
from openai import OpenAI

client = OpenAI(base_url="https://bigmodel.io/v1", api_key=os.environ["BIGMODEL_API_KEY"])

resp = client.responses.create(
    model="glm-5.3",
    instructions="You are a concise assistant.",
    input="Explain HTTP 429 in one sentence.",
)
print(resp.output_text)
```

```js [Node.js]
import OpenAI from 'openai'

const client = new OpenAI({baseURL: 'https://bigmodel.io/v1', apiKey: process.env.BIGMODEL_API_KEY})

const resp = await client.responses.create({
  model: 'glm-5.3',
  instructions: 'You are a concise assistant.',
  input: 'Explain HTTP 429 in one sentence.',
})
console.log(resp.output_text)
```

Example response, abridged to the main fields of the standard Responses object (the `id`s, text and token counts are illustrative):

```json
{
  "id": "resp_...",
  "object": "response",
  "status": "completed",
  "model": "glm-5.3",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [{"type": "output_text", "text": "HTTP 429 means you sent too many requests in a given time and should retry later."}]
    }
  ],
  "usage": {"input_tokens": 21, "output_tokens": 19, "total_tokens": 40}
}
```

### Multi-turn without previous_response_id

```python [Python]
history = [{"role": "user", "content": "My name is Ana."}]
first = client.responses.create(model="glm-5.3", input=history)

history += [
    {"role": "assistant", "content": first.output_text},
    {"role": "user", "content": "What is my name?"},
]
second = client.responses.create(model="glm-5.3", input=history)
print(second.output_text)
```

## Notes

- **`previous_response_id` is rejected over HTTP** with `400` `invalid_request_error` ("previous_response_id is only supported on Responses WebSocket v2"). Keep the history yourself and resend it, as above. `GET /v1/responses` is the WebSocket transport; without an `Upgrade` header it returns `426`.
- **`stream` must be a boolean** when present; anything else returns `400` "invalid stream field type".
- **Chat-only groups return `404`.** Use [Chat Completions](https://bigmodel.io/docs/api-chat-completions) with those keys.
- **Unknown model → `503`** `api_error` "No available accounts", not `404`.
- **Error shape.** OpenAI groups return `{"error":{"type","message"}}`; on Anthropic groups errors from this endpoint look like `{"error":{"code","message"}}`. Key checks use `{"code","message"}`. Mid-stream errors arrive as an SSE `error` event. Full list: [Errors](https://bigmodel.io/docs/errors).

## Related

- [Codex CLI](https://bigmodel.io/docs/codex-cli)
- [Streaming](https://bigmodel.io/docs/streaming)
- [Reasoning & thinking](https://bigmodel.io/docs/reasoning)
