Responses API

The OpenAI Responses API is the protocol used by Codex CLI / Codex App and the newer OpenAI SDKs. XycAi relays it natively — over plain HTTP and over WebSocket — so Codex works out of the box with an XycAi key.

POST https://apicdn.xyc.ai/v1/responses

Request Example

curl https://apicdn.xyc.ai/v1/responses \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.5",
    "input": "Write a haiku about the sea.",
    "stream": true
  }'

With the official OpenAI SDK:

from openai import OpenAI

client = OpenAI(base_url="https://apicdn.xyc.ai/v1", api_key="sk-xxxxxxxx")

resp = client.responses.create(
    model="gpt-5.5",
    input="Write a haiku about the sea.",
)
print(resp.output_text)

Using Codex CLI / Codex App

Run our one-liner to configure Codex automatically (writes ~/.codex/config.toml and auth.json):

npx xycai@latest

Or configure manually in ~/.codex/config.toml:

model_provider = "xycai"
model = "gpt-5.5"
preferred_auth_method = "apikey"

[model_providers.xycai]
name = "xycai"
base_url = "https://apicdn.xyc.ai/v1"
wire_api = "responses"
requires_openai_auth = false
http_headers = { "x-openai-actor-authorization" = "xyc.ai" }
Image generation in the new Codex App

The two lines requires_openai_auth and http_headers are required for the built-in imagegen skill to display images in recent Codex App builds. Fully quit and restart Codex after editing.

WebSocket Mode

For clients that speak the Responses API over WebSocket (newer Codex builds), connect to the same path with wss:// — the gateway bridges WS to HTTP transparently:

wss://apicdn.xyc.ai/v1/responses

Recommended Models

gpt-5.6-sol, gpt-5.6-luna, gpt-5.6-terra, gpt-5.5, gpt-5.4, gpt-5.4-mini, and the gpt-5.x-codex series. See Models.

Response Structure

{
  "id": "resp_xxxxxxxx",
  "object": "response",
  "model": "gpt-5.5",
  "output": [
    {"type": "message", "role": "assistant", "content": [{"type": "output_text", "text": "..."}]}
  ],
  "usage": {"input_tokens": 12, "output_tokens": 40}
}