Skip to content

Responses

Generate text with any text model using the OpenAI Responses API. This endpoint is a drop-in for client.responses.create(...) — point the OpenAI SDK at ImageRouter by changing the base URL. You are billed on the true token cost of each request.

Terminal window
curl 'https://api.imagerouter.io/v1/openai/responses' \
-H 'Authorization: Bearer YOUR_API_KEY' \
--json '{
"model": "openai/gpt-4o-mini",
"input": "Write a haiku about the ocean."
}'

Set stream: true to receive a Server-Sent Events stream of Responses API events. The stream is proxied unchanged, and the final response.completed event carries token usage and the true cost.

Terminal window
curl 'https://api.imagerouter.io/v1/openai/responses' \
-H 'Authorization: Bearer YOUR_API_KEY' \
--json '{
"model": "openai/gpt-4o-mini",
"input": "Write a haiku about the ocean.",
"stream": true
}'
  • model required Text model to use for the response.

  • input required The prompt. Either a plain string or an array of input items in OpenAI Responses format.

  • stream optional When true, response events are streamed as Server-Sent Events. Defaults to false.

  • instructions, max_output_tokens, temperature, top_p, tools, tool_choice, reasoning, text, … optional All standard OpenAI Responses parameters are passed through to the model unchanged.

{
"id": "resp_...",
"object": "response",
"created_at": 1234567890,
"model": "openai/gpt-4o-mini",
"output": [
{
"type": "message",
"role": "assistant",
"content": [{ "type": "output_text", "text": "..." }]
}
],
"usage": {
"input_tokens": 12,
"output_tokens": 24,
"total_tokens": 36,
"cost": 0.0000123
},
"cost": 0.0001
}

usage.cost is the true upstream cost in USD. The top-level cost field is what was charged to your ImageRouter credits (the true cost, rounded up to the nearest 1/10,000 USD).