Sume TypeScript SDK createImage: a retired model id fails tsc
Sume's @sume-com/sdk lists accepted image model ids as a string union, so gpt-image-1 fails to compile. Use tsc as the migration checklist.

With @sume-com/sdk, a hard-coded "gpt-image-1" in a createImage body is a compile error, because the model field of the image request is a closed union of Sume ids and legacy aliases. That is useful during the OpenAI shutdown on October 23, 2026: bump the SDK, run tsc --noEmit, and every literal that still names a retired id lights up.
The union is generated from Sume's API contract, so confirm against the version you installed. An id held in a plain string variable skips the check, which is the one gap to close.
What the compiler catches and what it does not
- Catches: literal ids in the
bodyofcreateImage, such as"gpt-image-1","gpt-image-1.5"or"gemini-2.5-flash-image". - Does not catch: ids read from
process.env, a database or a JSON file. Those arestringat compile time. - Runtime backstop: an unknown id returns
404 model_not_foundfrom the API.
Client setup and a typed call
The SDK authenticates with an API key and needs the client passed on every call. The sample uses the Sunburst id; swap the literal for any id the union accepts.
import { createSumeClient, createImage } from "@sume-com/sdk";
const client = createSumeClient({ apiKey: process.env.SUME_API_KEY! });
export async function render(prompt: string) {
const res = await createImage({
client,
body: {
// model: "gpt-image-1", // tsc: not assignable to the model union
model: "openai/gpt-image-2.5-sunburst",
prompt,
},
});
if (res.response.status === 202) {
return { pending: true as const };
}
return { pending: false as const, body: res.data };
}Closing the string gap
For ids that come from config, check them at boot against listImageModels or against a short allowlist in the same file as the union type. The slower fix is a CI job that calls the models endpoint; see the catalog diff post. For a 202, hand the job id to waitForJob as shown in the 200 and 202 post.
Sources
Related posts
More in Developers
- TypeScript types for a Sume job status: narrow on sume_status
Type the Sume job envelope as a discriminated union on sume_status, so a switch covers queued to canceled and the compiler flags a missed case. Runs on Node 22.
- Unit test a transcription retry loop with a fake 429 in Python
Test your Sume STT retry code without calling the API: inject the POST and sleep, return a 429 with retry-after, and assert the same key is sent twice.
- Unity editor tool: generate an AI video clip with UnityWebRequest
A Unity coroutine posts a Wan 3.0 job to Sume, polls /v1/jobs/{id}/status with next_poll_after_seconds and downloads the MP4 with DownloadHandlerFile.
- Uptime monitor for the Sume API: probe GET /v1/me, spend reads
A 30 second probe of GET /v1/me costs two reads a minute against a 4,800 read Free budget. Python probe and a status table for 401, 429 and 5xx.
Written by Sume