Skip to content

feat(xai): add grok-imagine-video-1.5-preview - #2524

Closed
analogpvt wants to merge 3 commits into
theopenco:mainfrom
analogpvt:feat/xai-video-model
Closed

analogpvt wants to merge 3 commits into
theopenco:mainfrom
analogpvt:feat/xai-video-model

Conversation

@analogpvt

@analogpvt analogpvt commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add xAI grok-imagine-video-1.5-preview video generation model
  • $0.08/second, 720p/1080p, 5-15s duration
  • Text-to-video and image-to-video support

Changes

  • packages/models/src/models/xai.ts - Model definition
  • apps/gateway/src/videos/videos.ts - Video job creation + proxy
  • apps/worker/src/services/video-jobs.ts - Status polling base URL

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Integrated Reve provider for image generation with configurable aspect ratios
    • Added xAI provider support for video generation with advanced video format options
    • Introduced new xAI video model (grok-imagine-video-1.5-preview) featuring flexible video sizes, durations, and pricing tiers

analogpvt and others added 3 commits June 4, 2026 08:13
Add Reve as a new image generation provider with the reve-create model.

- Add provider definition with env config (LLM_REVE_API_KEY)
- Add reve-create model ($0.024/image, native 4K, text-to-image)
- Add provider endpoint routing (https://api.reve.com/v1/image/create)
- Add request body transformation (prompt, version, aspect_ratio)
- Add response parsing for Reve's {image: base64} format
- Add OpenAI-format response construction for non-choices responses
- Update .env.example with LLM_REVE_API_KEY placeholder

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add xAI's video generation model with text-to-video and
image-to-video support up to 15 seconds at $0.08/second.

- Add model definition with per-second pricing
- Add xAI video base URL (api.x.ai)
- Add video job creation via /v1/videos/generations
- Add image input support (first frame)
- Enable direct upstream content proxy for xAI
- Supported sizes: 1280x720, 1920x1080
- Supported durations: 5s, 10s, 15s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

This PR adds support for two new LLM gateway providers: Reve (image generation) and extends xAI with video generation. Reve is integrated with full request/response handling and model registry entries, while xAI's video capability is exposed through a new upstream job creator and model definition.

Changes

Reve Image Generation Provider

Layer / File(s) Summary
Provider registration and model definitions
packages/models/src/providers.ts, packages/models/src/models/reve.ts, packages/models/src/models.ts, .env.example
Reve provider is registered with API key configuration (LLM_REVE_API_KEY), a single "reve-create" image model is defined with pricing and feature flags, and both are wired into the global provider and model registries.
Request endpoint and body preparation
packages/actions/src/get-provider-endpoint.ts, packages/actions/src/prepare-request-body.ts
Reve requests are routed to https://api.reve.com and mapped to the /v1/image/create endpoint; request bodies extract prompts and reference images from user messages and build a Reve-shaped request with version/aspect ratio metadata.
Response parsing and OpenAI transformation
apps/gateway/src/chat/tools/parse-provider-response.ts, apps/gateway/src/chat/tools/transform-response-to-openai.ts
Reve's base64 image responses are recognized and parsed into images arrays; non-OpenAI-shaped responses with images are transformed into OpenAI-compatible chat completions with usage and metadata.

xAI Video Generation Provider

Layer / File(s) Summary
Video model definition
packages/models/src/models/xai.ts
The grok-imagine-video-1-5-preview video model is added to xAI's catalog with pricing (input/output/per-second rates), supported video sizes (720p/1080p), duration limits (5–60 seconds), and feature flags.
Video job creation and routing
apps/gateway/src/videos/videos.ts, apps/worker/src/services/video-jobs.ts
xAI is added as a default provider base URL option, included in upstream proxy routing logic, and a new createXaiVideoJob function submits requests to /v1/videos/generations with optional first-frame images; the worker layer recognizes xAI and returns its API base URL.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • theopenco/llmgateway#2059: Both PRs extend image-generation request/response plumbing in parse-provider-response.ts and transform-response-to-openai.ts to handle provider-specific (non-OpenAI-shaped) image outputs.
  • theopenco/llmgateway#2379: Both PRs extend packages/models/src/models/xai.ts by adding new xAI model definitions to the exported array.
  • theopenco/llmgateway#2133: Both PRs modify packages/models/src/models/xai.ts to extend the xaiModels array with new model entries.

Suggested reviewers

  • steebchen
  • smakosh
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'feat(xai): add grok-imagine-video-1.5-preview' accurately describes the primary change—adding a new xAI video generation model. However, the changeset also includes substantial support for a new Reve image generation provider with multiple file changes across the codebase, which is not mentioned in the title. Consider updating the title to reflect both major additions, such as 'feat: add xai video model and reve image provider' or split into separate PRs, as the current title only partially represents the full scope of changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@analogpvt analogpvt closed this Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant