Skip to content

Responses API

The Responses API is the recommended way to generate model output, including text, structured outputs, tool calls, and streaming.

Key concepts

  • Response: a top-level result object returned by the API.
  • Input: can be a simple string or a structured list of input items (text, images, files, etc.).
  • Output: returned as an array of output items; clients can also aggregate text.

Minimal example

bash
# POST /v1/responses
curl https://api.fastapi.ai/v1/responses \
  -H "Authorization: Bearer $FAST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4.1","input":"Hello"}'

Common pitfalls

  • If you enable streaming, you must parse server-sent events (SSE) and handle error events.
  • Avoid mixing incompatible parameters across model families.
  • If you request structured output, enforce it in both configuration and instructions.

See also:

  • /api/response/object
  • /api/response/streaming
  • /api/response/input-tokens

那年我双手插兜, 让bug稳如老狗