llm
The model gateway. One interface to AI models from Anthropic, OpenAI, Google Gemini and OpenRouter. Each call is metered and billed to the workspace, or made with the workspace's own key for that vendor.
GET / v1/ llm/ models
The AI models the hub offers, with their prices
Lists every AI model the hub can call, grouped by vendor. Each model carries its vendor's list price per million tokens and the price the hub charges for it.
The charged price is the list price plus the hub's markup when this hub takes payments. It is the list price when it does not. A call made with a workspace's own key for that vendor is not charged for the model.
served says whether this hub holds its own key for the vendor. A vendor the hub does not serve still works with a workspace's own key. Every price names the page it was read from and the date it was read.
Responses
| Status | Description | Body |
|---|---|---|
200 | The catalogue. | LlmCatalogue |
401 | Missing or invalid credentials. | Problem |
POST / v1/ llm/ messages
One AI model call for a MouseMouse agent
Sends one turn of an agent's conversation to a catalogue model and returns the model's answer. This serves MouseMouse's own agents only: the desktop app, the CLI and the hub's web agent. It is not a general model API, and the terms of use say so.
A request names its client in X-MouseMouse-Client and carries the agent's tool definitions. A request without both is 403 (llm.internal_only). Calls are limited per credential per minute.
Messages use MouseMouse's message format: text, images, tool calls and tool results as content blocks. The hub rebuilds every block from the fields the format documents, and refuses any other field with 422. Images are base64 PNG, JPEG, GIF or WebP only, at most 5 MiB and 8000 pixels a side. No URL or file reference is passed to a vendor, and the hub sets its own prompt caching. The hub translates the blocks for the model's vendor and translates the answer back. With stream: true the answer is server-sent events: message_start, then content_block_start, content_block_delta and content_block_stop for each block, then message_stop carrying the whole message and its cost, or error.
Every call is billed to a workspace, yours by default. With the workspace's own key for the vendor the model costs nothing here. Without one, the hub's key answers and the call counts toward the plan. Before the call its most possible cost is held. After it the cost is settled on the vendor's reported usage. The hold counts each image by the vendor's own rule, text at one token per byte, and the full max_tokens. A call the vendor bills past its hold is charged in full. Until that excess fits the workspace's balance, the credential's next call is 402 (llm.overshoot_unsettled). A usage field the hub cannot price bills the whole hold. 402 also means there is no key the hub may use, or the workspace's limit or the key's cap would be passed. A vendor that keeps refusing or failing after the retries is 502 or 503, naming the vendor.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
X-MouseMouse-Client | header | string | The MouseMouse client making the call and its version, such as |
Request body
| Field | Type | Description |
|---|---|---|
model | string | A catalogue id, such as |
system | string | |
messages | array of object | The conversation, oldest first. Each item is |
tools | array of LlmTool | |
max_tokens | integer | null | The most output tokens. Capped at the model's own limit. |
stream | boolean | |
owner | Handle | null | The workspace the call is billed to: your own (the default) or an organization you belong to. |
Responses
| Status | Description | Body |
|---|---|---|
200 | The model's answer. With | LlmMessage |
401 | Missing or invalid credentials. | Problem |
402 | No key the hub may use for this vendor, or the call would pass a limit: the workspace's own key's monthly cap, or the workspace's balance. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
422 | Request failed validation. | Problem |
502 | The model's vendor failed the call after the hub's retries, or did not answer in time. The detail names the vendor. | Problem |
503 | A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace. | Problem |
504 | The model's vendor failed the call after the hub's retries, or did not answer in time. The detail names the vendor. | Problem |
Schemas (9)
The schemas these operations reach before any other tag’s do. A type that links elsewhere is rendered on that tag’s page.
LlmCatalogue
| Field | Type | Description |
|---|---|---|
markup_pct | number | The percentage the hub adds to a vendor's list price. It applies only where |
charged | boolean | True when this hub takes payments, so |
default_model | string | null | The catalogue id the hub's agent starts on. |
vendors | array of LlmVendor |
LlmMessageCreate
| Field | Type | Description |
|---|---|---|
model | string | A catalogue id, such as |
system | string | |
messages | array of object | The conversation, oldest first. Each item is |
tools | array of LlmTool | |
max_tokens | integer | null | The most output tokens. Capped at the model's own limit. |
stream | boolean | |
owner | Handle | null | The workspace the call is billed to: your own (the default) or an organization you belong to. |
LlmMessage
| Field | Type | Description |
|---|---|---|
id | string | The call's id, |
model | string | |
vendor | LlmVendorId | |
vendor_model | string | null | The model the vendor reports it ran. |
content | array of object | The answer's blocks, in MouseMouse's message format. |
stop_reason | string | |
usage | LlmUsage | |
cost | LlmCost |
LlmVendor
| Field | Type | Description |
|---|---|---|
id | LlmVendorId | |
name | string | |
served | boolean | Whether this hub holds its own key for the vendor. |
keys_url | string | null | Where a person makes a key for this vendor. |
terms_url | string | null | The vendor's commercial terms. |
models | array of LlmModel |
LlmTool
| Field | Type | Description |
|---|---|---|
name | string | |
description | string | |
input_schema | object | The tool's arguments, as a JSON Schema object. |
LlmUsage
| Field | Type | Description |
|---|---|---|
input_tokens | integer | Input tokens read at the full price. |
output_tokens | integer | Output tokens, the model's reasoning included. |
cache_read_tokens | integer | |
cache_write_tokens | integer |
LlmCost
| Field | Type | Description |
|---|---|---|
list_usd | number | The call at the vendor's list price. |
charged_usd | number | What the workspace was charged. Zero on its own key. |
reserved_usd | number | What was held before the call. |
billed_to | string |
|
markup_pct | number |
LlmModel
| Field | Type | Description |
|---|---|---|
id | string | The catalogue's id, the vendor and the vendor's model id joined by a slash. Pass it as |
vendor | LlmVendorId | |
model | string | The model id exactly as the vendor names it. |
name | string | The model's display name. |
context_window | integer | The most tokens one call may read, input and output together. |
max_output_tokens | integer | null | |
tools | boolean | Whether the model calls tools. |
vision | boolean | Whether the model reads images. |
caching | string | How the vendor caches a repeated prompt. |
list_price | LlmPrice | |
price | LlmPrice | |
source_url | string | The vendor's page the list price was read from. |
read_on | string (date) | When the list price was read. |
served | boolean | Whether this hub holds its own key for the model's vendor. |
recommended | boolean | The model the hub's agent starts on. |
note | string | null | Why the hub offers this model, in one line. |
LlmPrice
US dollars per million tokens. A null field means the vendor has no such price for the model.
| Field | Type | Description |
|---|---|---|
input | number | |
output | number | |
cache_read | number | null | A cached input token, when the vendor caches. |
cache_write | number | null | Writing an input token to the cache, when the vendor bills it apart. |