Skip to main content

Create Model Response

POST /v1/responses
The Responses API provides a more concise interface for creating model responses.

Authentication

Authorization: Bearer YOUR_API_KEY

Basic Request

curl https://crazyrouter.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o",
    "input": "Explain what an API is in one sentence"
  }'

Response Format

{
  "id": "resp_abc123",
  "object": "response",
  "created_at": 1709123456,
  "model": "gpt-4o",
  "output": [
    {
      "type": "message",
      "id": "msg_abc123",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "An API is a set of rules and protocols that define how software components interact, enabling different programs to communicate and share data."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 15,
    "output_tokens": 40,
    "total_tokens": 55
  }
}

Multi-Turn Conversation

Use the input array to pass conversation history:
Python
response = client.responses.create(
    model="gpt-4o",
    input=[
        {"role": "user", "content": "I want to learn programming"},
        {"role": "assistant", "content": "Great! Which programming language would you like to learn?"},
        {"role": "user", "content": "Python, where should I start?"}
    ]
)

print(response.output_text)

Streaming Request

curl https://crazyrouter.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o",
    "input": "Write a poem about programming",
    "stream": true
  }'

Streaming Event Types

Event TypeDescription
response.createdResponse created
response.in_progressResponse processing
response.output_item.addedNew output item added
response.content_part.addedNew content block added
response.output_text.deltaText increment
response.output_text.doneText complete
response.content_part.doneContent block complete
response.output_item.doneOutput item complete
response.completedResponse complete

Thinking Control

Use the reasoning parameter to control reasoning depth:
Python
response = client.responses.create(
    model="o4-mini",
    input="Prove the Pythagorean theorem",
    reasoning={
        "effort": "high"
    }
)

print(response.output_text)

reasoning Parameter

FieldTypeDescription
effortstringReasoning depth: low, medium, high
summarystringThinking summary mode: auto, concise, detailed

Request Parameters

ParameterTypeRequiredDescription
modelstringYesModel name
inputstring|arrayYesInput content or message list
streambooleanNoWhether to stream output
temperaturenumberNoSampling temperature
max_output_tokensintegerNoMaximum output tokens
toolsarrayNoAvailable tools list
reasoningobjectNoReasoning control
instructionsstringNoSystem instructions (similar to system message)
The Responses API’s input parameter can be either a simple string or a message array, providing more flexibility.