SPB Git

Repository Public

provider-capabilities.md 7.8 KB

# Provider capabilities — verified 2026-11-10

Everything below was read from the official xAI documentation and confirmed by a live call with the production key on 2026-11-10 (America/Toronto). Nothing here is copied from the brief's illustrative examples. Re-verify with pnpm tsx scripts/provider-probe.ts (lists live models and prices, no paid call).

Sources (retrieved 2026-11-10):

# Models available to this key (live listing)

Kind Model id Notes
LLM grok-4.7 500k context, $2.00 / $6.00 per 1M tokens in/out, reasoning_effort low…xhigh. Default LLM (see "Model choice" below).
LLM grok-4.3 1M context, $1.25 / $2.50 per 1M tokens, reasoning_effort none…xhigh
LLM grok-4.6, grok-4.5 500k context, $2.00 / $6.00 per 1M tokens
LLM grok-4.20-0309-(non-)reasoning, grok-4.20-multi-agent-0309, grok-build-0.1 available, unused
Image grok-imagine-image-2.0 Default. quality low/medium × resolution 1k/1.5k/2k = $0.04–$0.08 per image (API price table)
Image grok-imagine-image $0.02 per image
Video grok-imagine-video-1.5 Default for masters. T2V/I2V native 1080p, references (14 images, 3 voices), first/last/key frames
Video grok-imagine-video-1.5-lite Default for drafts. T2V/I2V, 1080p by upscaling 720p
Video grok-imagine-video T2V/I2V ≤ 720p, reference-to-video (7 images, 10 s), edit (source ≤ 8.7 s), extension (+2–10 s)
Speech POST /v1/tts 28 preset voices (live list), 20 documented languages incl. fr and en
Embeddings — GET /v1/embedding-models returns an empty list → CLIP uses a local, explainable lexical embedding

# Video (Grok Imagine)

Property Verified value
Submit POST /v1/videos/generations → { request_id } (asynchronous)
Poll GET /v1/videos/{request_id} → status pending/done/failed, progress, video.url, video.duration, video.respect_moderation, usage.cost_in_usd_ticks
Duration 1–15 s (default 8)
Resolution 480p (default), 720p, 1080p (not on grok-imagine-video)
Aspect ratio 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9, 5:2. For image-to-video the output always matches the input image; aspect_ratio is ignored
Audio Native generated audio on all three models; lip-synced speech on 1.5 / 1.5-lite
Output URL Temporary (vidgen.x.ai/...); must be downloaded promptly. storage_options can persist to xAI Files; output.upload_url can PUT to a presigned URL
Errors invalid_argument, permission_denied, failed_precondition, service_unavailable, internal_error in the polled body; auth / 429 as HTTP errors
Moderation A blocked request is still billed (pricing page, "Usage Guidelines Violation Fee")
Rate limit (tier 0) 10 requests/s on each video model; Imagine limits are not raised by tiers (contact sales)

Live result (2026-11-10): image-to-video, grok-imagine-video-1.5-lite, 4 s, 720p, 720×1280 input → H.264 720×1280 @ 24 fps + AAC stereo 48 kHz, done in ~20 s, cost_in_usd_ticks = 1 300 000 000 = $0.13 ($0.0325/s, i.e. above the $0.020/s headline price, which the docs say varies by resolution). Production runs the same day measured grok-imagine-video-1.5 at 720p: 6 s = $0.85 and 7 s = $0.99 (≈ $0.1415/s, against a $0.080/s headline). One of twelve clips failed with internal_error ("Please try again") and was not billed. CLIP therefore bills from usage.cost_in_usd_ticks and uses list prices only for pre-flight estimates.

# Image

POST /v1/images/generations with model, prompt, n (1–10), aspect_ratio, resolution (1k / 1.5k / 2k), quality (low / medium / auto), response_format (url temporary, or b64_json). Live result: 9:16 at 1k → JPEG 720×1280, cost_in_usd_ticks = 400 000 000 = $0.04. CLIP requests b64_json, so there is no URL to expire.

# Speech

POST /v1/tts with text (≤ 60 000 chars), voice_id, language (BCP-47 or auto), speed 0.7–1.5, with_timestamps. With timestamps the response is JSON: base64 audio (MP3 24 kHz), audio_timestamps.graph_chars / graph_times (per-character start/end seconds) and duration. $15 per 1M characters. Live result: 65 French characters, voice altair → 3.83 s, per-character timings returned. The TTS response carries no usage block, so its cost is computed as characters × $15 / 1e6 and labelled computed.

Voices are first-party presets (list from GET /v1/tts/voices). CLIP uses presets only: no voice cloning (the Custom Voices API exists but is deliberately not wired in — it would require a consent workflow).

Lip-sync: 1.5 models can generate lip-synced speech inside a clip, but CLIP's default grammar is narration over cinematic shots (reliable timing, exact captions). Character dialogue with reference_audios is a documented capability CLIP does not depend on.

# LLM

OpenAI-compatible POST /v1/chat/completions with response_format: { type: "json_schema", strict: true } (live-verified on grok-4.3 and grok-4.7), image inputs for critique, and usage.cost_in_usd_ticks in every response. Web search for fact-checking uses the Responses API (POST /v1/responses, tools: [{ type: "web_search" }], structured output through text.format), $5 per 1 000 searches plus tokens. Live-verified: the answer is the last message item of output, citations arrive as annotations[].url on its output_text parts, and usage reports server_side_tool_usage_details.web_search_calls and cost_in_usd_ticks.

# Model choice (measured on 2026-11-10)

The same factual brief was run with both models. grok-4.3 (medium effort) wrote an off-topic script, declared one claim out of four factual lines, and its research cited loosely related pages: $0.01 + $0.03. grok-4.7 (high effort for the script) wrote an accurate, on-topic script and its line-by-line research returned directly relevant university and reference pages: $0.08 + $0.33. A film's language-model cost is therefore about $0.50 instead of $0.05, which is small next to video. CLIP defaults to grok-4.7.

# Why CLIP calls the REST API directly instead of @ai-sdk/xai

The brief suggests @ai-sdk/xai. The AI SDK polls video generation internally and returns only the final result: the request_id is not exposed while the job is pending, and usage.cost_in_usd_ticks is not surfaced. CLIP needs both — the request_id is written to PostgreSQL before polling so that a crashed worker resumes the same paid job instead of buying it twice, and the tick count is the billing truth. The adapters in src/providers/ keep the provider behind interfaces, so swapping in the AI SDK later is a local change.

# Feature flags derived from this matrix (src/providers/capabilities.ts)

Flag 1.5 1.5-lite video
textToVideo / imageToVideo ✓ ✓ ✓
referenceToVideo ✓ — ✓
editVideo / extendVideo — — ✓
max resolution 1080p 1080p (upscaled) 720p
Files main
Menu

Theme