Responses
POST /v1/responses — OpenAI's newer surface, for the new SDK helpers and agents.
POST
https://iranrouter.com/v1/responsesOpenAI's Responses API — what client.responses.create and the Agents SDK call. It rides the chat/completions engine: the request is translated in, the answer comes back as a Response object or as this API's stream events. Routing, billing and failover are identical.
from openai import OpenAI client = OpenAI(api_key="ir-...", base_url="https://iranrouter.com/v1") resp = client.responses.create( model="openai/gpt-4o-mini", instructions="کوتاه جواب بده.", input="پایتخت ایران کجاست؟", ) print(resp.output_text)
What is supported
| Parameter | Behaviour |
|---|---|
input | A string, or items: messages with input_text / input_image / input_file parts, and prior function_call / function_call_output turns. |
instructions | The system message. |
tools | Function tools only. Built-in tools (web_search, file_search, …) are refused with a 400, not silently dropped. |
tool_choice / parallel_tool_calls | Supported. |
text.format | json_object and json_schema (name, schema, strict). |
reasoning.effort | Reaches the reasoning models. |
max_output_tokens | The output ceiling; like max_tokens it drives the wallet hold. |
stream | This API's SSE events: response.created, output_item.added, output_text.delta, function_call_arguments.delta, … and finally response.completed carrying the whole Response. |
previous_response_id | Not supported (400 unsupported_parameter): the server keeps no conversation state; send the earlier turns in input. |
The response's usage uses this API's names — input_tokens, output_tokens, input_tokens_details.cached_tokens, output_tokens_details.reasoning_tokens — plus cost_rial. status incomplete with incomplete_details.reason = max_output_tokens means the output ceiling was hit.
Idempotency-Key is not honoured on this path; for safe retries use chat/completions.