bun run --check: type errors stop before a Sume job submits
Bun 1.4.3 adds bun check and a --check flag on bun run. Use it so a type error in your Sume script fails before a paid generation request is sent.

Run your Sume script with bun run --check script.ts. Bun 1.4.3 type checks first, and if there is a type error your code never runs, so a typo in a request field cannot reach a paid generation endpoint.
That ordering is the whole point for a billing API. The Bun v1.4.3 post (read 2026-10-10) describes bun check and the --check flag; this post shows where it fits in a Sume job script.
What Bun 1.4.3 added
Facts below are from the Bun release post, dated October 10, 2026 (read 2026-10-10).
| Command | What the post says |
|---|---|
| bun check | A standalone TypeScript type checker. Type checks only: it emits no JavaScript or .d.ts files and has no language server |
| bun run --check | Type check, then run. If there is a type error, your code does not run |
| bun test --check | Type check the test files and everything they import, then run. A type error means no tests run |
| bun build --check | Type check, then bundle. A type error fails the build and nothing is written |
| Install | The typescript package is not required |
| Speed | 3x to 6.4x faster than tsc 7.0.2, with 2.2x to 4.9x less memory, per Bun's own numbers |
Where it helps in a Sume script
The Sume SDK generates one typed function per operation. Generated operations do not throw on an API error: they resolve with data, error and response, and the SDK docs say so on the runs page. Types are what remind you to handle the error branch before you read data.
- A wrong field name in the request body fails the check, not the API call.
- Reading submitted.data without handling error is flagged when the type allows undefined.
- Because the check runs before the script, no job is created and nothing is reserved against your balance.
The script
This is the generation-job pattern from the SDK docs: submit async with an idempotency key, then wait on the job id. Save it as sume-video.ts.
import { createSumeClient, generateVideoV1, waitForJob } from "@sume-com/sdk";
const client = createSumeClient({ apiKey: process.env.SUME_API_KEY! });
const { data: submitted, error } = await generateVideoV1({
client,
headers: { "idempotency-key": crypto.randomUUID() },
body: { prompt: "Slow push-in on a ceramic mug", mode: "async" },
});
if (error) throw new Error(JSON.stringify(error));
const job = await waitForJob(submitted!.data.request_id, {
client,
onStatus: (status, snapshot) => console.log(status, snapshot.next_action),
});
console.log(job.status, job.result.artifacts);Then run it with the check on:
bun run --check sume-video.tsLimits worth knowing
A type check cannot know your balance, your key scopes or whether the prompt is accepted. Those come back as API errors, with a code and a request id in the error envelope. The check also does not make a retry safe: keep the Idempotency-Key and reuse it only for an exact retry of the same request. Use bun test --check for the same guard on your tests, and keep the full request shapes in the API reference.
Sources
Related posts
More in Developers
- Can you cancel an image generation on Sume? Only before it starts
Cancelling a Sume image job works only before generation work starts. After that the API returns 409 job_generation_already_started and the job runs and bills.
- Know the day Sume lists a new video model: a catalog check script
Vendors launch video models weekly. A short Python script reads GET /v1/videos/models and flags when an id or name appears, with exit codes for cron or CI.
- A circuit breaker for paid video API calls: cap, poll, cancel
Guard paid video generation with three layers: a per-run spend cap, a loop breaker in your code, and cancel. Sume charges for work done before a cancel.
- Claude Code 2.1.296: headless runs skip a switched-off MCP server
Claude Code 2.1.296 fixed claude -p starting a .mcp.json or plugin MCP server that was switched off. What that means for Sume's paid tools in CI.
Written by Sume