The hosted gateway exposes OpenAI-compatible HTTP endpoints backed by B3IQ router policy. It selects eligible supply, enforces billing and customer policy, and records receipt metadata without storing raw prompts or outputs in the control plane.

Endpoints

MethodPathPurpose
GET/v1/modelsList router-eligible, observed, paid-route-capable public model profiles
POST/v1/chat/completionsRun a hosted OpenAI-compatible chat completion through B3IQ route policy
GET/v1/billing/accountRead customer prepaid balance and gateway policy
GET/v1/billing/usageExport authenticated customer ledger usage
GET/v1/receipts/{receipt_hash}Read public-safe receipt evidence

List Models

bash
: "${B3IQ_GATEWAY_BASE_URL:?set B3IQ_GATEWAY_BASE_URL}": "${B3IQ_GATEWAY_KEY_FILE:?set B3IQ_GATEWAY_KEY_FILE}"cfg="$(mktemp)"chmod 600 "$cfg"trap 'rm -f "$cfg"' EXIT{ printf 'url = "%s/v1/models"\n' "${B3IQ_GATEWAY_BASE_URL%/}" printf 'header = "Authorization: Bearer %s"\n' "$(sed -n '1p' "$B3IQ_GATEWAY_KEY_FILE")"} > "$cfg"curl --fail --silent --show-error --config "$cfg"

/v1/models is intentionally narrow. It lists only models with at least one route-eligible public profile backed by observed benchmark evidence.

Chat Completion

bash
: "${B3IQ_GATEWAY_BASE_URL:?set B3IQ_GATEWAY_BASE_URL}": "${B3IQ_GATEWAY_KEY_FILE:?set B3IQ_GATEWAY_KEY_FILE}"cfg="$(mktemp)"chmod 600 "$cfg"trap 'rm -f "$cfg"' EXIT{ printf 'url = "%s/v1/chat/completions"\n' "${B3IQ_GATEWAY_BASE_URL%/}" printf 'request = "POST"\n' printf 'header = "Authorization: Bearer %s"\n' "$(sed -n '1p' "$B3IQ_GATEWAY_KEY_FILE")" printf 'header = "Content-Type: application/json"\n'} > "$cfg"curl --fail --silent --show-error --config "$cfg" --data-binary @- <<'JSON'{ "model": "Qwen3.6-35B-A3B-UD-Q5_K_XL.gguf", "messages": [{ "role": "user", "content": "Say hello from B3IQ." }], "max_tokens": 64}JSON

Streaming

Set stream: true to request SSE streaming. Customer-billed hosted streaming proxies the selected node stream while parsing final usage and b3iq.receipt_hash metadata for billing and receipt settlement.

json
{ "model": "Qwen3.6-35B-A3B-UD-Q5_K_XL.gguf", "messages": [{ "role": "user", "content": "Stream a short response." }], "stream": true}

Billing And Policy

Hosted chat can fail closed when:

  • No healthy candidate passes route, protocol, model, benchmark, and policy gates.
  • The gateway key lacks scope or a usable customer identity.
  • Customer balance is insufficient.
  • The request exceeds max price, model allowlist, route tier, or spend cap.
  • Router or customer rate limits are exceeded.
  • An incident control pauses a route class, node, or payout path.

See Errors for stable machine codes.

Headers

HeaderDirectionDescription
AuthorizationRequestBearer hosted gateway key
Idempotency-KeyRequestOptional for paid gateway requests. Stored only as a hash.
X-B3IQ-Router-Dispatch-ModeResponseRouted response dispatch mode
X-B3IQ-Router-Node-IDResponseSelected node ID when policy exposes it
X-B3IQ-Receipt-HashResponseReceipt hash returned by the selected node
Do not mix customer credentials

Customer-owned gateway keys can carry billing ownership. Do not also send raw customer headers with those keys unless an operator smoke path explicitly requires it.

Ask a question... ⌘I