CI guard: fail the build when a new Sume pricing_skus key appears

A node:test file fetches GET /v1/videos/models and fails when a model uses a pricing_skus key your cost code cannot total. Wan, Omni and H3 rates in the table.

4 min readSume
All posts

Your cost estimator knows three pricing_skus key shapes today, and a model added next month may bring a fourth. A 15-line node:test file that fetches GET /v1/videos/models and fails on any unknown key turns a silent wrong total into a red build.

What the guard must recognise

The docs example shows a per-1000-video-tokens key, and the catalog also serves per-second keys with a resolution suffix. Your guard is an allow-list of those shapes; anything else should stop the pipeline and make a person read the new key.

The table lists rates the estimator must reproduce exactly. If a CI run prints a different total for the same inputs, a rate moved.

Fixture totals your estimator should reproduce (read 2026-10-09)
ModelKeyRate per secondLengthExpected total
wan-3.0per-video-second-480p$0.062530 s$1.875
wan-3.0per-video-second-1080p$0.2530 s$7.50
gemini-omni-flash-1.1per-video-second-4K$0.37510 s$3.75
minimax-h3per-video-second-768p$0.07515 s$1.125

The test

Run it with node --test. It needs SUME_API_KEY in the CI secrets and makes one read request.

import test from "node:test";
import assert from "node:assert/strict";

const KNOWN = /^(per-1000-video-tokens|per-video-second|per-video-second-audio|per-video-second-(360p|480p|720p|768p|1080p|1K|2K|4K))$/;

test("every pricing_skus key is one we can total", async () => {
  const res = await fetch("https://api.sume.com/v1/videos/models", {
    headers: { Authorization: `Bearer ${process.env.SUME_API_KEY}` },
  });
  assert.equal(res.status, 200);
  const { data } = await res.json();
  for (const m of data) {
    for (const key of Object.keys(m.pricing_skus)) {
      assert.match(key, KNOWN, `${m.id} has unknown sku key ${key}`);
    }
  }
});

Gotchas

The resolution suffix list mirrors the resolution enum in the OpenAPI request schema: 360p, 480p, 720p, 768p, 1080p, 1K, 2K and 4K. If the enum grows, widen the regex deliberately rather than with a wildcard, or the guard stops guarding.

A model missing from the response is not a failure here: the catalog lists a model only when its provider is configured. Pin the models you rely on in a second test, and keep this one for key shapes.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume