Skip to main content
Docs
Responses API

Responses API

The OpenAI Responses API, with stateful multi-turn conversations and Alvin auto-routing.

The Responses API is OpenAI's newer inference interface. It works across every provider in the catalog — pass any model ID, or elyxir-alvin to let Alvin route.

Endpoint

POST https://api.elyxir.ai/v1/responses

How it differs from Chat Completions

Chat CompletionsResponses
Prompt fieldmessages arrayinput — string or array
System promptA system messageinstructions
Multi-turnResend the full historyprevious_response_id
Output capmax_tokensmax_output_tokens
StreamingToken deltasRicher typed events

The big practical win is previous_response_id: you continue a conversation by referencing the last response instead of resending every prior turn.

Body parameters

ParameterTypeRequiredDescription
modelstringYesModel ID, or elyxir-alvin for auto-routing
inputstring | arrayYesA prompt string, or an array of {role, content} items
instructionsstringNoSystem-level instructions
temperaturenumberNoDefaults to 0.7
max_output_tokensintegerNoCap on generated tokens
streambooleanNoStream the response. Defaults to false
previous_response_idstringNoContinue from an earlier response
toolsarrayNoCustom function tools — see below

Roles accepted in a structured input are developer, user, and assistant.

Examples

curl -X POST https://api.elyxir.ai/v1/responses \
  -H "Authorization: Bearer elyxir_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "elyxir-alvin",
    "input": "Write a Python function to sort a list using merge sort",
    "max_output_tokens": 2000
  }'

With system instructions

{
  "model": "claude-sonnet-4-6",
  "instructions": "You are a senior software engineer. Be concise and include code examples.",
  "input": [
    {"role": "user", "content": "How do I implement retry logic with exponential backoff?"}
  ],
  "temperature": 0.3
}

Continuing a conversation

Reference the previous response instead of resending the history:

{
  "model": "gpt-4o",
  "input": "Can you add error handling to that function?",
  "previous_response_id": "resp_abc123"
}

Tools

Custom function tools work as they do in the OpenAI API — send type: "function" entries in tools.

Alvin routing

Set model to elyxir-alvin and the response carries the routing decision in X-Alvin-Model, X-Alvin-Task-Type and X-Alvin-Confidence headers, plus a routing field in the body. See Alvin routing.

Which should I use?

Use Chat Completions if you have existing OpenAI-compatible code, or you want the widest client-library support.

Use Responses for new work, especially long multi-turn conversations where previous_response_id saves you resending — and paying for — the whole history on every turn.

Responses API | Alvin