Chat
OpenAI-compatible chat completions. Reference for API version 2026-11-11.
On this page
Create a chat completion
/api/v1/llm/v1/chat/completions OpenAI-compatible chat completions with tool calling, structured output and streaming. Every request is routed to a Nebula model; vendor model ids and retired Nebula ids resolve to nebula-4.5. Requires the llm:access or llm:chat scope. A credit check runs before the model is called (402 when the organization has no spendable credit or its spend cap is reached).
Authentication
- API key in X-API-Key
- API key or session token in Authorization: Bearer
Headers
Idempotency-KeystringRun this exact request at most once in 24 hours. A replay with the same key and the same body, from the same organization, user and API key, is refused with
409before any model call. See the Idempotency guide.- Minimum length
1
X-Request-IDstringOptional correlation id. Echoed in the
X-Request-IDresponse header and in error bodies.
Request body
modelstringnebula-4.5(text, smart-routed) ornebula-v(vision). Unknown and retired ids resolve tonebula-4.5.- Default
nebula-4.5
messagesarray of objects Required5 fields in
messagesrolestring Required- One of
systemuserassistanttool
contentstring or array of objects or nullText, or an array of content parts (
text, andimage_urlfornebula-v).namestring or nulltool_callsarray of objects or null3 fields in
tool_callsidstringtypestring- Always
function
functionobject2 fields in
functionnamestringargumentsstringJSON-encoded arguments.
tool_call_idstring or nullFor
role: tool, the id of the call being answered.
max_tokensinteger or nullOutput-token ceiling. An explicit value is clamped to the platform maximum.
- Minimum
1
max_completion_tokensinteger or nullAlias of
max_tokens; when both are sent, the smaller wins.- Minimum
1
temperaturenumber or null- Default
0.7- Minimum
0- Maximum
2
top_pnumber or null- Default
1- Minimum
0- Maximum
1
streamboolean or null- Default
false
stopstring or array of strings or nulltoolsarray of objects or nullOpenAI-format function tool definitions.
tool_choicestring or object or nullauto,none,required, or{ "type": "function", "function": { "name": … } }.parallel_tool_callsboolean or nullresponse_formatobject or null{ "type": "json_object" }or{ "type": "json_schema", "json_schema": { … } }.reasoning_effortstring or nullRequested reasoning depth. Omit it for adaptive routing.
- One of
nonelowmediumhighmaxxhighultranull
userstring or nullA stable session or end-user id. Send the same value on every turn of a conversation so prompt caching can reuse earlier context.
Responses
200Achat.completionobject, or withstream: trueatext/event-streamofchat.completion.chunkevents ending withdata: [DONE]. Errors after the stream opens arrive in-band as aStreamErrorevent.Headers
X-Request-IDstringThe request's correlation id (yours, or one BreachLine generated). Quote it to support.
Body (application/json)
idstringobjectstring- Always
chat.completion
createdintegermodelstring- Examples
nebula-4.5
choicesarray of objects3 fields in
choicesindexintegermessageobject5 fields in
messagerolestring Required- One of
systemuserassistanttool
contentstring or array of objects or nullText, or an array of content parts (
text, andimage_urlfornebula-v).namestring or nulltool_callsarray of objects or null3 fields in
tool_callsidstringtypestring- Always
function
functionobject2 fields in
functionnamestringargumentsstringJSON-encoded arguments.
tool_call_idstring or nullFor
role: tool, the id of the call being answered.
finish_reasonstring- Examples
stoplengthtool_calls
usageobject3 fields in
usageprompt_tokensintegercompletion_tokensintegertotal_tokensinteger
402The organization has no spendable credit, or its self-service spend cap is reached. Top up or raise the cap in the console. This status currently carriesmessage: "Error"andcode: "INTERNAL_9001"; rely on the HTTP status.Error envelope409This exact request (sameIdempotency-Keyand body) already ran, so it was not run again. Send a newIdempotency-Keyto run it again.Error envelope429A per-key request limit was exceeded, or the rate limiter could not be reached (it fails closed). There is noRetry-Afterfor a window limit; wait for the next window. A concurrency limit, when configured, also returns429, withRetry-After.Error envelope503A dependency is temporarily unavailable, or a non-streaming completion finished without an answer. Retry with backoff and honourRetry-Afterwhen present. The empty-completion case uses an OpenAI-style error object withoutstatusorrequest_id.Headers
X-Request-IDstringThe request's correlation id (yours, or one BreachLine generated). Quote it to support.
Retry-AfterintegerSeconds to wait before retrying.
Body (application/json)
Example
curl -X POST "https://api.breachline.io/api/v1/llm/v1/chat/completions" \
-H "Authorization: Bearer $BREACHLINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nebula-4.5",
"messages": [
{
"role": "system",
"content": "You are a concise security assistant."
},
{
"role": "user",
"content": "Explain what a reflected XSS finding means for a login page."
}
]
}'
{
"id": "string",
"object": "chat.completion",
"created": 0,
"model": "nebula-4.5",
"choices": [
{
"index": 0,
"message": {
"role": "system",
"content": "string",
"name": "string",
"tool_calls": [
{
"id": null,
"type": null,
"function": null
}
],
"tool_call_id": "string"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
}
}