Clatter LabsHelp Center

How do I update Python code that used a Line Code model?

How-toUpdated

Line Code ids stopped working on Nov 1, 2026. Swap the id and catch 410 so an old config can't break silently.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.gateway.clatterlabs.xyz/v1",
    api_key=os.environ["CLATTER_API_KEY"],
    default_headers={"X-Clatter-Account": os.environ["CLATTER_ACCOUNT_ID"]},
)
import openai

REPLACE = {
    "line-code-fast": "supercosmos-flash",
    "line-code-ultra": "supercosmos-max",
    "line-code-ultra-fast": "supercosmos-heavy",
    "line-code": "supercosmos",
}
model = REPLACE.get(configured_model, configured_model)
try:
    r = client.chat.completions.create(model=model, messages=msgs)
except openai.APIStatusError as e:
    if e.status_code == 410:
        raise SystemExit("Retired model id in config: " + configured_model)
    raise

410 responses are never billed. Prices differ from Line Code; see prices.

The client setup above (base URL, key and the X-Clatter-Account header) is the same in every Python example; see Set up the Python SDK. Full parameter list: Create a chat completion.

Good to know#

  • Every call shows in Console › Logs and Usage as Model API, with its price. See what you spent
  • New accounts get $5 of free credit; top up from $1 to $800 per purchase in Console › Billing › Credits. Billing
  • Keep keys on your server, never in a browser or mobile app. Why

Still need help?#

We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Related articles

Still need help?

Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyz
For deleting your whole account or the data of one service.