LLM Broker Chat API
The Chat API from LLM Broker — 2 operation(s) for chat.
The Chat API from LLM Broker — 2 operation(s) for chat.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/llm-broker-net:llm-broker-net-chat-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
description: 'One OpenAI-compatible key for our own models and the market; each request is routed to the cheapest offer that meets its `routing` criteria. The `/v1/...` prefix is an alias of `/api/v1/...`. Docs: https://llm-broker.net/llms.txt'
title: LLM Broker Chat API
version: 1.0.0
servers:
- url: https://api.llm-broker.net
variables: {}
security: []
tags:
- name: Chat
paths:
/api/v1/chat/completions:
post:
callbacks: {}
deprecated: false
description: '`model` = our product or any market model id (`GET /api/v1/broker/models`): the cheapest eligible offer serves it. `routing` narrows by `category`, `level`/`min_score`, `sort`, `region`, `max_price`, `capabilities`. With `stream: true` the answer is an SSE stream of `chat.completion.chunk` events ending in `data: [DONE]`. A GET on this path answers 405 with `Allow: POST`.'
operationId: createChatCompletion
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionRequest'
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionResponse'
text/event-stream:
schema:
type: string
description: Completion (non-streaming) or an SSE stream (`text/event-stream`)
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: Invalid JSON, missing or invalid fields, invalid `routing`, unsupported capability
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: Missing or invalid API key
'402':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: Insufficient balance or key spend limit reached
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: Key not allowed for this model or endpoint
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: Unknown endpoint, or no offer for this model
'405':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: 'Wrong method (GET): `Allow: POST`'
'409':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: No offer matches the `routing` criteria
'413':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: Request too large
'415':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: Content-Type must be application/json
'429':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: '`rate_limit_exceeded` (requests per minute) or `concurrency_limit_exceeded` (too many parallel requests of this key); see `Retry-After`'
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: Internal error
'502':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: The serving offer failed or was rejected upstream
'503':
content:
application/json:
schema:
$ref: '#/components/schemas/BrokerError'
description: All matching offers are temporarily unavailable; retry
security:
- apiKeyAuth: []
summary: Chat completion (OpenAI-compatible) with model choice and routing
tags:
- Chat
/api/v1/messages:
post:
callbacks: {}
deprecated: false
description: 'Anthropic Messages API shape (`x-api-key` or `Authorization: Bearer`), served by the same routing. Errors use the Anthropic error envelope `{type: "error", error: {type, message}}`; 529-class overload answers 503 `overloaded_error` (retryable).'
operationId: createMessage
parameters: []
requestBody:
content:
application/json:
schema:
properties:
max_tokens:
type: integer
messages:
items:
type: object
type: array
model:
type: string
stream:
default: false
type: boolean
system:
oneOf:
- type: string
- items:
type: object
type: array
tools:
items:
type: object
type: array
required:
- model
- messages
- max_tokens
type: object
required: true
responses:
'200':
content:
application/json:
schema:
type: object
text/event-stream:
schema:
type: string
description: 'Message, or an SSE stream with `stream: true`'
'400':
content:
application/json:
schema:
properties:
error:
properties:
message:
type: string
type:
type: string
type: object
type:
enum:
- error
type: string
type: object
description: Invalid request
'401':
content:
application/json:
schema:
properties:
error:
properties:
message:
type: string
type:
type: string
type: object
type:
enum:
- error
type: string
type: object
description: Missing or invalid API key
'402':
content:
application/json:
schema:
properties:
error:
properties:
message:
type: string
type:
type: string
type: object
type:
enum:
- error
type: string
type: object
description: Insufficient balance
'429':
content:
application/json:
schema:
properties:
error:
properties:
message:
type: string
type:
type: string
type: object
type:
enum:
- error
type: string
type: object
description: Rate limit
'500':
content:
application/json:
schema:
properties:
error:
properties:
message:
type: string
type:
type: string
type: object
type:
enum:
- error
type: string
type: object
description: Internal error
'503':
content:
application/json:
schema:
properties:
error:
properties:
message:
type: string
type:
type: string
type: object
type:
enum:
- error
type: string
type: object
description: All matching offers temporarily unavailable (`overloaded_error`); retry
security:
- apiKeyAuth: []
summary: Native Anthropic Messages endpoint
tags:
- Chat
components:
schemas:
ChatCompletionRequest:
properties:
frequency_penalty:
type: number
max_completion_tokens:
description: Same as max_tokens
type: integer
max_tokens:
type: integer
messages:
items:
type: object
type: array
model:
description: Our products (james, elliot, taylor, james-direct) or any market model id from GET /api/v1/broker/models (vendor/model) — served by the cheapest eligible provider.
example: deepseek/deepseek-v4.1-flash
type: string
presence_penalty:
type: number
response_format:
description: '{"type": "json_object"} or {"type": "json_schema", "json_schema": …}'
type: object
routing:
$ref: '#/components/schemas/BrokerRouting'
seed:
type: integer
stop:
oneOf:
- type: string
- items:
type: string
type: array
stream:
default: false
type: boolean
temperature:
type: number
tool_choice:
oneOf:
- enum:
- auto
- none
- required
type: string
- type: object
tools:
items:
type: object
type: array
top_p:
type: number
required:
- model
- messages
title: ChatCompletionRequest
type: object
BrokerRouting:
description: Narrows which offer serves the request. Never loosens product guarantees. No matching offer → 409 no_matching_offer.
example:
category: coding
min_score: 0.8
region: eu
sort: value
properties:
capabilities:
description: Every chosen provider must support all of these
oneOf:
- enum:
- reasoning
- structured_output
- tools
- vision
type: string
- items:
enum:
- reasoning
- structured_output
- tools
- vision
type: string
type: array
category:
description: Use case for level, min_score and sort=score|value
enum:
- coding
- instruction_following
- math
- reasoning
type: string
family:
description: 'Model family: vendor (anthropic), name start (claude, qwen3) or id prefix (deepseek/deepseek-v4). New generations are included automatically.'
type: string
level:
description: Needs category. solid/strong/top = the threshold of that level; best = only the offer with the highest measured score in category (within all other filters). Not together with min_score. Also for taylor (overrides the key's level for this request).
enum:
- solid
- strong
- top
- best
type: string
max_price:
description: Customer price cap in CHF per 1M tokens (incl. our margin)
properties:
input:
type: number
output:
type: number
type: object
min_context:
description: Minimum context window (tokens)
minimum: 1
type: integer
min_score:
description: Only offers whose score in category (our own measurement) is at least this
maximum: 1
minimum: 0
type: number
region:
description: Execution location of the provider (eu includes ch)
oneOf:
- enum:
- ch
- eu
- us
- asia
- global
type: string
- items:
enum:
- ch
- eu
- us
- asia
- global
type: string
type: array
sort:
default: price
description: cheapest · best score per CHF · highest throughput · highest score
enum:
- price
- value
- speed
- score
type: string
title: BrokerRouting
type: object
BrokerError:
properties:
error:
properties:
code:
example: invalid_request
type: string
message:
type: string
param:
description: The offending field, if any
type:
- string
- 'null'
request_id:
description: Quote it when contacting support
type:
- string
- 'null'
type:
description: invalid_request_error | authentication_error | rate_limit_error | server_error …
example: invalid_request_error
type: string
required:
- message
- type
- code
type: object
required:
- error
title: BrokerError
type: object
ChatCompletionResponse:
properties:
broker:
description: Broker metadata of market-routed answers (never a provider name)
properties:
cost:
properties:
amount:
type: string
amount_chf:
type: string
currency:
type: string
type: object
receipt:
properties:
attempts:
type: integer
measured_at:
type: string
model:
type: string
request_id:
type: string
score:
type: object
substituted:
type: boolean
type: object
region:
type: string
routing:
description: Applied routing (`category`, `level`)
type: object
type: object
choices:
items:
properties:
finish_reason:
enum:
- stop
- length
- tool_calls
- content_filter
type: string
index:
type: integer
message:
properties:
content:
type:
- string
- 'null'
reasoning_content:
description: Reasoning trace, if the model produced one
type: string
role:
enum:
- assistant
type: string
tool_calls:
items:
type: object
type: array
type: object
type: object
type: array
created:
type: integer
id:
example: chatcmpl-…
type: string
model:
description: The model you requested
type: string
object:
enum:
- chat.completion
type: string
system_fingerprint:
type: string
usage:
properties:
completion_tokens:
type: integer
completion_tokens_details:
properties:
reasoning_tokens:
type: integer
type: object
prompt_tokens:
type: integer
prompt_tokens_details:
properties:
cached_tokens:
type: integer
type: object
total_tokens:
type: integer
type: object
required:
- id
- object
- choices
title: ChatCompletionResponse
type: object
securitySchemes:
apiKeyAuth:
description: 'API key as Bearer token: customer keys `ast_sk_…` (account page or POST /api/v1/broker/accounts); internal/CLI keys `acore_…` (legacy `mgpt_…` still accepted)'
in: header
name: Authorization
type: apiKey
bearerAuth:
bearerFormat: JWT
description: JWT access token obtained via POST /auth/login
scheme: bearer
type: http