Create a response

Use the OpenAI Responses API to create a model response. Supports multi-turn conversations, tool calls, reasoning, and more.

POST /v1/responses

Service root: https://getrouter.ai

Protocol: OpenAI Responses

Authentication: Authorization: Bearer YOUR_API_KEY

Request body

The request body is required. Media type: application/json

Request fields

FieldTypeRequiredDescription
modelstringYes
inputstring or array<object>NoInput content, either a string or an array of messages
instructionsstringNo
max_output_tokensintegerNo
temperaturenumberNo
top_pnumberNo
streambooleanNo
toolsarray<object>No
tool_choicestring or objectNo
reasoningobjectNo
previous_response_idstringNo
truncationstringNoAllowed values: auto, disabled

Example request

curl --request POST \
  --url https://getrouter.ai/v1/responses \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "MODEL_ID",
  "stream": false,
  "temperature": 1,
  "max_output_tokens": 1
}'

Responses

StatusDescription
200Response created successfully

Success response fields

FieldTypeRequiredDescription
idstringNo
objectstringNo
created_atintegerNo
statusstringNoAllowed values: completed, failed, in_progress, incomplete
modelstringNo
outputarray<object>No
usageobjectNo

Example response

{
  "id": "string",
  "object": "object",
  "created_at": 1,
  "status": "completed",
  "model": "MODEL_ID",
  "output": [
    {
      "type": "string",
      "id": "string",
      "status": "completed",
      "role": "user",
      "content": [
        {
          "type": "string",
          "text": "string"
        }
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 1,
    "completion_tokens": 1,
    "total_tokens": 1,
    "prompt_tokens_details": {
      "cached_tokens": 1,
      "text_tokens": 1,
      "audio_tokens": 1,
      "image_tokens": 1
    },
    "completion_tokens_details": {
      "text_tokens": 1,
      "audio_tokens": 1,
      "reasoning_tokens": 1
    }
  }
}

For complete workflows and examples, read the Responses API Guide.


This page is generated from the public Relay OpenAPI specification. Browse the complete specification in the API Explorer.