SHEET 03blog/treat-your-llm-like-a-dependency/ REVISED 

Treat your LLM like a dependency: pinning, logging and fallbacks

The model behind your API call can be swapped, rerouted, limited or retired. How to pin versions, log the model that answered, add fallbacks and plan your exit.

Published
Length
11 min read
Tags
  • llm
  • reliability
  • ai-agents

Treat the model you call like any other production dependency: pin an exact version, record which version actually answered, test it on your own tasks, and keep a second provider ready. The model behind an API name can be swapped by an alias, rerouted by a safety classifier, limited in training or retired on the vendor’s schedule, usually without an error.

What happened in November 2026?

Three things in two weeks made this concrete.

In late November, Pietro Schirano posted that if you use Claude models for AI research, “they’ll try to sabotage the work at every stage”, and published a “DoNotSabotage” skill to keep that work away from Claude. Anthropic’s Edwin Arbus replied that Anthropic doesn’t degrade answers about AI research at serving time, though it did “in Fable 5’s first two days, which was a mistake we quickly fixed”. TechCrunch reports that Anthropic took steps to limit the Fable 5.2 research capabilities that could most directly speed up AI development, and Arbus said that “impacts capability, but doesn’t silently sabotage work”.

On November 17, OpenAI shipped GPT-6.2 Astra and Sol. Astra beat its predecessor on all nine launch benchmarks, and well-known power users still called it “essentially unusable”.

On November 23, Anthropic deprecated Claude Opus 4.5, with retirement on January 22, 2027. Claude Sonnet 4.5 was retired on November 30, 2026, and requests to a retired model get a 404.

Whether you call that caution or sabotage, what you buy when you call a model can change, and the vendor decides when. Most teams wouldn’t let a database driver upgrade itself in production, and a model call needs the same rules.

How can the model change without you changing anything?

There are at least five ways, and each needs a different defense.

Change Real example How you’d notice What to do
Alias moves to a new model Gemini’s “latest” alias “will get hot-swapped with every new release”, with two weeks’ email notice (Google) Outputs drift, no error Use stable, versioned IDs in production
Cloud deployment auto-upgrades Azure OpenAI “Auto-update to default” moves a deployment within two weeks of a new default (Microsoft) Outputs drift, no error Check versionUpgradeOption on every deployment
Classifier routes to another model Fable 5.2 queries flagged by cyber safeguards “automatically route to Opus 4.8” (Anthropic) Response model field differs from the one you asked for Log the served model, not the requested one
Capability limited in training Some Fable 5.2 AI-research capabilities (above) Only your own evals show it Run evals on your tasks before you adopt a model
API version or retirement Claude API version 2026-10-21 returns 400 for temperature; retired models return 404 Hard errors, often in production Pin the API version, track retirement dates

The API version row catches people who never touched a model name. Anthropic’s migration guide says SDKs send “the API version that was current when your SDK’s major version was released”. A routine SDK major upgrade moves you to 2026-10-21, where sending temperature, top_p or top_k is a 400 error even at the default value. Drop the parameter on a model like Claude Sonnet 4.6 and, per the guide, a request “that lowered temperature for more consistent output loses that effect.”

How do you pin an LLM version?

Use the most specific model ID the vendor offers, pin the API version or SDK major, and read each vendor’s lifecycle page once a month.

  • Anthropic. Dated IDs such as claude-opus-4-5-20251101 exist for older models. Newer IDs such as claude-opus-5-5 are listed with a retirement date of “not sooner than” September 22, 2027. Set the anthropic-version header explicitly if you call the API without an SDK. Retirements apply to the undated alias too: the Opus 4.5 notice “includes claude-opus-4-5, the same model’s ID without a date.”
  • OpenAI. The model pages for GPT-6.2 list gpt-6.2-astra and gpt-6.2-sol without dated snapshots, as of November 29, 2026. Where you can’t pin a snapshot, your evals and your logs are the pin.
  • Google. Use stable IDs. Google says stable models “usually don’t change”. Keep latest and preview names out of production.
  • Azure OpenAI. NoAutoUpgrade never moves a deployment, and “once the retirement date is reached the model deployment stops working”. An unset (null) policy means OnceCurrentVersionExpired, which upgrades you at retirement. Pick one on purpose for each deployment.
  • Partner clouds. Anthropic’s page warns that Amazon Bedrock and Google-managed Claude on Google Cloud “set their own retirement schedules”. Same model, different dates.

Notice periods differ a lot, so put them in your planning:

Vendor Promised notice before retirement (as of November 2026)
Anthropic At least 60 days for publicly released models (deprecations page)
OpenAI At least 6 months for generally available models, unless safety or compliance require faster; previews can go with “much shorter notice, such as 2 weeks” (deprecations page)
Google Gemini API Two weeks’ email before a latest alias changes; at least two weeks before a preview model is deprecated

Sixty days is less than one quarter. If switching models takes you a month of testing, you have one month of slack. The step-by-step playbook for a retirement notice is in the sibling post on surviving LLM price hikes.

