OpenAI is shutting down GPT-4o, GPT-4o mini, GPT-4.1 and GPT-4.1 mini in the API on January 14, 2027. OpenAI's deprecations page lists gpt-6-luna as the recommended replacement.
Most guides say "just change the model name". I migrated 5 open-source projects this week, and in some of them, changing only the model name would have broken the app. Here's what I found.
1. tiktoken crashes on the new model name
If your app counts tokens (for example, to split long text into chunks), you might have this:
enc = tiktoken.encoding_for_model("gpt-4o-mini")
Change it to gpt-6-luna and it raises KeyError. I tested tiktoken 0.7.0 and 0.14.0, and neither knows the new name, so upgrading doesn't help.
A safe fix is to fall back to o200k_base, the encoding the old models used:
import tiktoken
def get_encoding(model: str):
try:
return tiktoken.encoding_for_model(model)
except KeyError:
return tiktoken.get_encoding("o200k_base")
Your chunk sizes stay the same, and once tiktoken learns the new name, the code uses it automatically.
2. Tool calls on Chat Completions need reasoning_effort: "none"
gpt-6-luna is a reasoning model. According to its model page, Chat Completions supports function calling only with reasoning_effort set to none.
So if your agent does this:
client.chat.completions.create(
model="gpt-6-luna",
messages=messages,
tools=tools,
)
your tool calls can fail. Add reasoning_effort="none":
client.chat.completions.create(
model="gpt-6-luna",
messages=messages,
tools=tools,
reasoning_effort="none",
)
On older versions of the openai Python library, you can pass it with extra_body={"reasoning_effort": "none"}.
In one project, four agents sent tools with no reasoning_effort. A plain model swap would have broken every tool call.
3. Bare model names point to dated snapshots
The deprecations page lists dated snapshots like gpt-4o-mini-2024-07-18. If your code uses the bare name gpt-4o-mini, it points to those snapshots, so it's affected too. Search for both.
4. Look beyond the obvious file
GitHub code search only shows the first match per repo. In one project, search showed 1 file, but the full repo had old model defaults in a router, Go agents, Rust agents, Python agents, config and docs. Search the whole repo, and check .env and config files too.
A tool to find these for you
I turned these checks into a small open-source CLI, luna-check. It scans Python, JS/TS and Go, and reports:
- retiring model IDs, with the shutdown date and replacement
-
tiktoken.encoding_for_model()calls that will crash - function tools sent on Chat Completions without
reasoning_effort: "none"
Every rule links to its source. It skips comments, tests and price tables to keep false positives low, and it's tested on the before/after code of 5 real migrations.
pip install git+https://github.com/prasadrandika/luna-check@v0.1.0
luna-check .
There's also a GitHub Action, so you can run it in CI.
Limits: it can't see model names that only come from environment variables or config, and I haven't tested it against the real API.
If you find a false positive or a case it misses, please open an issue. And if you'd like help migrating before January 14, feel free to reach out on GitHub.
I used AI assistance (Claude Code) for the migrations and the tool, and reviewed the results myself.
Top comments (0)