POST /v1/responses) is OpenAI’s next-generation unified interface that handles text, images, file references, and tool sequences within a single request-response cycle. Through Fhddos, you get full streaming support, backward-compatible event handling, and extra billing metadata — without changing how you structure your requests. This page covers the request format, streaming events, tool calling, and practical tips for production use.
Endpoint
Basic request
Send a multimodal message by passinginput as a structured array of content parts. The role/content shape is familiar from Chat Completions, but the input field is more flexible — it accepts strings, arrays of typed objects, or a mix of both.
cURL
Prefer the array form for
input — it makes mixing text, images, and file references straightforward without restructuring your code later.Streaming
Enable streaming by adding"stream": true to the request body. The server returns incremental updates as server-sent events (SSE). Fhddos includes built-in backward-compatibility processing, so you can consume the stream with standard SSE clients.
Key event types you will encounter in a streamed response:
| Event | Description |
|---|---|
response.output_item.added | A new output item (text delta or tool call) has been added. |
response.output_item.done | An output item is complete. |
response.completed | The full response is finished; carries a usage summary. |
cURL (streaming)
Tool calling
Declare available functions in thetools array, exactly as you would in Chat Completions. When the model decides to call a tool, the result appears in the output array under a tool_calls field. Return the tool result in a follow-up input entry with role: "tool".
cURL
Structured output
Pass"response_format": {"type": "json_schema"} to force the model to return a valid JSON object. Combine this with a detailed system prompt — or an inline schema — to get machine-readable output every time.
cURL
Multi-turn conversations
Build conversation history by adding multiplerole/content entries to the input array. There is no separate conversation state — include the full context you need in each request.
Tips and gotchas
- Use the array form of
inputto mix text, images, and file references in one request. - The
response_formatfield acceptsjson_schemaandtext; combine it with Fhddos’s rate-limit controls for reliable automated pipelines. - Tool call results appear in
output[].tool_calls; pass them back inside arole: "tool"input entry on the next turn.
Request parameters
Model ID, e.g.
gpt-4.1. Use GET /v1/models to list models your token can access.The input to the model. Pass a plain string for simple text prompts, or an array of
{role, content} objects for multimodal or multi-turn input. content may itself be an array of typed parts (text, image_url, etc.).{"type": "json_schema"} forces structured JSON output. {"type": "text"} returns plain text.Function definitions the model may call. Each entry follows the same schema as Chat Completions
tools.Set to
true to receive incremental output via SSE. Defaults to false.