SPB Git

Repository Public

provider-capabilities.md 7.8 KB 111 lines markdown

1# Provider capabilities — verified 2026-11-1023Everything below was read from the official xAI documentation **and** confirmed by a live call with the4production key on 2026-11-10 (America/Toronto). Nothing here is copied from the brief's illustrative examples.5Re-verify with `pnpm tsx scripts/provider-probe.ts` (lists live models and prices, no paid call).67Sources (retrieved 2026-11-10):89- Pricing — https://docs.x.ai/developers/pricing10- Video overview / generation — https://docs.x.ai/developers/model-capabilities/video/overview , `/video/generation`11- Image-to-video, reference-to-video — `/video/image-to-video`, `/video/reference-to-video`12- Video REST reference — https://docs.x.ai/developers/rest-api-reference/inference/videos13- Image generation — https://docs.x.ai/developers/model-capabilities/images/generation14- Text to speech — https://docs.x.ai/developers/model-capabilities/audio/text-to-speech15- Persisting generated output — https://docs.x.ai/developers/model-capabilities/imagine/files/outputs16- Rate limits — https://docs.x.ai/developers/rate-limits17- Live endpoints: `GET /v1/models`, `/v1/image-generation-models`, `/v1/video-generation-models`, `/v1/tts/voices`, `/v1/embedding-models`1819## Models available to this key (live listing)2021| Kind | Model id | Notes |22|---|---|---|23| 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). |24| LLM | `grok-4.3` | 1M context, $1.25 / $2.50 per 1M tokens, `reasoning_effort` none…xhigh |25| LLM | `grok-4.6`, `grok-4.5` | 500k context, $2.00 / $6.00 per 1M tokens |26| LLM | `grok-4.20-0309-(non-)reasoning`, `grok-4.20-multi-agent-0309`, `grok-build-0.1` | available, unused |27| Image | `grok-imagine-image-2.0` | **Default.** quality low/medium × resolution 1k/1.5k/2k = $0.04–$0.08 per image (API price table) |28| Image | `grok-imagine-image` | $0.02 per image |29| Video | `grok-imagine-video-1.5` | **Default for masters.** T2V/I2V native 1080p, references (14 images, 3 voices), first/last/key frames |30| Video | `grok-imagine-video-1.5-lite` | **Default for drafts.** T2V/I2V, 1080p by upscaling 720p |31| Video | `grok-imagine-video` | T2V/I2V ≤ 720p, reference-to-video (7 images, 10 s), **edit** (source ≤ 8.7 s), **extension** (+2–10 s) |32| Speech | `POST /v1/tts` | 28 preset voices (live list), 20 documented languages incl. `fr` and `en` |33| Embeddings | — | `GET /v1/embedding-models` returns an empty list → CLIP uses a local, explainable lexical embedding |3435## Video (Grok Imagine)3637| Property | Verified value |38|---|---|39| Submit | `POST /v1/videos/generations` → `{ request_id }` (asynchronous) |40| Poll | `GET /v1/videos/{request_id}` → `status` pending/done/failed, `progress`, `video.url`, `video.duration`, `video.respect_moderation`, `usage.cost_in_usd_ticks` |41| Duration | 1–15 s (default 8) |42| Resolution | 480p (default), 720p, 1080p (not on `grok-imagine-video`) |43| 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 |44| Audio | Native generated audio on all three models; lip-synced speech on 1.5 / 1.5-lite |45| 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 |46| Errors | `invalid_argument`, `permission_denied`, `failed_precondition`, `service_unavailable`, `internal_error` in the polled body; auth / 429 as HTTP errors |47| Moderation | A blocked request is still billed (pricing page, "Usage Guidelines Violation Fee") |48| Rate limit (tier 0) | 10 requests/s on each video model; Imagine limits are not raised by tiers (contact sales) |4950Live result (2026-11-10): image-to-video, `grok-imagine-video-1.5-lite`, 4 s, 720p, 720×1280 input →51H.264 720×1280 @ 24 fps + AAC stereo 48 kHz, done in ~20 s, **`cost_in_usd_ticks` = 1 300 000 000 = $0.13**52($0.0325/s, i.e. above the $0.020/s headline price, which the docs say varies by resolution).53Production runs the same day measured `grok-imagine-video-1.5` at 720p: 6 s = $0.85 and 7 s = $0.99 (≈ $0.1415/s, against54a $0.080/s headline). One of twelve clips failed with `internal_error` ("Please try again") and was not billed.55CLIP therefore **bills from `usage.cost_in_usd_ticks`** and uses list prices only for pre-flight estimates.5657## Image5859`POST /v1/images/generations` with `model`, `prompt`, `n` (1–10), `aspect_ratio`, `resolution` (1k / 1.5k / 2k),60`quality` (low / medium / auto), `response_format` (`url` temporary, or `b64_json`). Live result: 9:16 at 1k →61JPEG 720×1280, `cost_in_usd_ticks` = 400 000 000 = **$0.04**. CLIP requests `b64_json`, so there is no URL to expire.6263## Speech6465`POST /v1/tts` with `text` (≤ 60 000 chars), `voice_id`, `language` (BCP-47 or `auto`), `speed` 0.7–1.5,66`with_timestamps`. With timestamps the response is JSON: base64 `audio` (MP3 24 kHz), `audio_timestamps.graph_chars`67/ `graph_times` (per-character start/end seconds) and `duration`. **$15 per 1M characters.** Live result: 6568French characters, voice `altair` → 3.83 s, per-character timings returned. The TTS response carries no usage69block, so its cost is computed as `characters × $15 / 1e6` and labelled *computed*.7071Voices are first-party presets (list from `GET /v1/tts/voices`). CLIP uses presets only: **no voice cloning**72(the Custom Voices API exists but is deliberately not wired in — it would require a consent workflow).7374Lip-sync: 1.5 models can generate lip-synced speech inside a clip, but CLIP's default grammar is **narration75over cinematic shots** (reliable timing, exact captions). Character dialogue with `reference_audios` is a76documented capability CLIP does not depend on.7778## LLM7980OpenAI-compatible `POST /v1/chat/completions` with `response_format: { type: "json_schema", strict: true }`81(live-verified on `grok-4.3` and `grok-4.7`), image inputs for critique, and `usage.cost_in_usd_ticks` in every82response. Web search for fact-checking uses the Responses API (`POST /v1/responses`, `tools: [{ type: "web_search" }]`,83structured output through `text.format`), $5 per 1 000 searches plus tokens. Live-verified: the answer is the last84`message` item of `output`, citations arrive as `annotations[].url` on its `output_text` parts, and `usage` reports85`server_side_tool_usage_details.web_search_calls` and `cost_in_usd_ticks`.8687### Model choice (measured on 2026-11-10)8889The same factual brief was run with both models. `grok-4.3` (medium effort) wrote an off-topic script, declared one90claim out of four factual lines, and its research cited loosely related pages: $0.01 + $0.03. `grok-4.7` (high effort91for the script) wrote an accurate, on-topic script and its line-by-line research returned directly relevant92university and reference pages: $0.08 + $0.33. A film's language-model cost is therefore about $0.50 instead of93$0.05, which is small next to video. CLIP defaults to `grok-4.7`.9495## Why CLIP calls the REST API directly instead of `@ai-sdk/xai`9697The brief suggests `@ai-sdk/xai`. The AI SDK polls video generation internally and returns only the final98result: the `request_id` is not exposed while the job is pending, and `usage.cost_in_usd_ticks` is not surfaced.99CLIP needs both — the `request_id` is written to PostgreSQL *before* polling so that a crashed worker resumes100the same paid job instead of buying it twice, and the tick count is the billing truth. The adapters in101`src/providers/` keep the provider behind interfaces, so swapping in the AI SDK later is a local change.102103## Feature flags derived from this matrix (`src/providers/capabilities.ts`)104105| Flag | 1.5 | 1.5-lite | video |106|---|---|---|---|107| textToVideo / imageToVideo | ✓ | ✓ | ✓ |108| referenceToVideo | ✓ | — | ✓ |109| editVideo / extendVideo | — | — | ✓ |110| max resolution | 1080p | 1080p (upscaled) | 720p |111
Files main
Menu

Theme