Skip to content

Commit 243ebf1

Browse files
committed
fix(ai-openrouter): rebase video adapter onto main and use SDK getVideoContent
Rebase #740 onto current main (rerank, BytePlus, Grok video, Omni Flash) and finish the leftover wiring: - Download completed clips via @openrouter/sdk 0.13.20 getVideoContent (it now accepts video/mp4) instead of the unsigned-URL fetch bypass - Keep the example on the streaming generateVideoFn path and add an OpenRouter provider group in ts-react-media - Merge OpenRouter into the current video/image docs and skill without dropping newer providers; kiira snippet uses the typed byteplus key - Drop the generateVideo duration-constraint changeset (already on main)
1 parent b57d4e1 commit 243ebf1

15 files changed

Lines changed: 2068 additions & 2075 deletions

File tree

.changeset/video-adapter-duration-constraint.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/adapters/openrouter.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ npm install @tanstack/ai-openrouter
2525
```typescript
2626
import { chat } from "@tanstack/ai";
2727
import { openRouterText } from "@tanstack/ai-openrouter";
28-
28+
2929
const stream = chat({
3030
adapter: openRouterText("openai/gpt-5"),
31-
messages: [{ role: "user", content: "Hello!" }],
31+
messages: [{ role: "user", content: "Hello!" }],
3232
});
3333
```
3434

@@ -67,13 +67,13 @@ See the full list at [openrouter.ai/models](https://openrouter.ai/models).
6767
```typescript
6868
import { chat, toServerSentEventsResponse } from "@tanstack/ai";
6969
import { openRouterText } from "@tanstack/ai-openrouter";
70-
70+
7171
export async function POST(request: Request) {
7272
const { messages } = await request.json();
7373

7474
const stream = chat({
7575
adapter: openRouterText("openai/gpt-5"),
76-
messages,
76+
messages,
7777
});
7878

7979
return toServerSentEventsResponse(stream);
@@ -111,8 +111,6 @@ export async function POST(request: Request) {
111111
return toServerSentEventsResponse(stream);
112112
}
113113
```
114-
115-
116114

117115
## Environment Variables
118116

@@ -181,10 +179,10 @@ export async function POST(request: Request) {
181179
OpenRouter exposes two OpenAI-compatible wire formats, and the adapter
182180
package ships one of each:
183181

184-
| Adapter | Endpoint | Status | When to use |
185-
| -------------------------- | ------------------------- | -------- | ---------------------------------------------------------------------------- |
186-
| `openRouterText` | `/v1/chat/completions` | Stable | Default for almost everything. Broadest model + tool support. |
187-
| `openRouterResponsesText` | `/v1/responses` | Beta | OpenAI Responses-shaped request/response; richer multi-turn state on OpenAI-style models. |
182+
| Adapter | Endpoint | Status | When to use |
183+
| ------------------------- | ---------------------- | ------ | ----------------------------------------------------------------------------------------- |
184+
| `openRouterText` | `/v1/chat/completions` | Stable | Default for almost everything. Broadest model + tool support. |
185+
| `openRouterResponsesText` | `/v1/responses` | Beta | OpenAI Responses-shaped request/response; richer multi-turn state on OpenAI-style models. |
188186

189187
Both adapters route to any underlying model OpenRouter supports
190188
(`anthropic/...`, `google/...`, `meta-llama/...`, etc.) — the wire format
@@ -450,4 +448,3 @@ const stream = chat({
450448
```
451449

452450
**Supported models:** all OpenRouter chat models. See [Provider Tools](../tools/provider-tools.md#which-models-support-which-tools).
453-

docs/media/image-generation.md

Lines changed: 272 additions & 261 deletions
Large diffs are not rendered by default.

docs/media/video-generation.md

Lines changed: 303 additions & 294 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)