Skip to content

Commit 51fe9b8

Browse files
authored
fix: serve OpenRouter's removal rejection for openai/sora-2 (#520)
## Summary The daily Drift Tests have reported a critical since 2026-10-06 (first seen in run 37422677099, again in 38030209547 and 38001928761): aimock's OpenRouter video proxy mirrors the `sora` family, but the live `GET /api/v1/videos/models` listing no longer has it. OpenRouter **removed** `openai/sora-2`. It did not just deprecate it. Under the [deprecation policy](https://aimock.copilotkit.dev/deprecation-policy/), a removed model must not mock success. The mock now serves the rejection the real API returns, and the drift check no longer requires the family. ## What OpenRouter returns now (observed live, 2026-10-10) - `GET /api/v1/videos/models`: 30 models. None is `openai/sora*`. Families: aleph, avatar, flux, gen, grok, hailuo, happyhorse, heygen, kling, seedance, veo, wan. - `GET /api/v1/models` (458 models): no `sora` id. - `GET /api/v1/models/openai/sora-2/endpoints`: `404 {"error":{"message":"Not Found","code":404}}`. - `POST /api/v1/videos` with a valid key and `{"model":"openai/sora-2","prompt":"a cat","duration":4}`: ``` HTTP/2 400 content-type: application/json {"error":{"message":"Model openai/sora-2 does not exist","code":400}} ``` That is the same rejection OpenRouter gives an unknown id: `nonexistent/zzz-1` returns `400 "Model nonexistent/zzz-1 does not exist"`. No job was created. ## Changes - `src/openrouter-video.ts` - New private `OPENROUTER_VIDEO_SUNSET_MODELS = {"openai/sora-2"}`. - `POST /api/v1/videos` with a sunset model returns the observed 400 body (journaled, `fixture: null`). This happens before fixture matching, chaos and the record proxy, so no fixture can make it succeed and nothing goes upstream. - `DEFAULT_OPENROUTER_VIDEO_MODELS` is now `["bytedance/seedance-2.0"]`. A fixture for a sunset model no longer adds it to the synthesized listing. - `src/__tests__/drift/openrouter-video.drift.ts` - `REQUIRED_VIDEO_FAMILIES` is now `["seedance"]`. Sora is explicitly excluded from drift, as the policy requires. - New live sunset canary: it fails if `openai/sora-2` returns to the live listing, because then the mock's 400 would be what had drifted. Mutation check: putting `bytedance/seedance-2.0` in the sunset list makes the canary fail. - `src/__tests__/openrouter-video.test.ts`: 4 new sunset tests, written first and seen failing. The listing-synthesis test now uses `google/veo-3.1` instead of `openai/sora-2`. - `src/__tests__/drift/providers.ts`: comment example only. - `docs/openrouter-video/index.html`: new "Removed Models" section. `CHANGELOG.md`: loud `[Unreleased] / Changed` entry. This is a normal release, not a major. ## Local red-green proof ### RED (base `bc436346`, real `OPENROUTER_API_KEY`, live API) `npx vitest run --config vitest.config.drift.ts --reporter=verbose src/__tests__/drift/openrouter-video.drift.ts` ``` × OpenRouter video model-family availability (live) > live /api/v1/videos/models contains the families aimock mirrors 1. [critical] aimock's OpenRouter video proxy mirrors the "sora" family, but the live /api/v1/videos/models listing no longer contains it — update DEFAULT_OPENROUTER_VIDEO_MODELS in src/openrouter-video.ts Path: videos/models/sora Real: aleph, avatar, flux, gen, grok, hailuo, happyhorse, heygen, kling, seedance, veo, wan Tests 1 failed | 3 passed (4) ``` Mock before the fix (built `dist`, real HTTP): ``` [no-fixtures] listing=["bytedance/seedance-2.0","openai/sora-2"] [no-fixtures] POST /api/v1/videos model=openai/sora-2 -> 404 {"error":{"message":"No fixture matched","code":404}} [sora-fixture] listing=["openai/sora-2"] [sora-fixture] POST /api/v1/videos model=openai/sora-2 -> 202 {"id":"d90d85fe-…","polling_url":"…","status":"pending"} ``` ### GREEN (this branch, same command, same key, live API) ``` ✓ OpenRouter video-proxy envelope shapes > submit returns { id, polling_url, status } ✓ OpenRouter video-proxy envelope shapes > completed status poll returns { id, status, unsigned_urls, usage } ✓ OpenRouter video-proxy envelope shapes > models listing returns { data: [ { id, name, supported_* , ... } ] } ✓ OpenRouter video model-family availability (live) > live /api/v1/videos/models contains the families aimock mirrors ✓ OpenRouter video model-family availability (live) > live /api/v1/videos/models still omits the models aimock serves as sunset Tests 5 passed (5) ``` Mock after the fix: ``` [no-fixtures] listing=["bytedance/seedance-2.0"] [no-fixtures] POST /api/v1/videos model=openai/sora-2 -> 400 {"error":{"message":"Model openai/sora-2 does not exist","code":400}} [sora-fixture] listing=["bytedance/seedance-2.0"] [sora-fixture] POST /api/v1/videos model=openai/sora-2 -> 400 {"error":{"message":"Model openai/sora-2 does not exist","code":400}} ``` ## Public type compatibility - `DEFAULT_OPENROUTER_VIDEO_MODELS` and the new set are module-private. No exported type changed. - I diffed `dist/*.d.ts` and `*.d.cts` (172 files) against `npm pack @copilotkit/aimock@1.45.0` and against a base build. 6 `ws-*` files differ only in bundler import alias numbering (`node_http2` vs `node_http3`); they are identical after normalizing that. `openrouter-video.d.ts` is identical apart from the `sourceMappingURL` line. - Consumer proof: a small consumer (`LLMock`, `Fixture`, a video fixture for `openai/sora-2`) passes `tsc` with `strict` and `skipLibCheck: false` against both npm 1.45.0 and this branch's build. ## Quality gates (worktree root) - `pnpm format:check`: pass - `pnpm lint`: pass - `pnpm typecheck`: pass - `pnpm build`: pass - `pnpm test`: 377 files, 14073 passed, 3 skipped. The first run hit one timeout in `ws-framing.test.ts` while builds ran at the same time. That file passed 3 of 3 times on its own, and the full rerun was clean. ## Out of scope `openai/sora-2-pro` still has an OpenRouter model page, with zero endpoints, and returns `404 "No endpoints found for openai/sora-2-pro."`. aimock never mirrored it, so it is not changed here. OpenAI's direct `/v1/videos` Sora surface is also unchanged.
2 parents bc43634 + 898f670 commit 51fe9b8

