Chat Completions
Generate text using the OpenAI Chat Completions format.
POSThttps://api.outerlane.app/v1/chat/completions
This endpoint follows the OpenAI Chat Completions format and supports text and image inputs, function tools, structured outputs, reasoning, and streaming.
Example request
curl https://api.outerlane.app/v1/chat/completions \
-H "Authorization: Bearer $OUTERLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-6.1-sol",
"reasoning_effort": "medium",
"messages": [
{ "role": "system", "content": "Answer concisely." },
{ "role": "user", "content": "Explain the difference between HTTP 429 and 503." }
]
}'Request body
modelstringRequired
Text model ID, such as
openai/gpt-6.1-solmessagesobject[]Required
Array of conversation messages. Each message requires a
role. See Image input for image blocks.max_completion_tokensinteger
Maximum output tokens.
max_tokens is also accepted.reasoning_effortstring
Reasoning effort.
reasoning.effort is also accepted.toolsobject[]
response_formatobject
JSON mode or structured outputs
streamboolean
Set to
true to stream the response.stream_optionsobject
Set
include_usage: true to receive a usage chunk at the end of the stream.temperature, top_p, stop, seed, presence_penalty, frequency_penalty, logprobs, top_logprobs, and user are forwarded with their OpenAI semantics.
Only n: 1 is supported. Sending audio, functions, function_call, prediction, or web_search_options returns 400 unsupported_feature. Use Image generation to create images.
Response
{
"id": "req_a1b2c3d4e5f6a1b2c3d4e5f6",
"object": "chat.completion",
"created": 1790640000,
"model": "openai/gpt-6.1-sol",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "...", "refusal": null },
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 86,
"total_tokens": 110,
"prompt_tokens_details": { "cached_tokens": 0 },
"completion_tokens_details": { "reasoning_tokens": 16 }
},
"x_outerlane": {
"request_id": "req_a1b2c3d4e5f6a1b2c3d4e5f6",
"input": 24,
"cached": 0,
"output": 86,
"costUsd": 0.000454,
"chargedUsd": 0.000454,
"reasoning_effort": "medium"
}
}idmatches the request ID.- Reasoning output, when available, appears in
message.reasoning. - See Response metadata for
x_outerlane.
Streaming
With stream: true, the endpoint sends chat.completion.chunk events over SSE and ends with data: [DONE]. See Streaming for an example.
- Reasoning output arrives in
delta.reasoning. - The final chunk with
finish_reasonalso includesx_outerlane. - With
stream_options.include_usage: true, a separateusagechunk follows with an emptychoicesarray.