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.

5 min readSume
All posts

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 body of createImage, 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 are string at compile time.
  • Runtime backstop: an unknown id returns 404 model_not_found from 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

All Developers posts

Written by Sume