6 files changed

Lines changed: 185 additions & 8 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Changed
6+
7+
- **OpenRouter Video: `openai/sora-2` now returns the real removal rejection, not a job.** OpenRouter removed the model, and a live submit returns `400 {"error":{"message":"Model openai/sora-2 does not exist","code":400}}`. `POST /api/v1/videos` with `model: "openai/sora-2"` now returns that 400 even when a fixture matches, and never reaches a record-mode upstream. The default `GET /api/v1/videos/models` listing no longer includes `openai/sora-2`, and a fixture for it no longer adds it to the listing. Move fixtures to a model OpenRouter still serves (for example `bytedance/seedance-2.0`). The daily drift check now confirms the model stays absent instead of requiring it.
8+
59
## [1.45.0] - 2026-10-10
610

711
Every fixture, config and request that 1.44.0 accepted behaves the same by default. New behavior that would change those inputs is opt-in.

‎docs/openrouter-video/index.html‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,17 @@ <h2>Models Listing</h2>
240240
disables the proxy &mdash; a strict request is always served the synthesized listing.
241241
</p>
242242

243+
<h2>Removed Models</h2>
244+
<p>
245+
OpenRouter removed <code>openai/sora-2</code>. Following the
246+
<a href="/deprecation-policy">deprecation policy</a>, aimock serves the rejection the real
247+
API now returns: <code>POST /api/v1/videos</code> with that model gets
248+
<code>400</code> and
249+
<code>{"error":{"message":"Model openai/sora-2 does not exist","code":400}}</code>, even
250+
when a fixture matches it, and the request never reaches a record-mode upstream. The model
251+
is not in the default listing, and a fixture for it does not add it to the listing.
252+
</p>
253+
243254
<h2>Chaos &amp; Metrics</h2>
244255
<p>
245256
<a href="/chaos-testing">Chaos injection</a> applies to all four routes. Journal entries

‎src/__tests__/drift/openrouter-video.drift.ts‎

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,19 @@ export function openRouterVideoFamily(id: string): string {
244244
}
245245

246246
// The families aimock's OpenRouter video proxy hardcodes as its default set
247-
// (DEFAULT_OPENROUTER_VIDEO_MODELS = ["bytedance/seedance-2.0", "openai/sora-2"]
248-
// in src/openrouter-video.ts) — the ground truth of "what the proxy mirrors".
247+
// (DEFAULT_OPENROUTER_VIDEO_MODELS = ["bytedance/seedance-2.0"] in
248+
// src/openrouter-video.ts) — the ground truth of "what the proxy mirrors".
249249
// A missing family means aimock is mirroring a model the provider retired (or
250250
// the endpoint contract moved), which is exactly the drift signal.
251-
const REQUIRED_VIDEO_FAMILIES = ["seedance", "sora"] as const;
251+
const REQUIRED_VIDEO_FAMILIES = ["seedance"] as const;
252+
253+
// Models OpenRouter REMOVED, which the mock now serves as a sunset rejection
254+
// (OPENROUTER_VIDEO_SUNSET_MODELS in src/openrouter-video.ts). Per the
255+
// deprecation policy they are excluded from the family-presence check above
256+
// explicitly — "sora" left the live listing in October 2026. The check below
257+
// asserts they are STILL absent: if one comes back, the mock's 400 rejection
258+
// for it is the thing that has drifted.
259+
const SUNSET_VIDEO_MODELS = ["openai/sora-2"] as const;
252260

