Skip to content

Capabilities ​

@anvia/grok combines OpenAI-compatible completion adapters with xAI-specific tools and media endpoints.

CapabilitySupport
Responses completion and streamingYes (api: 'responses')
Chat Completions and streamingYes
Local Anvia toolsYes
xAI provider toolsResponses only
Image generationYes
Batch text-to-speechYes
Batch transcriptionYes
Model listingYes
EmbeddingsNot implemented
Video, realtime voice, streaming speechNot implemented

Completion adapters ​

Every completion model accepts api: 'responses' | 'chat', defaulting to 'chat' (Chat Completions). The handle created with api: 'responses' delegates normalized Responses behavior to the OpenAI adapter and adds Grok provider-tool and source normalization. The api: 'chat' handle delegates Chat Completions behavior but does not accept provider-executed tools; select Responses explicitly (api: 'responses') when a workflow needs Grok provider tools.

Known Grok IDs expose context limits. Provider-specific request fields can pass through completion providerOptions.

Provider tools ​

Web search, X search, code interpreter, file search, and remote MCP return Anvia ProviderTool values. They are sent to xAI and never executed by Anvia's local tool runtime. Local tools and provider tools can coexist in one agent.

Images ​

The image adapter requests base64 by default and also accepts provider URL output when fetch is available. Width and height map to supported xAI ratios; unknown ratios become auto. The computed ratio is applied after providerOptions are spread, so it overrides an explicit providerOptions.aspect_ratio.

Speech ​

Text-to-speech calls /tts and accepts binary or JSON/base64 output. The current adapter rejects any speed other than 1 because xAI does not expose speed control through this path.

Transcription calls /stt with multipart audio and returns normalized text. Both operations require fetch and a usable API key.

Unsupported surfaces ​

The package does not expose image editing, video generation, realtime voice, streaming speech, file/collection management, batches, stored completions, compaction, or native telemetry APIs. Call a provider API directly when no Anvia contract exists.

Built for Anvia.