Responses

POST /v1/responses

Use the Responses API format for models like GPT-5 Pro and Codex that require it, or let Chuizi.AI auto-translate from Chat Completions.

Request

POST https://api.chuizi.ai/v1/responses

Authentication

Authorization: Bearer ck-your-api-key

Parameters

ParameterTypeRequiredDefaultDescription
modelstringYesModel name, e.g. openai/gpt-5-pro, openai/codex-mini
inputstring/arrayYesInput text or array of input items
instructionsstringNoSystem-level instructions (equivalent to system message)
streambooleanNofalseEnable SSE streaming output
max_output_tokensintegerNoModel defaultMaximum tokens in the response
temperaturenumberNoModel defaultSampling temperature, 0-2
toolsarrayNoTool/function definitions
textobjectNoText generation options including format for structured output
reasoningobjectNoReasoning configuration, e.g. {"effort": "high"}

Request Example

config.json
json
{
  "model": "openai/codex-mini",
  "input": "Write a Python function that calculates the Fibonacci sequence.",
  "instructions": "You are an expert Python developer. Write clean, well-documented code.",
  "max_output_tokens": 2048,
  "reasoning": { "effort": "high" }
}

Response

config.json
json
{
  "id": "gen-xxxxxxxxxxxxxxxx",
  "object": "response",
  "created_at": 1712000000,
  "model": "openai/codex-mini",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "def fibonacci(n):\n    \"\"\"Calculate the nth Fibonacci number.\"\"\"\n    if n <= 1:\n        return n\n    a, b = 0, 1\n    for _ in range(2, n + 1):\n        a, b = b, a + b\n    return b"
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 28,
    "output_tokens": 95,
    "total_tokens": 123
  },
  "x_chuizi": {
    "generation_id": "gen-xxxxxxxxxxxxxxxx",
    "latency_ms": 3500,
    "cost": "0.00180000"
  }
}

Code Examples

terminal
bash
curl -X POST https://api.chuizi.ai/v1/responses \
  -H "Authorization: Bearer ck-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/codex-mini",
    "input": "Write a Python Fibonacci function",
    "max_output_tokens": 2048
  }'

Next Steps