Skip to main content

Quick Start

Use your Planck API key and the AI Gateway base URL. Then call the OpenAI SDK’s responses.create method as usual.
For Chat Completions usage and more background on the AI Gateway, see the AI Gateway Overview.

Streaming

Use stream: true for HTTP server-sent events. Text and plaintext reasoning stream incrementally. Each event has a sequence number; output items retain their IDs through completion. Tool names, IDs and arguments can arrive in fragments from providers. The adapter assembles and validates the JSON before emitting the tool call, so a client never executes truncated arguments. Tool input events therefore arrive when the provider finishes the call, rather than token by token. A normal finish emits response.completed. A token limit or content filter emits response.incomplete. Provider errors, malformed tool JSON and a stream that ends without its terminal marker emit response.failed. Clients should inspect the terminal status before treating a turn as successful.

Tools and follow-up turns

The adapter supports function tools, namespaced function tools, and custom text tools. Namespaces are mapped to unique provider-safe names and restored in the response. Custom tools are transported as function calls with a string input property; custom grammar descriptions are passed to the model, but grammar-constrained decoding is not guaranteed. This route is stateless. Set store: false, then include the previous input, returned output items and tool outputs in the next request:
model, tools and runApprovedTool in this example are application-defined. Execute only tools authorized by your application. For parallel calls, supply the result for every call before continuing. Custom tools use custom_tool_call_output. Plaintext reasoning items emitted by this adapter can be replayed with the rest of the output. previous_response_id, store: true, encrypted reasoning from a different provider, and provider-hosted tools such as web search are rejected. WebSocket continuation and server-side response retrieval are not implemented by this adapter.

Provider Mapping

Responses requests are normalized through the gateway pipeline so they can use Planck routing, billing, logging, and provider mapping. When a request is routed to a non-OpenAI provider, the gateway maps the request and response into the closest compatible shape. For custom targets, POST /v1/responses is BYOK-only and requires the target to be configured for your organization or enabled as a local development target.

Codex model metadata

GET /v1/codex/models returns Codex metadata for tool-capable text models accessible to the same Planck key. Use ?models= with comma-separated exact gateway model IDs to restrict the catalog. The metadata includes model route, context limit, input modalities and recorded reasoning settings. It does not advertise hosted search or upgrade aliases. The endpoint uses the same organization policies and credentials as /v1/models. A requested unavailable model returns an error. Catalogs over 1 MiB require a narrower models selection. See the Codex integration for configuration.

References