Skip to content

Commit e8837b7

Browse files
author
1bcMax
committed
feat: VideoClient + Grok Imagine models + GCS-backed image response fields
- New VideoClient (blockrun_llm/video.py) for xai/grok-imagine-video at $0.05/sec, 8s default. Blocks until polling completes (~30-120s). - VideoResponse / VideoClip / VideoModel types added. - ImageData gains optional source_url + backed_up fields for gateway-mirrored assets. - README documents new Grok Imagine image + video models. - Bumped to 0.13.0.
1 parent 3965f0b commit e8837b7

6 files changed

Lines changed: 348 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
All notable changes to blockrun-llm will be documented in this file.
44

5-
## 0.11.0 (Current)
5+
## 0.13.0
6+
7+
- **New `VideoClient`** — generate AI videos via `xai/grok-imagine-video` ($0.05/sec, 8s default).
8+
- `VideoResponse`, `VideoClip`, `VideoModel` types added.
9+
- Text-to-video and image-to-video supported; client blocks until polling completes (~30-120s).
10+
- `ImageData` now exposes `source_url` and `backed_up` for gateway-mirrored assets.
11+
- Grok Imagine image models (`xai/grok-imagine-image`, `-pro`) routable via `ImageClient`.
12+
- Grok 4.20 chat models (`xai/grok-4.20-reasoning`, `-non-reasoning`, `-multi-agent`) routable via the chat API.
13+
14+
## 0.11.0
615

716
- 43+ models supported
817
- Base and Solana chain payments

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,29 @@ All models below have been tested end-to-end via the Python SDK (Mar 2026):
245245
| `black-forest/flux-1.1-pro` | $0.04/image |
246246
| `google/nano-banana` | $0.05/image |
247247
| `google/nano-banana-pro` | $0.10-0.15/image |
248+
| `xai/grok-imagine-image` | $0.02/image |
249+
| `xai/grok-imagine-image-pro` | $0.07/image |
250+
| `zai/cogview-4` | $0.015/image |
251+
252+
### Video Generation
253+
| Model | Price |
254+
|-------|-------|
255+
| `xai/grok-imagine-video` | $0.05/sec (8s default → $0.42/clip) |
256+
257+
```python
258+
from blockrun_llm import VideoClient
259+
260+
client = VideoClient()
261+
result = client.generate("a red apple slowly spinning on a wooden table")
262+
print(result.data[0].url) # permanent MP4 URL
263+
print(result.data[0].duration_seconds) # 8
264+
265+
# Image-to-video
266+
result = client.generate(
267+
"the subject turns its head and smiles",
268+
image_url="https://example.com/portrait.jpg",
269+
)
270+
```
248271

249272
## X/Twitter Data (Powered by AttentionVC)
250273

blockrun_llm/__init__.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
result = client.generate("A cute cat wearing a space helmet")
3030
print(result.data[0].url)
3131
32+
Video generation:
33+
from blockrun_llm import VideoClient
34+
35+
client = VideoClient()
36+
result = client.generate("a red apple slowly spinning on a wooden table")
37+
print(result.data[0].url) # permanent MP4 URL
38+
3239
Other Chains:
3340
- XRPL (RLUSD): Use blockrun-llm-xrpl (pip install blockrun-llm-xrpl)
3441
- Solana (USDC): Use SolanaLLMClient (pip install blockrun-llm[solana])
@@ -46,6 +53,7 @@
4653
from .solana_client import SolanaLLMClient
4754
from .image import ImageClient
4855
from .music import MusicClient
56+
from .video import VideoClient
4957
from .types import (
5058
ChatMessage,
5159
ChatResponse,
@@ -59,6 +67,10 @@
5967
MusicResponse,
6068
AudioTrack,
6169
AudioModel,
70+
# Video types
71+
VideoResponse,
72+
VideoClip,
73+
VideoModel,
6274
# Live Search types
6375
SearchParameters,
6476
WebSearchSource,
@@ -121,7 +133,7 @@
121133
)
122134
from .cache import clear_cache, get_cost_log_summary
123135

124-
__version__ = "0.12.0"
136+
__version__ = "0.13.0"
125137
__all__ = [
126138
"LLMClient",
127139
"AsyncLLMClient",
@@ -138,6 +150,7 @@
138150
"list_image_models",
139151
"ImageClient",
140152
"MusicClient",
153+
"VideoClient",
141154
"ChatMessage",
142155
"ChatResponse",
143156
"Model",
@@ -149,6 +162,9 @@
149162
"MusicResponse",
150163
"AudioTrack",
151164
"AudioModel",
165+
"VideoResponse",
166+
"VideoClip",
167+
"VideoModel",
152168
# Live Search types
153169
"SearchParameters",
154170
"WebSearchSource",

blockrun_llm/types.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ class ImageData(BaseModel):
138138
"""A single generated image."""
139139

140140
url: str
141+
# When the gateway mirrors the asset to its own storage, `url` is the
142+
# permanent blockrun-hosted URL and `source_url` is the original upstream.
143+
# `backed_up` is True iff the mirror step succeeded. For data-URI results
144+
# (e.g. openai/gpt-image-1) both fields are omitted.
145+
source_url: Optional[str] = None
146+
backed_up: Optional[bool] = None
141147
revised_prompt: Optional[str] = None
142148

143149

@@ -187,6 +193,40 @@ class AudioModel(BaseModel):
187193
description: str
188194
price_per_track: float
189195
max_duration_seconds: int
196+
197+
198+
# Video generation types
199+
200+
class VideoClip(BaseModel):
201+
"""A single generated video clip."""
202+
203+
url: str # Permanent blockrun-hosted URL (falls back to upstream if backup fails)
204+
source_url: Optional[str] = None # Original upstream URL (e.g. vidgen.x.ai)
205+
duration_seconds: Optional[int] = None
206+
request_id: Optional[str] = None # Upstream provider's request id (xAI)
207+
backed_up: Optional[bool] = None
208+
209+
210+
class VideoResponse(BaseModel):
211+
"""Response from video generation."""
212+
213+
created: int
214+
model: str
215+
data: List[VideoClip]
216+
txHash: Optional[str] = None
217+
218+
219+
class VideoModel(BaseModel):
220+
"""Available video model information."""
221+
222+
id: str
223+
name: str
224+
provider: str
225+
description: str
226+
price_per_second: float
227+
default_duration_seconds: int
228+
max_duration_seconds: int
229+
supports_image_input: bool = False
190230
supports_lyrics: bool
191231
supports_instrumental: bool
192232
available: bool = True

0 commit comments

Comments
 (0)