253261
describe.skipIf(!OPENROUTER_API_KEY)("OpenRouter video model-family availability (live)", () => {
254262
it("live /api/v1/videos/models contains the families aimock mirrors", async () => {
@@ -279,4 +287,32 @@ describe.skipIf(!OPENROUTER_API_KEY)("OpenRouter video model-family availability
279287

280288
expect(missing, report).toEqual([]);
281289
});
290+
291+
it("live /api/v1/videos/models still omits the models aimock serves as sunset", async () => {
292+
const ids = await listOpenRouterVideoModels(OPENROUTER_API_KEY!);
293+
expect(ids.length, "OpenRouter returned an empty video-model listing").toBeGreaterThan(0);
294+
295+
const live = new Set(ids);
296+
const revived = SUNSET_VIDEO_MODELS.filter((id) => live.has(id));
297+
const report =
298+
revived.length > 0
299+
? formatDriftReport(
300+
"OpenRouter video (live /api/v1/videos/models sunset canary)",
301+
revived.map((id) => ({
302+
path: `videos/models/${id}`,
303+
severity: "critical" as const,
304+
issue:
305+
`aimock serves "${id}" as a removed model (400 "does not exist"), but the live ` +
306+
`/api/v1/videos/models listing contains it again — update ` +
307+
`OPENROUTER_VIDEO_SUNSET_MODELS in src/openrouter-video.ts`,
308+
expected: `("${id}" absent from live listing)`,
309+
real: id,
310+
mock: "(sunset: 400 Model does not exist)",
311+
})),
312+
"openrouter-video",
313+
)
314+
: "No drift detected: OpenRouter video sunset canary";
315+
316+
expect(revived, report).toEqual([]);
317+
});
282318
});

‎src/__tests__/drift/providers.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ export async function probeBytePlusArkUnknownTask(
10121012
* generation) listing endpoint `GET /api/v1/videos/models`. Video models do
10131013
* NOT appear in the plain `/api/v1/models` listing, hence the dedicated route
10141014
* (see src/openrouter-video.ts handleOpenRouterVideoModels). Returns the raw
1015-
* provider-prefixed slugs (e.g. "openai/sora-2", "bytedance/seedance-2.0",
1015+
* provider-prefixed slugs (e.g. "kwaivgi/kling-v3.0-pro", "bytedance/seedance-2.0",
10161016
* "google/veo-3.1"). This is the cost-safe daily live-reality canary for the
10171017
* OpenRouter video proxy surface — it authenticates and reads metadata only,
10181018
* never submitting a paid generation job.

‎src/__tests__/openrouter-video.test.ts‎

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ describe("GET /api/v1/videos/models (OpenRouter video model listing)", () => {
606606
response: { video: { id: "v1", status: "completed" } },
607607
});
608608
mock.addFixture({
609-
match: { model: "openai/sora-2", endpoint: "video" },
609+
match: { model: "google/veo-3.1", endpoint: "video" },
610610
response: { video: { id: "v2", status: "completed" } },
611611
});
612612
// Non-video fixture model must NOT appear
@@ -627,7 +627,7 @@ describe("GET /api/v1/videos/models (OpenRouter video model listing)", () => {
627627
const ids = data.data.map((m: { id: string }) => m.id);
628628
// Order-insensitive: ids come from Set iteration, not a documented order.
629629
expect(ids).toHaveLength(2);
630-
expect(ids).toEqual(expect.arrayContaining(["bytedance/seedance-2.0", "openai/sora-2"]));
630+
expect(ids).toEqual(expect.arrayContaining(["bytedance/seedance-2.0", "google/veo-3.1"]));
631631
for (const entry of data.data) {
632632
expect(typeof entry.name).toBe("string");
633633
expect(Array.isArray(entry.supported_durations)).toBe(true);
@@ -677,6 +677,93 @@ describe("GET /api/v1/videos/models (OpenRouter video model listing)", () => {
677677
});
678678
});
679679

680+
// ─── Sunset: openai/sora-2 removed from OpenRouter ─────────────────────────
681+
//
682+
// OpenRouter removed openai/sora-2 from its video catalog (absent from the live
683+
// /api/v1/videos/models listing; /api/v1/models/openai/sora-2/endpoints is a
684+
// 404). A live submit observed on 2026-10-10 is rejected with:
685+
// HTTP 400, content-type: application/json
686+
// {"error":{"message":"Model openai/sora-2 does not exist","code":400}}
687+
// Per the deprecation policy the mock serves that rejection and never success.
688+
689+
describe("OpenRouter video — sunset openai/sora-2", () => {
690+
let mock: LLMock | undefined;
691+
692+
afterEach(async () => {
693+
await mock?.stop();
694+
mock = undefined;
695+
});
696+
697+
test("default listing no longer advertises openai/sora-2", async () => {
698+
mock = new LLMock({ port: 0 });
699+
await mock.start();
700+
701+
const res = await fetch(`${mock.url}/api/v1/videos/models`);
702+
expect(res.status).toBe(200);
703+
const ids = (await res.json()).data.map((m: { id: string }) => m.id);
704+
expect(ids).toContain("bytedance/seedance-2.0");
705+
expect(ids).not.toContain("openai/sora-2");
706+
});
707+
708+
test("a fixture for openai/sora-2 does not put it back in the listing", async () => {
709+
mock = new LLMock({ port: 0 });
710+
mock.addFixture({
711+
match: { model: "openai/sora-2", endpoint: "video" },
712+
response: { video: { id: "v_sora", status: "completed" } },
713+
});
714+
mock.addFixture({
715+
match: { model: "bytedance/seedance-2.0", endpoint: "video" },
716+
response: { video: { id: "v_sd", status: "completed" } },
717+
});
718+
await mock.start();
719+
720+
const res = await fetch(`${mock.url}/api/v1/videos/models`);
721+
const ids = (await res.json()).data.map((m: { id: string }) => m.id);
722+
expect(ids).toEqual(["bytedance/seedance-2.0"]);
723+
});
724+
725+
test("submit for openai/sora-2 returns the live 400 rejection even when a fixture matches", async () => {
726+
mock = new LLMock({ port: 0 });
727+
mock.addFixture({
728+
match: { model: "openai/sora-2", endpoint: "video" },
729+
response: { video: { id: "v_sora", status: "completed", b64: "AAAA" } },
730+
});
731+
await mock.start();
732+
733+
const res = await fetch(`${mock.url}/api/v1/videos`, {
734+
method: "POST",
735+
headers: { "Content-Type": "application/json", Authorization: "Bearer test" },
736+
body: JSON.stringify({ model: "openai/sora-2", prompt: "a cat" }),
737+
});
738+
expect(res.status).toBe(400);
739+
expect(res.headers.get("content-type")).toContain("application/json");
740+
expect(await res.json()).toEqual({
741+
error: { message: "Model openai/sora-2 does not exist", code: 400 },
742+
});
743+
744+
const entries = mock.getRequests();
745+
expect(entries).toHaveLength(1);
746+
expect(entries[0].response.status).toBe(400);
747+
expect(entries[0].response.fixture).toBeNull();
748+
});
749+
750+
test("submit for openai/sora-2 never reaches a record-mode upstream", async () => {
751+
mock = new LLMock({
752+
port: 0,
753+
record: { providers: { openrouter: UPSTREAM_DOWN_URL } },
754+
});
755+
await mock.start();
756+
757+
const res = await fetch(`${mock.url}/api/v1/videos`, {
758+
method: "POST",
759+
headers: { "Content-Type": "application/json", Authorization: "Bearer test" },
760+
body: JSON.stringify({ model: "openai/sora-2", prompt: "a cat" }),
761+
});
762+
expect(res.status).toBe(400);
763+
expect((await res.json()).error.message).toBe("Model openai/sora-2 does not exist");
764+
});
765+
});
766+
680767
// ─── Task 6: cross-cutting conformance ──────────────────────────────────────
681768

682769
describe("OpenRouter video — strict mode diagnostics", () => {

‎src/openrouter-video.ts‎

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ interface OpenRouterVideoRequest {
6363

6464
const DEFAULT_OPENROUTER_VIDEO_MODEL = "bytedance/seedance-2.0";
6565

66+
/**
67+
* Video models OpenRouter has REMOVED (deprecation policy: a removed surface
68+
* never mocks success — it serves the rejection the real API serves now).
69+
*
70+
* openai/sora-2: gone from the live /api/v1/videos/models listing and from
71+
* /api/v1/models (its /endpoints page is a 404). A live submit observed on
72+
* 2026-10-10 is rejected with HTTP 400, content-type application/json, body
73+
* `{"error":{"message":"Model openai/sora-2 does not exist","code":400}}` —
74+
* the same rejection OpenRouter gives any unknown model id.
75+
*/
76+
const OPENROUTER_VIDEO_SUNSET_MODELS: ReadonlySet<string> = new Set(["openai/sora-2"]);
77+
6678
// ─── OpenRouterVideoJobMap (TTL + bounded) ──────────────────────────────────
6779

6880
export const OPENROUTER_VIDEO_MAX_ENTRIES = 10_000;
@@ -1146,7 +1158,7 @@ async function proxyOpenRouterVideoRecordContent(args: {
11461158

11471159
// ─── GET /api/v1/videos/models — model listing ──────────────────────────────
11481160

1149-
const DEFAULT_OPENROUTER_VIDEO_MODELS = [DEFAULT_OPENROUTER_VIDEO_MODEL, "openai/sora-2"];
1161+
const DEFAULT_OPENROUTER_VIDEO_MODELS = [DEFAULT_OPENROUTER_VIDEO_MODEL];
11501162

11511163
function modelEntry(id: string): Record<string, unknown> {
11521164
return {
@@ -1277,7 +1289,13 @@ export async function handleOpenRouterVideoModels(
12771289
for (const f of fixtures) {
12781290
if (f.match.endpoint === "video") {
12791291
sawVideoFixture = true;
1280-
if (f.match.model && typeof f.match.model === "string") {
1292+
// A sunset model can never be served, so a fixture for one must not
1293+
// advertise it in the listing either.
1294+
if (
1295+
f.match.model &&
1296+
typeof f.match.model === "string" &&
1297+
!OPENROUTER_VIDEO_SUNSET_MODELS.has(f.match.model)
1298+
) {
12811299
modelIds.add(f.match.model);
12821300
}
12831301
}
@@ -1439,6 +1457,27 @@ export async function handleOpenRouterVideoCreate(
14391457
return;
14401458
}
14411459

1460+
// Sunset models serve the live rejection BEFORE fixture matching, chaos and
1461+
// the record proxy: no fixture can make a removed model succeed, and the
1462+
// upstream would only return this same 400.
1463+
if (videoReq.model !== undefined && OPENROUTER_VIDEO_SUNSET_MODELS.has(videoReq.model)) {
1464+
journal.add({
1465+
method,
1466+
path,
1467+
headers: flattenHeaders(req.headers),
1468+
body: parsedBody,
1469+
response: { status: 400, fixture: null },
1470+
});
1471+
writeErrorResponse(
1472+
res,
1473+
400,
1474+
JSON.stringify({
1475+
error: { message: `Model ${videoReq.model} does not exist`, code: 400 },
1476+
}),
1477+
);
1478+
return;
1479+
}
1480+
14421481
const syntheticReq: ChatCompletionRequest = {
14431482
// Model-less submits assume the default model — a fixture restricted to
14441483
// DEFAULT_OPENROUTER_VIDEO_MODEL will match them.

0 commit comments

Comments
 (0)