Responses API

The OpenAI Responses API (/v1/responses) is supported natively — the agent-oriented successor to Chat Completions. Some newer models (such as GPT-5.1) expose capabilities only through Responses. Use the OpenAI SDK's responses.create() or any Responses-compatible client; the request body is forwarded upstream unchanged.

Endpoint

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

The model goes in the body; stream with "stream": true.

Example request

{
  "model": "gpt-5.1",
  "input": [
    {"role": "user", "content": "What is the capital of France?"}
  ],
  "max_output_tokens": 200
}

Required headers

HeaderValueDescription
AuthorizationBearer gw-your-keyYour gateway API key
Content-Typeapplication/jsonRequest body format

Request body fields

FieldTypeRequiredDescription
modelstringYesPlatform model name, e.g. gpt-5.1
inputstring or arrayYesThe input (replaces Chat's messages): either a plain string or an array of structured items
instructionsstringNoSystem instruction (a separate field, not part of input)
max_output_tokensintNoMaximum output tokens (Chat's max_tokens)
reasoningobjectNoReasoning control, e.g. {"effort":"medium"}
toolsarrayNoTool definitions — function calling and built-in tools (see below)
streamboolNoWhether to stream
previous_response_idstringNoContinue a multi-turn conversation held upstream

Example response

{
  "id": "resp_abc123",
  "object": "response",
  "status": "completed",
  "model": "gpt-5.1",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [{"type": "output_text", "text": "The capital of France is Paris."}]
    }
  ],
  "usage": {
    "input_tokens": 8,
    "output_tokens": 7,
    "total_tokens": 15,
    "input_tokens_details": {"cached_tokens": 0},
    "output_tokens_details": {"reasoning_tokens": 0}
  }
}

Output lives in output[], an array of typed items that replaces Chat's choices; the text is in content[].output_text of the type=="message" item. Usage is in usage: input_tokens / output_tokens (which includes reasoning) / input_tokens_details.cached_tokens / output_tokens_details.reasoning_tokens.

With curl

curl -X POST "https://api.eclogue.ai/v1/responses" \
  -H "Authorization: Bearer gw-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.1",
    "input": "Hello!",
    "max_output_tokens": 100
  }'

Streaming

Set "stream": true and the response becomes a stream of typed semantic events (response.output_text.delta, response.completed, …). There is no [DONE] sentinel; the stream ends with response.completed, which carries the full usage:

curl -N -X POST "https://api.eclogue.ai/v1/responses" \
  -H "Authorization: Bearer gw-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.1",
    "input": "Tell me a story",
    "stream": true
  }'

With the OpenAI SDK

from openai import OpenAI

# point at the gateway, use your gateway key
client = OpenAI(
    api_key="gw-your-key-here",
    base_url="https://api.eclogue.ai/v1",
)

resp = client.responses.create(
    model="gpt-5.1",
    input="Hello!",
)
print(resp.output_text)

Built-in tools

Responses supports built-in tools executed on the model side (such as web_search). Declare them in tools; the upstream runs them and merges the results into output[]:

{
  "model": "gpt-5.1",
  "input": "What are today's top AI headlines?",
  "tools": [{"type": "web_search"}]
}

Built-in tools are charged per invocation, on top of tokens; see each model's pricing for rates. Ordinary function calls (type: "function") carry no extra charge and are billed on tokens alone.

Supported models

Models currently available over the Responses protocol:

  • gpt-5.1

See the models page for the full list and pricing.

Differences from Chat Completions

AspectChat CompletionsResponses
Endpoint/v1/chat/completions/v1/responses
Inputmessages[]input + instructions
Outputchoices[].messageoutput[] (typed items)
Output limit fieldmax_tokensmax_output_tokens
Streamingdelta chunks + [DONE]Semantic events, no [DONE]
Token fieldsprompt_tokens/completion_tokensinput_tokens/output_tokens
Built-in toolsNoneweb_search and others

Chat Completions is not going away, but new model capabilities land in Responses first. All three protocols share the same API key, balance and billing.

Notes

  • The request body is passed through unchanged. The gateway only reads usage from the response to extract token counts and built-in tool invocations for billing.
  • In streaming responses only the response.completed event carries a complete usage — this is standard Responses behaviour.