Dev.to AI 🤖 Ai 👁 0 📖 6 min read

Your Code Never Names a Model. It Still Calls a Retired One.

Here are two lines of perfectly normal LangChain code: const llm = new ChatOpenAI(); const claude = new ChatAnthropic(); No model ID anywhere. Nothing to grep for. With the latest packages on npm today, the firs

Here are two lines of perfectly normal LangChain code:

const llm = new ChatOpenAI();
const claude = new ChatAnthropic();

No model ID anywhere. Nothing to grep for. With the latest packages on npm today, the first one sends gpt-3.5-turbo, which OpenAI retired on October 23, 2026. The second sends claude-sonnet-4-5-20250929, which retires on November 30.

I build Since, a tool whose entire job is telling you when a model your code calls is about to stop working. Until this week it would have looked at those two lines and said nothing. This is the story of how we noticed, the fix that worked, and the fix that worked for exactly one day.

1. What we assumed

Since reads model retirement dates from the providers, then finds where your code uses those models. The second half was the part we were proud of. We follow constants, aliases, barrels and re-exports, inherited members, clients built by factories. If a model ID is written somewhere in your repo, we find the line.

The quiet assumption in that sentence: written somewhere in your repo.

Every model change we tracked was matched against IDs that appeared in the user's own code. That works great right up until the code doesn't write one, because a library picked it for you.

2. Where the model actually lives

LangChain's ChatOpenAI class declares a default model as a field. Its constructor reads, roughly:

this.model = fields?.model ?? fields?.modelName ?? this.model;

So if you pass nothing, you get whatever the class declares. In @langchain/openai 1.8.4, the latest version on npm when I checked this morning, that is gpt-3.5-turbo.

I didn't believe it until I ran it. In a fresh folder:

npm init -y
npm i @langchain/[email protected] @langchain/[email protected]
// defaults.mjs
import { ChatOpenAI } from "@langchain/openai";
import { ChatAnthropic } from "@langchain/anthropic";

const openai = new ChatOpenAI({ apiKey: "not-a-real-key" });
const anthropic = new ChatAnthropic({ apiKey: "not-a-real-key" });

console.log("ChatOpenAI sends:   ", openai.model);
console.log("ChatAnthropic sends:", anthropic.model);
$ node defaults.mjs
ChatOpenAI sends:    gpt-3.5-turbo
ChatAnthropic sends: claude-sonnet-4-5-20250929

(Node 24, run today. No request is sent, it just reads the field.)

Here is the uncomfortable part. Since already had LangChain's source in hand. We saw gpt-3.5-turbo sitting in the package. We just never connected "this ID is in a dependency" to "this call in your code sends it", because the call in your code is empty.

To be fair to LangChain: a default has to be something, and every library with a default model has this problem eventually. The Python packages we checked, langchain-openai 1.8.3 and langchain-anthropic 1.7.11, have no default at all, and the Anthropic one makes model required. Which, honestly, is the kindest default there is.

3. The first fix: read the dependency like code

We already read packages release by release to find their breaking changes. So the fix was to also read a package's own source files (parse them, never run them) and write down, per version, every class or function whose model is a default a caller can override.

The rule we held ourselves to: only record a default where the code shows how it's set. Which keys does the constructor read on the way to the field? Does it go through super()? Through a helper that builds the arguments? A Python field with an alias, like model_name: str = Field(default="gpt-3.5-turbo", alias="model")? If we can't see the path, we don't claim a default.

Then every call in your code gets one question: does this call set the model?

What your code writes Does it send the default?
new ChatOpenAI() Yes
new ChatOpenAI({ temperature: 0 }) Yes, no model key
new ChatOpenAI({ model: "gpt-5.6-terra" }) No
new ChatOpenAI({ modelName: process.env.MODEL }) No, it sets one
new ChatOpenAI(config) Can't tell from the text, so it gets read more closely

Two details turned out to matter more than the parsing.

A default belongs to a version. Older @langchain/anthropic 0.2.14 sends claude-2.1. So the answer to "what does new ChatAnthropic() call?" depends on what your lockfile resolves, and we read it at exactly that version.

A default belongs to a platform. AzureChatOpenAI is Azure's. OpenAI's retirement date doesn't apply to it, and a cloud's dates can be months apart from the provider's own (claude-sonnet-4-5 leaves the Claude API on November 30 and Amazon Bedrock on April 8, 2027). Getting that wrong means warning people about the wrong day.

We ran it on a real public RAG starter on GitHub. It found new ChatOpenAI() and new ChatAnthropic() on lines 9 and 10, sending gpt-3.5-turbo and claude-2.1. Neither call names a model.

We shipped it on November 19. I was pleased with myself for about a day.

4. The fix that worked for one day

The next public repo we tried didn't import from @langchain/openai. It did this:

import { ChatOpenAI } from "langchain/chat_models/openai";

const chat = new ChatOpenAI();

Same class. Different door. langchain 0.1.28 imports ChatOpenAI from @langchain/openai and exports it again under its own path. We keyed the call by the package it was imported from (langchain), and the default lived on the other package (@langchain/openai). Nobody met in the middle, so: silence. Again.

Re-exports are everywhere once you look. ES export { A } from, export *, CommonJS getters that TypeScript emits, Python's __all__, and Python's favorite trick, a module-level __getattr__ that hands you another package's class when you ask for it. The old Python langchain 0.1 does exactly that.

So the second fix records what a package passes on from the packages it declares as dependencies, and follows that chain up to three packages away. A call only counts when every package along the way is resolved at the version we read. Otherwise we'd be guessing, and a guess about a retired model is just a scarier way of being wrong.

The funniest number from this round: langchain-community 0.0.38 has 580 classes built on base classes that never carry a model at all. Recording a rule for each would have been 580 rows that nothing ever reaches. We skip a subclass unless its base can actually carry a model.

That went live today. The report now says the whole chain out loud: "Creates ChatOpenAI without modelName, so @langchain/openai 0.0.22 sends its default model, gpt-3.5-turbo. langchain 0.1.28 exports ChatOpenAI from @langchain/openai."

5. What the fix pull request does

When Since opens a fix for one of these, it doesn't bump LangChain. It sets model in the call. A model retirement has no version to move to: the newest @langchain/openai on npm still defaults to the retired ID. The only fix that's actually a fix is writing down the model you meant.

What I'd tell myself before

We worked hard to find a model ID no matter where it hid in your repo. Constants, aliases, wrappers, factories. The blind spot was never a clever hiding place. It was the ID that isn't in your repo at all.

The general version: any check that searches your code for a value will miss the value your dependencies pick for you. Timeouts, regions, API versions, retry counts, models. The default is a decision. Somebody else made it, and nobody wrote it down in your project.

If you want to see yours, run the snippet above against whatever versions your lockfile says. It takes about a minute.

What's the worst default a library ever picked for you without asking?

I'm Nabil. I build Since, which tracks what your code depends on and tells you before it breaks.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.