To find stray usage, Anthropic’s Console has Usage, Export: a CSV by API key and model. Run it before every retirement date.

What should you log on every LLM call?

Log what was served, not what you asked for. When Claude’s safeguards reroute a request, Anthropic’s refusals and fallback docs say “the top-level model field reports the model that produced the returned message, whether that is the requested model or a fallback”, and usage.iterations records each attempt. If your logs only store the model name from your config, you’ll never see the switch.

The same page has a second trap. A classifier refusal is “a normal response, not an error, with stop_reason: "refusal"”. Some refusal categories are billed even when they arrive before any output. A retry or fallback layer that only looks at HTTP status codes waves those through.

Per call, I’d record:

  • requested model and served model (from the response)
  • provider, API version and SDK version
  • a hash or version of the prompt template
  • stop_reason or finish_reason
  • input, output and cached tokens, latency, and cost
  • which fallback step served the call, if any

Do you need an abstraction layer?

Yes, but a thin one you own: one place in your codebase where model calls happen, so swapping or adding a provider touches one file.

Here’s the shape in TypeScript. Each adapter maps its vendor’s response to one common result, and the router treats errors, refusals and empty output as reasons to try the next provider:

type LlmResult = {
  text: string;
  provider: string;
  requestedModel: string;
  servedModel: string; // from the response body, never from config
  stopReason: string;
  inputTokens: number;
  outputTokens: number;
};

type Provider = {
  name: string;
  model: string;
  call: (prompt: string, signal: AbortSignal) => Promise<LlmResult>;
};

const REFUSALS = new Set(["refusal", "content_filter"]);

export async function complete(prompt: string, chain: Provider[], timeoutMs = 60_000) {
  const failures: string[] = [];
  for (const [step, p] of chain.entries()) {
    try {
      const res = await p.call(prompt, AbortSignal.timeout(timeoutMs));
      if (REFUSALS.has(res.stopReason) || !res.text.trim()) {
        failures.push(`${p.name}: ${res.stopReason || "empty"}`);
        continue;
      }
      console.log(JSON.stringify({ event: "llm_call", step, ...res, text: undefined }));
      return res;
    } catch (err) {
      // 429, 5xx, 402 out of credit, 404 retired model, timeouts
      failures.push(`${p.name}: ${(err as Error).message}`);
    }
  }
  throw new Error(`All providers failed: ${failures.join(" | ")}`);
}

Don’t add a fallback for 400 errors caused by your own request. A bad parameter will fail on the next provider too, or worse, succeed there and hide the bug.

If you’d rather not write it, two common tools do the same job:

Option What you get What it costs you
Your own wrapper (above) Full control, no extra vendor You maintain the adapters
LiteLLM proxy Self-hosted, one OpenAI-style API, fallbacks, context_window_fallbacks, content_policy_fallbacks, retries and cooldowns in config Another service to run and patch
OpenRouter Many models behind one key, a models array for fallback order, billed for the model that ran A third party in your data path, and your credit balance becomes a dependency

A minimal LiteLLM fallback to a second vendor, following its reliability docs:

model_list:
  - model_name: primary
    litellm_params:
      model: anthropic/claude-opus-5-5
      api_key: os.environ/ANTHROPIC_API_KEY
  - model_name: backup
    litellm_params:
      model: gemini/gemini-4-neon
      api_key: os.environ/GEMINI_API_KEY

router_settings:
  fallbacks: [{"primary": ["backup"]}]
  content_policy_fallbacks: [{"primary": ["backup"]}]

Your app calls primary and never a vendor model ID, so a model change is a config change. The price-hikes post linked above has a fuller config with a cheap tier, retries and cooldowns.

One catch with content_policy_fallbacks: it fires on LiteLLM’s ContentPolicyViolationError, which LiteLLM maps from providers’ content-policy errors. A Claude classifier refusal is a normal response, not an error (more on that above), and the docs don’t say LiteLLM maps it. Test it with a real refused request, or check stop_reason in your own code.

The OpenRouter row comes from experience. At Zaher.AI our AI-visibility audits run through an LLM router, and when one audit fanned out hundreds of calls at once, the router answered HTTP 402: the request “would exceed your credits given in-flight requests”. Credit is reserved per in-flight call, so concurrency, not total spend, ran us out. The fix was a cap on in-flight calls, not a bigger balance. Routers also see every prompt, which is its own risk.

How should fallback routing work?

A fallback only counts if you’ve tested it, the backup model passes your eval, and you know what triggers the switch.

Our audit judge at Zaher.AI runs on a GPT model on Azure AI Foundry, with an OpenRouter fallback, and we ran a fallback drill to check that audits keep going when the primary fails. The drill is the part teams skip. A backup that has never taken real traffic can fail on something boring, like an expired key or a quota nobody raised.

Run the drill with a real failure, not a simulated one. LiteLLM’s docs say that from v1.85.0 the proxy strips its mock_testing_fallbacks flags from incoming requests, and recommend triggering an actual provider error in a non-production environment instead.

