provider::xai::abort
Cancel the in-flight upstream stream for a request_id (router::abort fan-out), stopping billed generation immediately.
- request_idstringrequired
- abortedbooleanrequired
xAI Chat Completions provider worker; implements provider::xai::stream and provider::xai::refresh_models behind llm-router.
iii call compose::add worker=provider-xaiRun in your project with the iii engine running. Exact versions are immutable and digest-pinned.
Cancel the in-flight upstream stream for a request_id (router::abort fan-out), stopping billed generation immediately.
Count prompt tokens for {model, system_prompt?, tools?, messages, response_format?} with Grok's tokenizer upstream plus xAI's measured prompt overhead; never runs the model and costs nothing.
Wire agent messages, the same shape `provider::xai::stream` accepts. Must be non-empty.
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.
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.
When that limit resets, in milliseconds since the epoch.
The account's usage limit is reached: a `rate_limited` that waiting a moment does not fix, so the router never retries it.
Which limit was reached, when the provider said so. An unknown value reads as absent.
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.
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.
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.
Single-variant role tags: exact-match on deserialize, correct wire string on serialize, and they let `AgentMessage` be an untagged union.
Model id the prompt targets; selects the tokenizer upstream.
The turn's structured-output request, when it has one; its schema is billed as prompt.
System prompt counted as its own framed wire row when present.
The turn's reasoning level; it maps to the `reasoning_effort` the stream sends, which changes the preamble xAI bills.
Function invocation schemas; each serialized schema counts toward the total.
Always `tokenizer`: a real vocabulary produced the count, but the upstream metered the text rather than the request.
Prompt tokens for the assembled request: Grok's tokenizer over the rendered text, xAI's measured overhead on top.
Internal: reload provider-xai configuration when it changes.
Internal: re-declares this provider and refreshes its catalog on every router::on-ready event.
Refresh the xAI catalog slice from GET /v1/models and reconcile it through the router; returns ok, retained model count and safe discovery outcome.
Safe discovery categories. No upstream message, team id or URL is retained.
Stream an xAI chat completion: resolve credentials, call the upstream Chat Completions API, and relay AssistantMessageEvent frames to writer_ref.
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.
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.
When that limit resets, in milliseconds since the epoch.
The account's usage limit is reached: a `rate_limited` that waiting a moment does not fix, so the router never retries it.
Which limit was reached, when the provider said so. An unknown value reads as absent.
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.
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.
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.
Single-variant role tags: exact-match on deserialize, correct wire string on serialize, and they let `AgentMessage` be an untagged union.
Set on speech models only; see [`SpeechModel`].
BCP-47 tags of the languages the model handles; empty when the provider does not say.
What a speech model does. Chat models carry no `speech` block.
Realtime input (stt) or streamed audio output (tts) is available.
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.
Stable conversation identity for provider cache affinity.
Ordered sections behind `system_prompt` (always forwarded alongside the flat string, which equals the sections joined with "\n\n").
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.
Which end of a pipe a [`StreamChannelRef`] opens: `read` is received as an [`InputStream`](crate::InputStream), `write` as an [`OutputStream`](crate::OutputStream).
Find workers, kits and executables, or jump to a page.