provider-antigravity
v0.3.0POC llm-router provider `antigravity` that drives the Antigravity CLI (`agy acp`, Agent Client Protocol) on the host, reusing agy's own sign-in; the caller's functions reach the model as native tools.
Install
iii call compose::add worker=provider-antigravity@0.3.0Run in your project with the iii engine running. Exact versions are immutable and digest-pinned.
Full markdown
/registry/workers/provider-antigravity.md?version=0.3.0. Paste it into an LLM prompt or pipe it through curl from a worker.Install
iii call compose::add worker=provider-antigravity@0.3.0Dependencies
Readme
provider-antigravity (POC)
An llm-router provider, antigravity, that answers chat turns by driving the
Antigravity CLI (agy) over the
Agent Client Protocol (agy acp), reusing
agy's own sign-in. Its models show up in the console's model picker like any
API-key provider. (This worker was formerly provider-acp.)
This is the client side of ACP: iii drives agy. The acp worker is the server
side: an editor drives iii.
Setup
Do these on the machine where the worker runs (the host, not the computer you open the ADE from).
Install the Antigravity CLI (macOS and Linux):
curl -fsSL https://antigravity.google/cli/install.sh | bash agy --versionThe installer puts agy in
~/.local/bin/agy, where the worker finds it.agy installsets upPATHand the shell afterwards. Installed elsewhere: set the agy path in Settings > Antigravity, orAGY_BIN. Install docs.Sign in with your Google account, in a terminal:
agy acp --loginOver SSH (no browser on that machine), it prints a URL: open it in your own browser, sign in, and paste the code it gives you back into the terminal. The credentials go to the OS keyring. To sign out, run
/logoutinsideagy. Sign-in docs.Instead of an account:
- Gemini API key: set
"modelProvider": "gemini"in~/.gemini/antigravity-cli/settings.jsonand exportGEMINI_API_KEYin the worker's environment, then restart the worker. The key alone does nothing. - Application Default Credentials:
gcloud auth application-default login --project <PROJECT>, thenAGY_ADC_AUTH=truefor the worker (optionallyGOOGLE_CLOUD_QUOTA_PROJECT,GOOGLE_CLOUD_LOCATION).
- Gemini API key: set
Add the worker to the stack (see Run).
The ADE guides the same steps: Settings > Antigravity and Manage models > Antigravity (CLI) > Configure show a checklist (installed, signed in, models available) for the worker's host, with the commands to copy and a Check again button.
How it works
Catalog.
agy modelslists one id per model and effort (gemini-4-neon-high). The provider folds them into one model per family, as agy's own switcher does, and publishes them asantigravity/<family>withreasoning_efforts. The console's effort picker then works:- the turn's
thinking_levelselects the agy id<family>-<effort>, sent withsession/set_model; - no level, or a level the family lacks, falls back to
high.
antigravity/defaultkeeps agy's own configured model. Exact agy ids (antigravity/gemini-4-neon-low) still work. A turn that finds no catalog for the current binary lists the models first; if that listing fails, a family id fails the turn with the listing error.- the turn's
Turns. Each router call starts
agy acpin a fresh, empty temp directory and runs one ACP session:initialize;session/new, with the system prompt in_meta.antigravity.systemPrompt.append;session/set_model;- one
session/promptcarrying the conversation, flattened into one user message. A line of the caller's text that could pass for a role, call, result, image or file marker gets a\ahead of it; other lines stay as written. Names and ids inside a marker lose their line breaks.
agent_message_chunkupdates stream as router text,agent_thought_chunkupdates as thinking, and the prompt'susagebecomes the turn's usage.Function calling is native. The caller's functions are declared as tools of a stub MCP server named
iii, so the model calls them with real structured arguments. agy launches the stub as this same binary,provider-antigravity mcp-stub <tools.json>, with the tool list written to the turn's workspace. Bus ids are encoded asengine__workers__list; ids that encode alike get_2,_3. The stub never runs anything.- A
.agents/hooks.jsonPreToolUsehook in the workspace denies every tool call before it runs. - Each blocked call to an
iiitool becomes a routerfunction_call, with agy'stoolSummarystripped unless the function declares it. - 300 ms after the last call of a batch, the client sends
session/cancel, so the model never spends a step reacting to the block.
The turn then ends with
stop_reason: function_call. The caller (the harness, with its policy, approvals, transcript and traces) runs the calls and sends the results in the next turn's history.- A
agy's own tools stay blocked. The hook blocks them too. Any
session/request_permissionis refused, as a second layer. Attempts show up aswarningson the message.Environment. agy gets an allowlisted environment (see Run), so no
III_*variables reach it.Errors.
Failure Router error_kindQuota reached permanent429 or rate limit rate_limitedAuth failure auth_expiredagy dies before answering transient, retried by the routerAny other error agy answers with permanentThe text is written for the chat user. A missing agy says the Antigravity CLI is not installed on
<host>, with the install command and the agy path setting. An auth failure says it is not signed in on<host>, with<agy path> acp --login. agy's own message follows as the detail.stopReason: max_tokensends the turn withstop_reason: length.Abort. The router's
abort(keyed byresolution_key), a closed channel (seen at the next frame or keep-alive ping, at most 25s) or a worker shutdown kills agy's process group: SIGTERM first, then SIGKILL after 3s.Images. Each image block, including those inside function results, stays as an
[image N]marker in the flattened text. The image itself goes after the conversation as an ACP image block, behind a matching[image N]text block. The catalog setssupports_visionon every model except agy's text-onlygpt-oss, which drops images without an error.Context windows. These are the sizes agy reports in ACP
usage_update: 1,048,576 tokens for Gemini, 1,000,000 for Claude and 131,072 forgpt-oss.agy modelsdoes not list them, so the worker sets them by family name, and an unknown family gets the smallest.input_limitsubtracts the 64k output budget and 20k for agy's own system prompt and tool schemas, which measured 10.7k to 19k tokens on a one-word prompt.Unsupported request fields.
response_formatis not passed to agy.Cost. Every router call is a fresh agy process and session given the full flattened history. Each round trip of a tool loop therefore pays agy's start-up (about 2s for
session/new) before the model runs.
Run
Requires an installed, signed-in agy (Setup) on the same machine.
Without agy the worker still starts and registers its functions; turns then
fail with the install instructions, and the setup screen shows step 1 as not
done.
cargo run --release -- --url ws://127.0.0.1:49134iii.worker.yaml gives a supervisor the same thing: cargo build --release,
then ./target/release/provider-antigravity. Stop it with SIGINT or SIGTERM:
it aborts the turns in flight, waits up to 5s for them to report, and exits
within 8s.
Build
cargo build --release
cargo fmt --all -- --check
cargo clippy --locked --all-targets --all-features -- -D warnings
cargo test --locked --all-featuresThe release binary is the whole artifact: the worker, the MCP stub
(mcp-stub subcommand) and the ADE screen (assets/, embedded at build time).
Published builds cover macOS and Linux only, where agy runs.
--url sets the engine URL. Without it: III_URL, then III_ENGINE_URL,
then ws://127.0.0.1:49134.
| Env var | Purpose |
|---|---|
AGY_BIN |
agy binary, used when the saved agy_bin setting is empty. Default: ~/.local/bin/agy, then agy on PATH |
III_CONFIG_NAME |
id of the configuration entry. Compose sets it (<namespace>-provider-antigravity); default provider-antigravity |
III_URL |
engine URL when --url is not given. Compose sets it |
III_ENGINE_URL |
engine URL when neither --url nor III_URL is given |
RUST_LOG |
log filter. Default info |
agy runs with only these variables from the worker's environment:
| Passed to agy | Why |
|---|---|
HOME, PATH, USER, LOGNAME, SHELL, TERM, TMPDIR, LANG, LC_ALL, LC_CTYPE, XDG_CONFIG_HOME, XDG_CACHE_HOME, XDG_DATA_HOME, XDG_RUNTIME_DIR |
Home, locale, temp |
DBUS_SESSION_BUS_ADDRESS |
The keyring on Linux (Secret Service over D-Bus), where agy keeps its sign-in |
GEMINI_API_KEY, GOOGLE_GEMINI_BASE_URL |
Gemini API key sign-in |
AGY_ADC_AUTH, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION, GOOGLE_CLOUD_QUOTA_PROJECT, GOOGLE_APPLICATION_CREDENTIALS |
Application Default Credentials sign-in |
The worker must run on the host (path:// in compose, no base_image) so it
can reach agy and its sign-in (the keyring and ~/.gemini).
Configuration
The worker creates a configuration entry named Antigravity, with
metadata.ui_form: provider-antigravity, through configuration::ensure (a
stored value is kept). It holds one setting:
| Key | Default | Purpose |
|---|---|---|
agy_bin |
"" |
Absolute path of the agy binary. Empty: AGY_BIN, then ~/.local/bin/agy, then agy on PATH. A non-empty value wins over AGY_BIN. |
A save applies with no restart. The worker observes configuration::on-updated
for its entry, re-reads the value, and re-lists the models with the new binary.
The binary is resolved on every turn and listing. If the configuration worker
does not answer at start, the worker runs on AGY_BIN and the defaults and
retries in the background (1 s, doubling to 30 s) until it answers, then applies
the saved value with no restart.
The worker injects one ADE stylesheet and one script through
iii-console-ui (provider-antigravity::ui-content behind the
ade::ui::asset observers). Both are hand-written files in assets/,
embedded in the binary, so there is no frontend build. The script registers
two forms, both led by the same setup checklist for the worker's host:
- Install the Antigravity CLI: done when agy runs (path, where it came from, version). Otherwise the install command, with a Copy button.
- Sign in: done when agy has proved it is signed in. Otherwise
<agy path> acp --login, the SSH flow, and the API key and ADC alternatives. Waits for step 1. - Models available: done when the models are listed and registered with llm-router. Otherwise the listing error or the last turn error.
- Settings > Antigravity: the checklist, then the optional
agy_binfield (Advanced) and the model list. The ADE owns the draft, validation and Save. - Manage models > Antigravity (CLI) > Configure: the same checklist, read-only, with a link to the Settings entry. It replaces the router's generic API endpoint form.
The screen never runs a command or signs in for you: it shows the commands to run in a terminal on the worker's host, then Check again re-lists the models. Copy needs a secure origin; over plain http the command stays selectable.
Two bus functions back the screen:
| Function | Returns |
|---|---|
provider::antigravity::status |
host (the worker's hostname), the binary (path, source, agy --version, error), signed_in, sign-in hints, model count, listing error, registration, last turn error, and the sign-in command. It runs only agy --version and never returns a token or key value. signed_in comes from the current binary's last model listing or a newer turn's auth failure: null when unknown. |
provider::antigravity::refresh_models |
{count}, after re-listing the models and re-registering with llm-router. A failed listing keeps the previous models and shows in status. Denied to agents. |
The sign-in hints in status.credentials follow the Antigravity docs. They only
describe how agy may be signed in; signed_in is the truth.
| Hint | True when |
|---|---|
token_file |
~/.gemini/antigravity-cli/antigravity-oauth-token exists (never read) |
api_key |
settings.json there has "modelProvider": "gemini" (only that key is read) and GEMINI_API_KEY is set for the worker |
adc |
AGY_ADC_AUTH=true for the worker |
Security
- The ADE on
0.0.0.0has no auth: anyone who reaches it can open these screens and the rest of the console. - The agy path setting is a code-execution route: whoever can save it picks the binary the worker runs on every turn and listing. Keep the ADE off untrusted networks.
Code
src/main.rs: the CLI, boot order and shutdown.src/acp.rs: the ACP transport (one turn against a freshagy acp).src/mcp_stub.rs: the stub MCP server that declares the caller's functions.src/antigravity.rs: agy specifics (binary, environment, models, efforts, errors, probe, session cleanup).src/prompt.rs: the conversation flattened into one ACP prompt, and the host instructions.src/frames.rs: router stream frames.src/provider.rs: llm-router plumbing,statusandrefresh_models.src/configuration.rs,src/ui.rs,assets/: the setting and the ADE screens.tests/fixtures/:fake-agy.mjsandfake-agy-signed-out.mjs, test doubles of agy, andrender-page.mjs, which renders the served page fortests/ui.rs(all need Node).
API reference (JSON)
{
"functions": [
{
"description": "Internal: reload provider-antigravity settings when they change.",
"metadata": {
"internal": true
},
"name": "provider-antigravity::on-config-change",
"request_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "What `<worker>::on-config-change` receives: the `Observed` envelope of a `configuration::on-updated` call (captured as output). Advisory only: handlers ignore it and re-fetch the authoritative value, so a direct call can never inject config.",
"properties": {
"id": {
"default": null,
"description": "Configuration id that changed.",
"type": [
"string",
"null"
]
}
},
"title": "OnConfigChangeEvent",
"type": "object"
},
"response_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Ack returned by the internal `<worker>::on-config-change` handler.",
"properties": {
"ok": {
"type": "boolean"
}
},
"required": [
"ok"
],
"title": "OnConfigChangeResponse",
"type": "object"
}
},
{
"description": "Serve the provider-antigravity worker's injected console UI assets (the target of its ade::ui::asset observers; the console calls it through each asset's observer with {path}).",
"metadata": {
"internal": true
},
"name": "provider-antigravity::ui-content",
"request_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Input of the content function: the console asks for one asset by path.",
"properties": {
"path": {
"description": "The asset path from the observer's args (e.g. `state/page.js`).",
"type": "string"
}
},
"required": [
"path"
],
"title": "UiContentInput",
"type": "object"
},
"response_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Output of the content function.",
"properties": {
"content": {
"description": "The asset source, verbatim.",
"type": "string"
},
"content_type": {
"description": "MIME type the console should serve the asset with.",
"type": "string"
}
},
"required": [
"content",
"content_type"
],
"title": "UiContentResult",
"type": "object"
}
},
{
"description": "Cancel an in-flight Antigravity (CLI) turn.",
"metadata": {
"internal": true
},
"name": "provider::antigravity::abort",
"request_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Input of a provider's `provider::<id>::abort`: actively cancel the in-flight upstream stream for `request_id` (the router's `request_id`, delivered to the provider as `resolution_key`) so billed generation stops immediately instead of waiting for the provider to notice the closed channel on its next write.",
"properties": {
"request_id": {
"type": "string"
}
},
"required": [
"request_id"
],
"title": "ProviderAbortRequest",
"type": "object"
},
"response_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Output of `provider::<id>::abort`. `aborted: false` means the request was unknown — already finished, never started, or aborted before (idempotent).",
"properties": {
"aborted": {
"type": "boolean"
}
},
"required": [
"aborted"
],
"title": "ProviderAbortResponse",
"type": "object"
}
},
{
"description": "Re-register Antigravity (CLI) after an llm-router restart.",
"metadata": {
"internal": true
},
"name": "provider::antigravity::on_router_ready",
"request_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "The router's ready event: what `router::on-ready` returns, and what a provider's `provider::<id>::on_router_ready` receives. Currently `{}`; unknown fields are ignored.",
"title": "RouterReadyEvent",
"type": "object"
},
"response_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Ack returned by a provider's `provider::<id>::on_router_ready`.",
"properties": {
"ok": {
"type": "boolean"
}
},
"required": [
"ok"
],
"title": "ProviderReadyAck",
"type": "object"
}
},
{
"description": "Re-list Antigravity (CLI) models and re-declare them to llm-router.",
"metadata": {},
"name": "provider::antigravity::refresh_models",
"request_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Input of a provider's `provider::<id>::refresh_models` — takes no arguments. A struct (not `Value`) keeps the request schema concrete; unknown fields (e.g. the engine-injected `_caller_worker_id`) are ignored.",
"title": "RefreshModelsRequest",
"type": "object"
},
"response_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"count": {
"description": "The models now registered, `default` included.",
"format": "uint",
"minimum": 0,
"type": "integer"
}
},
"required": [
"count"
],
"title": "RefreshResponse",
"type": "object"
}
},
{
"description": "Antigravity (CLI): host, binary, version, sign-in state, model count and last error.",
"metadata": {},
"name": "provider::antigravity::status",
"request_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "StatusRequest",
"type": "object"
},
"response_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"BinaryProbe": {
"description": "What the setup screen shows about agy. Presence flags only, never secrets.",
"properties": {
"error": {
"type": [
"string",
"null"
]
},
"path": {
"type": "string"
},
"source": {
"$ref": "#/definitions/BinarySource"
},
"version": {
"type": [
"string",
"null"
]
}
},
"required": [
"path",
"source"
],
"type": "object"
},
"BinarySource": {
"description": "Where the agy binary came from.",
"enum": [
"setting",
"env",
"home",
"path"
],
"type": "string"
},
"Credentials": {
"description": "How agy may be signed in, as the Antigravity docs describe it. Hints only: the keyring is not looked at, and `signed_in` in the status comes from what agy actually did.",
"properties": {
"adc": {
"description": "AGY_ADC_AUTH=true: Application Default Credentials.",
"type": "boolean"
},
"api_key": {
"description": "settings.json has `\"modelProvider\": \"gemini\"` and GEMINI_API_KEY is set for the worker.",
"type": "boolean"
},
"token_file": {
"description": "~/.gemini/antigravity-cli/antigravity-oauth-token exists (never read).",
"type": "boolean"
}
},
"required": [
"adc",
"api_key",
"token_file"
],
"type": "object"
},
"ErrorKind": {
"enum": [
"auth_expired",
"rate_limited",
"context_overflow",
"transient",
"permanent"
],
"type": "string"
},
"Login": {
"description": "The interactive sign-in the user runs in a terminal.",
"properties": {
"command": {
"type": "string"
},
"cwd": {
"type": "string"
}
},
"required": [
"command",
"cwd"
],
"type": "object"
},
"ModelsStatus": {
"properties": {
"count": {
"description": "The listed models plus `default`.",
"format": "uint",
"minimum": 0,
"type": "integer"
},
"error": {
"type": [
"string",
"null"
]
},
"error_kind": {
"anyOf": [
{
"$ref": "#/definitions/ErrorKind"
},
{
"type": "null"
}
]
},
"listed_at": {
"format": "int64",
"type": [
"integer",
"null"
]
}
},
"required": [
"count"
],
"type": "object"
},
"TurnError": {
"properties": {
"at": {
"format": "int64",
"type": "integer"
},
"kind": {
"anyOf": [
{
"$ref": "#/definitions/ErrorKind"
},
{
"type": "null"
}
]
},
"message": {
"type": [
"string",
"null"
]
}
},
"required": [
"at"
],
"type": "object"
}
},
"description": "`provider::antigravity::status`: presence flags, never a token or key.",
"properties": {
"binary": {
"$ref": "#/definitions/BinaryProbe"
},
"credentials": {
"$ref": "#/definitions/Credentials"
},
"host": {
"description": "The machine agy must be installed and signed in on; the ADE may be open elsewhere.",
"type": "string"
},
"last_turn_error": {
"anyOf": [
{
"$ref": "#/definitions/TurnError"
},
{
"type": "null"
}
]
},
"login": {
"$ref": "#/definitions/Login"
},
"models": {
"$ref": "#/definitions/ModelsStatus"
},
"registered": {
"type": "boolean"
},
"signed_in": {
"description": "From the current binary's last model listing or a newer turn's auth failure: `null` when unknown.",
"type": [
"boolean",
"null"
]
}
},
"required": [
"binary",
"credentials",
"host",
"login",
"models",
"registered"
],
"title": "Status",
"type": "object"
}
},
{
"description": "Stream a Antigravity (CLI) turn through the local agy over ACP.",
"metadata": {
"internal": true
},
"name": "provider::antigravity::stream",
"request_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"AgentFunction": {
"description": "Function invocation schema — what a provider sees as a `tools` array entry (README § Function invocation schema; adapter boundary). These describe iii functions exposed to the model, not provider-native tools.",
"properties": {
"description": {
"type": "string"
},
"execution_mode": {
"type": [
"string",
"null"
]
},
"label": {
"type": [
"string",
"null"
]
},
"name": {
"type": "string"
},
"parameters": true
},
"required": [
"description",
"name",
"parameters"
],
"type": "object"
},
"AgentMessage": {
"anyOf": [
{
"$ref": "#/definitions/AssistantMessage"
},
{
"$ref": "#/definitions/FunctionResultMessage"
},
{
"$ref": "#/definitions/CustomMessage"
},
{
"$ref": "#/definitions/UserMessage"
}
],
"description": "The canonical transcript message union. Untagged: the single-variant role tags disambiguate deserialization."
},
"AssistantMessage": {
"properties": {
"content": {
"items": {
"$ref": "#/definitions/ContentBlock"
},
"type": "array"
},
"error_details": {
"anyOf": [
{
"$ref": "#/definitions/ErrorDetails"
},
{
"type": "null"
}
],
"description": "What `error_kind` alone does not say, such as an account's usage limit. Omitted when absent; readers that don't know it ignore it."
},
"error_kind": {
"anyOf": [
{
"$ref": "#/definitions/ErrorKind"
},
{
"type": "null"
}
]
},
"error_message": {
"type": [
"string",
"null"
]
},
"model": {
"type": "string"
},
"native_stop_reason": {
"type": [
"string",
"null"
]
},
"provider": {
"type": "string"
},
"role": {
"$ref": "#/definitions/AssistantRoleTag"
},
"stop_reason": {
"$ref": "#/definitions/StopReason"
},
"timestamp": {
"format": "int64",
"type": "integer"
},
"usage": {
"anyOf": [
{
"$ref": "#/definitions/Usage"
},
{
"type": "null"
}
]
},
"warnings": {
"items": {
"type": "string"
},
"type": [
"array",
"null"
]
}
},
"required": [
"content",
"model",
"provider",
"role",
"stop_reason",
"timestamp"
],
"type": "object"
},
"AssistantRoleTag": {
"enum": [
"assistant"
],
"type": "string"
},
"ChannelDirection": {
"description": "Which end of a pipe a [`StreamChannelRef`] opens: `read` is received as an [`InputStream`](crate::InputStream), `write` as an [`OutputStream`](crate::OutputStream).",
"enum": [
"read",
"write"
],
"type": "string"
},
"ContentBlock": {
"description": "Content blocks — the atomic units of message content (README § Content blocks).",
"oneOf": [
{
"properties": {
"text": {
"type": "string"
},
"type": {
"enum": [
"text"
],
"type": "string"
}
},
"required": [
"text",
"type"
],
"type": "object"
},
{
"properties": {
"attachment_id": {
"description": "Optional link to the stored original in the session-manager attachment store. Transcript bookkeeping for lazy readers only: the harness clears it before `router::chat`, and no provider mapping reads it. Tolerated here so a block that still carries it deserializes instead of failing the request; omitted on the wire when absent.",
"type": [
"string",
"null"
]
},
"data": {
"type": "string"
},
"mime": {
"type": "string"
},
"type": {
"enum": [
"image"
],
"type": "string"
}
},
"required": [
"data",
"mime",
"type"
],
"type": "object"
},
{
"description": "Reference to an original upload in the session-manager attachment store. A REFERENCE ONLY (never inline bytes); the harness strips it before `router::chat`. Tolerated here so a stray block deserializes instead of failing the request; every counter/mapping emits nothing for it.",
"properties": {
"attachment_id": {
"type": "string"
},
"mime": {
"type": "string"
},
"name": {
"type": "string"
},
"size": {
"format": "uint64",
"minimum": 0,
"type": "integer"
},
"type": {
"enum": [
"file"
],
"type": "string"
}
},
"required": [
"attachment_id",
"mime",
"name",
"size",
"type"
],
"type": "object"
},
{
"properties": {
"signature": {
"type": [
"string",
"null"
]
},
"text": {
"type": "string"
},
"type": {
"enum": [
"thinking"
],
"type": "string"
}
},
"required": [
"text",
"type"
],
"type": "object"
},
{
"description": "Opaque redacted thinking payload — replayed verbatim on the Anthropic wire.",
"properties": {
"data": {
"type": "string"
},
"type": {
"enum": [
"redacted_thinking"
],
"type": "string"
}
},
"required": [
"data",
"type"
],
"type": "object"
},
{
"properties": {
"arguments": true,
"function_id": {
"type": "string"
},
"id": {
"type": "string"
},
"type": {
"enum": [
"function_call"
],
"type": "string"
}
},
"required": [
"arguments",
"function_id",
"id",
"type"
],
"type": "object"
},
{
"properties": {
"content": {
"items": {
"$ref": "#/definitions/ContentBlock"
},
"type": "array"
},
"function_call_id": {
"type": "string"
},
"is_error": {
"type": [
"boolean",
"null"
]
},
"type": {
"enum": [
"function_result"
],
"type": "string"
}
},
"required": [
"content",
"function_call_id",
"type"
],
"type": "object"
}
]
},
"CustomMessage": {
"properties": {
"content": {
"items": {
"$ref": "#/definitions/ContentBlock"
},
"type": "array"
},
"custom_type": {
"type": "string"
},
"details": true,
"display": {
"type": [
"string",
"null"
]
},
"role": {
"$ref": "#/definitions/CustomRoleTag"
},
"timestamp": {
"format": "int64",
"type": "integer"
}
},
"required": [
"content",
"custom_type",
"role",
"timestamp"
],
"type": "object"
},
"CustomRoleTag": {
"enum": [
"custom"
],
"type": "string"
},
"ErrorDetails": {
"description": "What an error's kind alone does not say. Optional on the assistant message and on the router's `ErrorShape`, and serialized only when present, so every reader that does not know it ignores it: `ErrorKind` itself keeps its five values, because its copies elsewhere deserialize it strictly.",
"properties": {
"resets_at_ms": {
"description": "When that limit resets, in milliseconds since the epoch.",
"format": "uint64",
"minimum": 0,
"type": [
"integer",
"null"
]
},
"usage_limit": {
"default": false,
"description": "The account's usage limit is reached: a `rate_limited` that waiting a moment does not fix, so the router never retries it.",
"type": "boolean"
},
"window": {
"anyOf": [
{
"$ref": "#/definitions/UsageWindow"
},
{
"type": "null"
}
],
"description": "Which limit was reached, when the provider said so. An unknown value reads as absent."
}
},
"type": "object"
},
"ErrorKind": {
"enum": [
"auth_expired",
"rate_limited",
"context_overflow",
"transient",
"permanent"
],
"type": "string"
},
"FunctionResultMessage": {
"properties": {
"content": {
"items": {
"$ref": "#/definitions/ContentBlock"
},
"type": "array"
},
"details": true,
"function_call_id": {
"type": "string"
},
"function_id": {
"type": "string"
},
"is_error": {
"type": "boolean"
},
"role": {
"$ref": "#/definitions/FunctionResultRoleTag"
},
"timestamp": {
"format": "int64",
"type": "integer"
}
},
"required": [
"content",
"details",
"function_call_id",
"function_id",
"is_error",
"role",
"timestamp"
],
"type": "object"
},
"FunctionResultRoleTag": {
"enum": [
"function_result"
],
"type": "string"
},
"Model": {
"description": "The capability record (README § Model descriptor).",
"properties": {
"context_window": {
"format": "uint64",
"minimum": 0,
"type": "integer"
},
"display_name": {
"type": [
"string",
"null"
]
},
"id": {
"type": "string"
},
"input_limit": {
"format": "uint64",
"minimum": 0,
"type": [
"integer",
"null"
]
},
"max_output_tokens": {
"format": "uint64",
"minimum": 0,
"type": "integer"
},
"pricing": {
"anyOf": [
{
"$ref": "#/definitions/Pricing"
},
{
"type": "null"
}
]
},
"provider": {
"type": "string"
},
"reasoning_efforts": {
"items": {
"$ref": "#/definitions/ReasoningEffort"
},
"type": [
"array",
"null"
]
},
"speech": {
"anyOf": [
{
"$ref": "#/definitions/SpeechModel"
},
{
"type": "null"
}
],
"description": "Set on speech models only; see [`SpeechModel`]."
},
"supports_cache": {
"type": [
"boolean",
"null"
]
},
"supports_structured_output": {
"type": [
"boolean",
"null"
]
},
"supports_thinking": {
"type": [
"boolean",
"null"
]
},
"supports_thinking_off": {
"description": "Whether `thinking_level: off` can switch the model's reasoning off. `Some(true)`: a native off switch exists. `Some(false)`: the model always reasons, or the provider has no switch. `None`: the provider does not know; consoles show the choice disabled.",
"type": [
"boolean",
"null"
]
},
"supports_tools": {
"type": [
"boolean",
"null"
]
},
"supports_vision": {
"type": [
"boolean",
"null"
]
},
"supports_xhigh": {
"type": [
"boolean",
"null"
]
},
"thinking_budgets": {
"additionalProperties": {
"format": "uint64",
"minimum": 0,
"type": "integer"
},
"type": [
"object",
"null"
]
}
},
"required": [
"context_window",
"id",
"max_output_tokens",
"provider"
],
"type": "object"
},
"Pricing": {
"properties": {
"cache_read": {
"format": "double",
"type": [
"number",
"null"
]
},
"cache_write": {
"format": "double",
"type": [
"number",
"null"
]
},
"input": {
"format": "double",
"type": [
"number",
"null"
]
},
"output": {
"format": "double",
"type": [
"number",
"null"
]
}
},
"type": "object"
},
"PromptCacheIntent": {
"description": "Why a request's stable prefix is shareable across sessions: `surface_digest` is the caller's content identity for the text before the boundary (`sha256:<hex>`). A routing/accounting hint only — never a provider cache handle, and never evidence of a cache hit.",
"properties": {
"surface_digest": {
"type": "string"
}
},
"required": [
"surface_digest"
],
"type": "object"
},
"PromptSection": {
"description": "One ordered system-prompt section. `cache_boundary` marks the end of a cumulative prefix worth its own provider cache entry (the frozen agent-profile surface). Adapters without a boundary concept read the sections joined with \"\\n\\n\", which must equal `system_prompt` when both forms are sent.",
"properties": {
"cache_boundary": {
"default": false,
"type": "boolean"
},
"text": {
"type": "string"
}
},
"required": [
"text"
],
"type": "object"
},
"ReasoningEffort": {
"description": "One provider-native reasoning effort advertised for a specific model.\n\nValues intentionally remain strings: provider catalogs can add efforts without requiring a router-wide enum release first.",
"properties": {
"description": {
"type": [
"string",
"null"
]
},
"effort": {
"type": "string"
}
},
"required": [
"effort"
],
"type": "object"
},
"ResponseFormat": {
"properties": {
"schema": true,
"type": {
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
},
"SpeechModality": {
"description": "What a speech model does. Chat models carry no `speech` block.",
"oneOf": [
{
"description": "Speech to text, served through `router::transcribe`.",
"enum": [
"stt"
],
"type": "string"
},
{
"description": "Text to speech, served through `router::speak`.",
"enum": [
"tts"
],
"type": "string"
}
]
},
"SpeechModel": {
"description": "Facts about a speech model. Present only on models served through `router::transcribe` / `router::speak`; such models report `context_window` and `max_output_tokens` as 0.",
"properties": {
"languages": {
"description": "BCP-47 tags of the languages the model handles; empty when the provider does not say.",
"items": {
"type": "string"
},
"type": "array"
},
"modality": {
"$ref": "#/definitions/SpeechModality"
},
"streaming": {
"default": false,
"description": "Realtime input (stt) or streamed audio output (tts) is available.",
"type": "boolean"
}
},
"required": [
"modality"
],
"type": "object"
},
"StopReason": {
"enum": [
"end",
"length",
"function_call",
"aborted",
"error"
],
"type": "string"
},
"StreamChannelRef": {
"description": "One end of an engine pipe as a payload carries it: `{ channel_id, access_key, direction }`. The JSON is the same in every SDK and release, so new and old SDKs read each other's refs.",
"properties": {
"access_key": {
"type": "string"
},
"channel_id": {
"type": "string"
},
"direction": {
"$ref": "#/definitions/ChannelDirection"
}
},
"required": [
"access_key",
"channel_id",
"direction"
],
"type": "object"
},
"ThinkingLevel": {
"description": "\"off\" asks the provider not to reason at all and is honoured only where the model advertises `Model::supports_thinking_off` (elsewhere the provider falls back to its own lowest setting, or omits the parameter, and warns). \"minimal\" requests the lowest reasoning effort and needs only `thinking` support; levels map to provider-native knobs via `Model::thinking_budgets`.",
"enum": [
"off",
"minimal",
"low",
"medium",
"high",
"xhigh"
],
"type": "string"
},
"Usage": {
"properties": {
"cache_read": {
"format": "uint64",
"minimum": 0,
"type": [
"integer",
"null"
]
},
"cache_write": {
"format": "uint64",
"minimum": 0,
"type": [
"integer",
"null"
]
},
"cost_usd": {
"format": "double",
"type": [
"number",
"null"
]
},
"input": {
"format": "uint64",
"minimum": 0,
"type": [
"integer",
"null"
]
},
"output": {
"format": "uint64",
"minimum": 0,
"type": [
"integer",
"null"
]
},
"reasoning": {
"format": "uint64",
"minimum": 0,
"type": [
"integer",
"null"
]
}
},
"type": "object"
},
"UsageWindow": {
"description": "The usage window an account's limit belongs to.",
"oneOf": [
{
"description": "The rolling five-hour window.",
"enum": [
"five_hour"
],
"type": "string"
},
{
"description": "The weekly window (any of the plan's seven-day limits).",
"enum": [
"week"
],
"type": "string"
}
]
},
"UserMessage": {
"properties": {
"content": {
"items": {
"$ref": "#/definitions/ContentBlock"
},
"type": "array"
},
"role": {
"$ref": "#/definitions/UserRoleTag"
},
"timestamp": {
"format": "int64",
"type": "integer"
}
},
"required": [
"content",
"role",
"timestamp"
],
"type": "object"
},
"UserRoleTag": {
"description": "Single-variant role tags: exact-match on deserialize, correct wire string on serialize, and they let `AgentMessage` be an untagged union.",
"enum": [
"user"
],
"type": "string"
}
},
"description": "Input of a provider worker's `provider::<id>::stream` iii function — what the router forwards per attempt. (No `PartialEq`: `iii_sdk::StreamChannelRef` doesn't implement it.)",
"properties": {
"cache_intent": {
"anyOf": [
{
"$ref": "#/definitions/PromptCacheIntent"
},
{
"type": "null"
}
]
},
"max_output_tokens": {
"format": "uint64",
"minimum": 0,
"type": [
"integer",
"null"
]
},
"messages": {
"items": {
"$ref": "#/definitions/AgentMessage"
},
"type": "array"
},
"model": {
"type": "string"
},
"model_meta": {
"anyOf": [
{
"$ref": "#/definitions/Model"
},
{
"type": "null"
}
]
},
"provider_options": true,
"resolution_key": {
"type": [
"string",
"null"
]
},
"response_format": {
"anyOf": [
{
"$ref": "#/definitions/ResponseFormat"
},
{
"type": "null"
}
]
},
"session_id": {
"description": "Stable conversation identity for provider cache affinity.",
"type": [
"string",
"null"
]
},
"system_prompt": {
"type": [
"string",
"null"
]
},
"system_sections": {
"description": "Ordered sections behind `system_prompt` (always forwarded alongside the flat string, which equals the sections joined with \"\\n\\n\").",
"items": {
"$ref": "#/definitions/PromptSection"
},
"type": [
"array",
"null"
]
},
"thinking_level": {
"anyOf": [
{
"$ref": "#/definitions/ThinkingLevel"
},
{
"type": "null"
}
]
},
"tools": {
"items": {
"$ref": "#/definitions/AgentFunction"
},
"type": [
"array",
"null"
]
},
"writer_ref": {
"$ref": "#/definitions/StreamChannelRef"
}
},
"required": [
"messages",
"model",
"writer_ref"
],
"title": "ProviderStreamInput",
"type": "object"
},
"response_schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Output of a provider's `provider::<id>::stream` (spec § stream contract): the function streams frames to `writer_ref` and returns this ack.",
"properties": {
"ok": {
"type": "boolean"
}
},
"required": [
"ok"
],
"title": "ProviderStreamOutput",
"type": "object"
}
}
]
}