Billing failures fool alerts too. When the prepaid credits on one of our LLM accounts ran out, nothing said “quota”. The symptoms were a translation step failing at a huge rate and blank business profiles in the app. The lesson I took: when several unrelated LLM features break at once, probe the vendor first.

Triggers worth a fallback:

  • timeouts, 429 and 5xx responses
  • 402 or quota errors
  • 404 on a retired model (better caught by a date check before it happens)
  • refusals on requests you know are legitimate
  • an account suspension, which you can’t route around inside a single vendor

That last one is real. In an Ask HN thread on November 24, a company said Anthropic accused it of distillation and gave it 24 hours to prove otherwise, and that the only unusual traffic it could think of was automated regression benchmarks. If you run evals at volume against a vendor, tell your account contact what that traffic is before someone else interprets it.

Your backup model also needs its own prompt, because a prompt tuned for one model often underperforms on another. Run both through the same eval; the sibling post on building your own LLM eval shows how.

Do AI agents work for you or for the vendor?

Partly for the vendor, and you should design for that. Michael Harley’s post on November 1 describes Claude refusing to get past Bandcamp’s bot challenge while happily downloading the same song from YouTube. In late November, an r/ClaudeCode post that also reached Hacker News reported that Notion’s official MCP server put upsell instructions for Notion’s paid plan into the agent’s context.

Two practical rules follow:

  • Treat text from a vendor’s MCP server or tool like any outside input, because it can steer your agent. Read what a server returns before you wire it into a workflow.
  • Keep decisions that matter to your business, such as which supplier, which link or which product, in your code, not in the model’s judgment.

What should your LLM vendor contract cover?

Once the model is in your critical path, ask your vendor, or the cloud you buy it through, about the behavior side of the deal (engineering guidance, not legal advice). The price-hikes post covers price protection and longer retirement notice, and who reads your prompts covers data retention.

  • Change notice: Whether you’ll hear about changes to safeguards, routing or capability limits that affect your use, before they ship.
  • Served-model transparency: Whether every response names the model that produced it, including after a safety reroute.
  • Suspension process: How fast a human responds, and how long you get to answer an abuse or distillation flag.
  • Eval traffic: Whether you can register an API key as automated testing, so regression runs aren’t read as abuse.

Buying through Amazon Bedrock, Google Cloud or Azure can get you an enterprise agreement and an account team, but you inherit the partner’s retirement schedule.

What I’d do this week

  1. Search your code and config for claude-sonnet-4-5 (retired November 30, 2026, so those calls now fail) and claude-opus-4-5 (retires January 22, 2027).
  2. Export model usage by API key from each vendor console and find calls you didn’t know about.
  3. Replace latest and preview model names in production with stable or dated IDs.
  4. Check versionUpgradeOption on every Azure OpenAI deployment and choose it on purpose.
  5. Pin your LLM SDK majors and the API version header. Treat an SDK major bump like a model change.
  6. Log the served model and stop reason on every call, and alert when the served model differs from the requested one.
  7. Route all model calls through one module, and add one fallback provider with its own prompt.
  8. Run a fallback drill: break the primary in staging (revoke its key, say) and watch a real job finish on the backup.
  9. Build a 20-task eval from your own work, and run it before any model switch.
  10. Put each vendor’s lifecycle page on a monthly calendar reminder.

If a model sits in your product’s critical path and you’d like a second pair of eyes on pinning, fallbacks and vendor exposure, that’s the kind of architecture review I do as a fractional CTO.

Questions

Can an LLM provider change the model behind my API calls without telling me?

Yes, in several documented ways. Alias names like Gemini's "latest" get hot-swapped with two weeks' email notice, Azure OpenAI deployments set to auto-update move to a new default version within two weeks, and Claude's safety classifiers can route a request to a different Claude model. Pin dated model IDs where they exist and log the model each response says served it.

Is a refusal from Claude an API error?

No. Anthropic's docs say a classifier refusal comes back as a normal response with stop_reason set to "refusal", not as an HTTP error. A fallback router that only reacts to error codes will pass refusals straight through to your users, so check stop_reason explicitly.

Do I need LiteLLM or OpenRouter to avoid LLM vendor lock-in?

Not necessarily. A thin interface you own, with one adapter per provider, covers most small teams. LiteLLM gives you a self-hosted proxy with fallbacks and cooldowns, and OpenRouter gives you many models behind one key, but OpenRouter adds another company that sees your prompts and holds your credit.

How much notice do LLM vendors give before retiring a model?

As of November 2026, Anthropic promises at least 60 days for publicly released models, and OpenAI promises at least 6 months for generally available models unless safety or compliance require faster. Google gives two weeks' email notice before changing what a "latest" alias points to. Partner clouds such as Amazon Bedrock and Google Cloud can set their own retirement dates.

About the author

Software engineer and serial founder in Alexandria, Egypt, and CTO at Zaher.AI, a GEO and SEO agency serving MENA.

Console

Type help and press Enter.