Create a response
Changed onCreates a streaming or non-streaming response using OpenResponses API format
Request
- Base URL: https://openrouter.ai/api/v1
- URL: https://openrouter.ai/api/v1/responses
- Auth: HTTP bearer
Headers
Opt-in level for surfacing routing metadata on the response under openrouter_metadata.
Opt-in to surface routing metadata on the response under openrouter_metadata. Defaults to disabled. The legacy header X-OpenRouter-Experimental-Metadata is also accepted for backward compatibility.
Request body
Example request
{
"input": [
{
"content": "Hello, how are you?",
"role": "user",
"type": "message"
}
],
"model": "anthropic/claude-4.5-sonnet-20250929",
"temperature": 0.7,
"tools": [
{
"description": "Get the current weather in a given location",
"name": "get_current_weather",
"parameters": {
"properties": {
"location": {
"type": "string"
}
},
"type": "object"
},
"type": "function"
}
],
"top_p": 0.9
}Response
Successful response
Example response
{
"completed_at": 1704067210,
"created_at": 1704067200,
"error": null,
"frequency_penalty": null,
"id": "resp-abc123",
"incomplete_details": null,
"instructions": null,
"max_output_tokens": null,
"metadata": null,
"model": "gpt-4",
"object": "response",
"output": [
{
"content": [
{
"annotations": [],
"text": "Hello! How can I help you today?",
"type": "output_text"
}
],
"id": "msg-abc123",
"role": "assistant",
"status": "completed",
"type": "message"
}
],
"parallel_tool_calls": true,
"presence_penalty": null,
"status": "completed",
"temperature": null,
"tool_choice": "auto",
"tools": [],
"top_p": null,
"usage": {
"input_tokens": 10,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 25,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 35
}
}Changes
- info
added the new optional request property
- info
- info
added
armordiscriminator mapping keys to the/request property - info
added to the
/request propertyoneOflist - info
added the optional property
/to the response with the status (media type: application/json) - info
added the optional property
////////to the response with the status (media type: text/event-stream) - info
added the optional property
////////to the response with the status (media type: text/event-stream) - info
added the optional property
////////to the response with the status (media type: text/event-stream) - info
added the optional property
////////to the response with the status (media type: text/event-stream) - info
added the optional property
////////to the response with the status (media type: text/event-stream)
- info