Run a hosted OpenAI-compatible chat completion.
Hosted chat always selects eligible routes through B3IQ pooled-sync router policy. Direct node targeting and private-job payloads are rejected. Customer-owned `b3iq_gateway_` keys bill their owning customer directly; callers should not also send raw customer headers with those keys. `stream: true` requests pass selected-node SSE through. Customer-billed streaming parses final SSE usage and `b3iq.receipt_hash` metadata for billing/receipt settlement without storing prompts or outputs.
POST
/v1/chat/completions
Hosted chat always selects eligible routes through B3IQ pooled-sync
router policy. Direct node targeting and private-job payloads are
rejected. Customer-owned `b3iq_gateway_` keys bill their owning
customer directly; callers should not also send raw customer headers
with those keys.
`stream: true` requests pass selected-node SSE through. Customer-billed
streaming parses final SSE usage and `b3iq.receipt_hash` metadata for
billing/receipt settlement without storing prompts or outputs.
Authentication
Bearer Token (b3iq_gateway)
Header Parameters
Idempotency-Key
string
optional
header
Optional for paid gateway requests. Stored only as a hash.
X-B3IQ-Customer-ID
string
optional
header
Operator/bootstrap paid-smoke credential. Do not send with customer-owned gateway keys.
X-B3IQ-Customer-Token
string
optional
header
Operator/bootstrap paid-smoke credential. Do not send with customer-owned gateway keys.
Request Body required
application/jsonmodel
string
REQUIRED
messages
object[]
REQUIRED
Array of:
role
string
REQUIRED
Enum:
system, user, assistant, toolcontent
unknown
REQUIRED
max_tokens
integer
temperature
number
top_p
number
stop
unknown
stream
boolean
n
integer
B3IQ currently rejects `n > 1`.
b3iq
object
Router policy metadata consumed by B3IQ and stripped before node dispatch.
model_profile_id
string
job_id
string
max_price_wei
string
dispatch_mode
string
Hosted chat rejects `private_job`.
Enum:
pooled_syncResponses
200
Chat completion response, or SSE stream when `stream` is true and allowed.
application/jsonid
string
REQUIRED
object
string
REQUIRED
created
integer
REQUIRED
model
string
REQUIRED
choices
object[]
REQUIRED
Array of:
usage
object
prompt_tokens
integer
completion_tokens
integer
total_tokens
integer
b3iq
object
runtime_id
string
runtime_kind
string
latency_ms
integer
ttft_ms
integer
receipt_hash
string
default
OpenAI-compatible error with B3IQ metadata.
curl -X POST 'https://{controlPlaneHost}/v1/chat/completions' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "model": "string", "messages": [ { "role": "system", "content": "string" } ], "max_tokens": 1, "temperature": 0, "top_p": 0, "stop": "string", "stream": false, "n": 1, "b3iq": { "model_profile_id": "string", "job_id": "string", "max_price_wei": "string", "dispatch_mode": "pooled_sync" }}'
const response = await fetch('https://{controlPlaneHost}/v1/chat/completions', { method: 'POST', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" }, body: JSON.stringify({ "model": "string", "messages": [ { "role": "system", "content": "string" } ], "max_tokens": 1, "temperature": 0, "top_p": 0, "stop": "string", "stream": false, "n": 1, "b3iq": { "model_profile_id": "string", "job_id": "string", "max_price_wei": "string", "dispatch_mode": "pooled_sync" } })});const data = await response.json();console.log(data);
200
Response
{ "id": "<string>", "object": "<string>", "created": 123, "model": "<string>", "choices": [ "<object>" ], "usage": { "prompt_tokens": 123, "completion_tokens": 123, "total_tokens": 123 }, "b3iq": { "runtime_id": "<string>", "runtime_kind": "<string>", "latency_ms": 123, "ttft_ms": 123, "receipt_hash": "<string>" }}
API Playground
Try this endpoint
POST
/v1/chat/completions
