> ## Documentation Index
> Fetch the complete documentation index at: https://runcrate.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Responses API and Codex

> Run Codex and the OpenAI SDKs' Responses API on Runcrate models with a Runcrate API key.

Codex and the OpenAI SDKs' `responses.create` run on Runcrate models: point them at `https://api.runcrate.ai/v1` with your Runcrate API key and a Runcrate model id. Requests are billed, rate limited and routed exactly as [chat completions](/docs/models/chat-completions.md) are, at the same per-token prices. Nothing is stored: every request carries its whole conversation, as Codex sends it.

## Codex

Add a Runcrate provider to `~/.codex/config.toml`:

```toml theme={"theme":{"light":"github-light","dark":"catppuccin-mocha"}}
model = "zai-org/GLM-5.3"
model_provider = "runcrate"

[model_providers.runcrate]
name = "Runcrate"
base_url = "https://api.runcrate.ai/v1"
env_key = "RUNCRATE_API_KEY"
wire_api = "responses"
```

Then run Codex with your key in `RUNCRATE_API_KEY`:

```bash theme={"theme":{"light":"github-light","dark":"catppuccin-mocha"}}
export RUNCRATE_API_KEY=rc_live_YOUR_API_KEY
codex
```

Any text model with tool calling in the [model catalog](/docs/models/model-catalog.md) works. Codex warns that it has no metadata for a model id it does not know and uses its defaults for the context window. Codex's web search tool runs at OpenAI, so it is left out here: the model answers without it.

## Endpoint

```
POST https://api.runcrate.ai/v1/responses
```

## Basic usage

```bash curl theme={"theme":{"light":"github-light","dark":"catppuccin-mocha"}}
curl https://api.runcrate.ai/v1/responses \
  -H "Authorization: Bearer $RUNCRATE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org/GLM-5.3",
    "instructions": "Answer in one paragraph.",
    "input": "Explain quantum computing in simple terms",
    "max_output_tokens": 512,
    "store": false
  }'
```

```python Python theme={"theme":{"light":"github-light","dark":"catppuccin-mocha"}}
from openai import OpenAI

client = OpenAI(base_url="https://api.runcrate.ai/v1", api_key="rc_live_YOUR_API_KEY")

response = client.responses.create(
    model="zai-org/GLM-5.3",
    input="Explain quantum computing in simple terms",
    store=False,
)
print(response.output_text)
```

```javascript JavaScript theme={"theme":{"light":"github-light","dark":"catppuccin-mocha"}}
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.runcrate.ai/v1", apiKey: "rc_live_YOUR_API_KEY" });

const response = await client.responses.create({
  model: "zai-org/GLM-5.3",
  input: "Explain quantum computing in simple terms",
  store: false,
});
console.log(response.output_text);
```

## Streaming

With `stream: true` the answer arrives as `response.*` events: `response.created` and `response.in_progress`, then each output item as `response.output_item.added`, its parts and deltas (`response.output_text.delta`, `response.reasoning_summary_text.delta`, `response.function_call_arguments.delta`) and `response.output_item.done`, then `response.completed` with the whole response and its usage. A response cut short by `max_output_tokens` ends with `response.incomplete`; one that fails, with `response.failed`.

```javascript theme={"theme":{"light":"github-light","dark":"catppuccin-mocha"}}
const stream = client.responses.stream({ model: "zai-org/GLM-5.3", input: "Write a poem", store: false });
stream.on("response.output_text.delta", (event) => process.stdout.write(event.delta));
const final = await stream.finalResponse();
```

## Tools

Function tools take `name`, `description` and `parameters`. A call comes back as a `function_call` item; send it back in `input` with a `function_call_output` item carrying its `call_id`.

```javascript theme={"theme":{"light":"github-light","dark":"catppuccin-mocha"}}
const tools = [{
  type: "function",
  name: "get_weather",
  description: "Weather for a city",
  parameters: { type: "object", properties: { city: { type: "string" } }, required: ["city"] },
}];
const ask = { model: "zai-org/GLM-5.3", tools, store: false, input: [{ role: "user", content: "Weather in Paris?" }] };

const first = await client.responses.create(ask);
const call = first.output.find((item) => item.type === "function_call");

const answer = await client.responses.create({
  ...ask,
  input: [...ask.input, ...first.output, { type: "function_call_output", call_id: call.call_id, output: "18C and sunny" }],
});
```

## What is supported

| Responses API | On Runcrate |
| - | - |
| `instructions`, and `developer` or `system` messages | Supported, as the model's system prompt |
| `input` as a string, or `message`, `function_call`, `function_call_output`, `custom_tool_call` and `custom_tool_call_output` items | Supported |
| `input_text` and `input_image` (a URL or a data URL) parts | Supported. Images need a vision model. |
| `reasoning` items sent back | Accepted; not passed to the model again |
| `function`, `custom` and `namespace` tools | Supported |
| `tool_choice` (`auto`, `none`, `required`, a named tool), `parallel_tool_calls` | Supported, where the model supports forcing a tool |
| `max_output_tokens`, `temperature`, `top_p`, `prompt_cache_key`, `stream` | Supported |
| `reasoning.effort` | `minimal` and `low` are low, `medium` medium, `high` and `xhigh` high |
| `text.format` `json_object` or `json_schema` | Supported, where the model supports structured output |
| `store`, `include`, `metadata` | Accepted; nothing is stored, and the response says `store: false` |
| Hosted tools (`web_search`, `file_search`, `code_interpreter`, ...) | Left out; the model answers without them |
| `previous_response_id`, `conversation`, `background`, `input_file`, image `file_id` | Not supported: 400 |

A model's reasoning comes back as a `reasoning` item whose summary is the reasoning text.

## Errors

Errors use OpenAI's shape, `{"error": {"message", "type", "code", "param"}}`, with the same codes as [chat completions](/docs/models/chat-completions.md), including the free allowance's (`free_allowance_used`, `free_tier_paused`, `free_capacity_busy`, `free_prompt_too_large`, `github_link_required`, with its `free_tier` details beside them). A `Retry-After` header says when to retry a 429 or 503.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.