Skip to main content

endofmodel: know before your LLM model dies

PyPI Python versions CI GitHub Marketplace License

Quickstart · Usage guide · CI gate · Examples · Changelog

Providers retire LLM models all the time. When it happens, your app either fails with a confusing 404 model_not_found, or keeps "working" while the provider quietly answers with a different model. endofmodel warns you before that happens and tells you what to switch to.

  • ⚠️ Warns on live calls to deprecated models: retirement date, days left, replacement.
  • 🔀 Catches silent redirects: the model that answered isn't the one you asked for.
  • 🔍 Blocks retired models in CI: PR annotations, SARIF, or a pre-commit hook.
  • 📦 Works offline: the data ships inside the package. No API key, no network calls.
  • 🧩 Fits your stack: OpenAI and Anthropic SDKs, LiteLLM, LangChain, OpenRouter.

endofmodel catches old model IDs at four points: on commit, in pull requests, at startup and on every live API call, all from one built-in registry

Contents

Quickstart

pip install endofmodel

Ask about any model ID:

endofmodel check gpt-4o-2024-05-13

Find every outdated model ID in your project (exit code 1 if something must change):

endofmodel scan .

Get a warning on every live call to a deprecated model:

from openai import OpenAI
import endofmodel

client = OpenAI(http_client=endofmodel.http_client())  # pip install "endofmodel[guard]"

That's the whole setup. The rest of this page goes through each feature in detail.

Usage guide

Install

Command What you get
pip install endofmodel check, scan, startup checks, CLI. No dependencies.
pip install "endofmodel[guard]" + warnings on live OpenAI / Anthropic SDK calls
pip install "endofmodel[litellm]" + LiteLLM callback
pip install "endofmodel[langchain]" + LangChain callback

Python 3.10 or newer.

1. Check a model

From the terminal:

endofmodel check output: gpt-4o-2024-05-13 is retired, use gpt-5.6-sol; claude-opus-4-5-20251101 is deprecated and retires 2027-01-22, use claude-opus-5-5; gpt-6-luna has no deprecation announced
endofmodel check gpt-5-mini claude-opus-4-5     # several at once; aliases work
endofmodel check anthropic/claude-opus-4.5 --provider openrouter
endofmodel list --upcoming 30                    # everything retiring in the next 30 days
endofmodel list --provider anthropic --json      # machine-readable

From Python:

import endofmodel

s = endofmodel.check("gpt-5-mini")
s.status  # Status.DEPRECATED  (also ACTIVE, RETIRED, REDIRECTED)
s.retires_on  # datetime.date(2026, 12, 11)
s.days_left  # 8
s.replacement  # 'gpt-6.1-terra'
s.notice_url  # the provider's official deprecation notice
s.describe()  # one human-readable sentence, as printed by the CLI

A model that isn't in the registry comes back as ACTIVE: nothing has been announced for it.

2. Warn on live API calls

endofmodel only watches traffic. It never changes, delays or blocks a request. Each warning is logged once per model per process.

Warnings printed by an app using endofmodel: gpt-5-mini is deprecated and retires on 2026-12-11, use gpt-6.1-terra; requested gpt-4o but the provider answered with gpt-6.1-terra

OpenAI and Anthropic SDKs. Pass endofmodel's HTTP client when you create the client:

from openai import OpenAI, AsyncOpenAI
from anthropic import Anthropic
import endofmodel

client = OpenAI(http_client=endofmodel.http_client())
client = Anthropic(http_client=endofmodel.http_client())
client = AsyncOpenAI(http_client=endofmodel.async_http_client())  # async clients

client = endofmodel.wrap(OpenAI())  # or attach to a client that already exists

You get three kinds of warning:

Warning When
DeprecatedModelWarning You call a model that has a retirement date.
RetiredModelWarning You call a model whose retirement date has passed.
ModelRedirectedWarning The response came from a different model than the one you asked for.

LiteLLM. LiteLLM makes the HTTP calls itself, so register the callback instead:

from endofmodel.integrations.litellm import install

install()  # every litellm.completion() / acompletion() / Router call is now checked

LangChain. Add the callback handler to a model, a single call, or a whole chain:

from langchain_openai import ChatOpenAI
from endofmodel.integrations.langchain import EndOfModelCallbackHandler

llm = ChatOpenAI(model="gpt-5-mini", callbacks=[EndOfModelCallbackHandler()])
chain.invoke(inputs, config={"callbacks": [EndOfModelCallbackHandler()]})

OpenRouter. OpenRouter can retire a model on a different day than its author, so it has its own data. It's used automatically for calls to openrouter.ai, for provider="openrouter", and for LiteLLM-style IDs like openrouter/openai/gpt-5:

client = OpenAI(base_url="https://openrouter.ai/api/v1", http_client=endofmodel.http_client())

3. Refuse to start with a dying model

Check the models in your config when the app boots, so a deploy fails loudly instead of production failing quietly:

import os
import endofmodel

endofmodel.assert_models_ok(
    [os.environ["CHAT_MODEL"], os.environ["SUMMARY_MODEL"]],
    fail_under_days=14,  # also fail if a model retires within 14 days
)
# raises ModelExpiringError listing each problem and its replacement

4. Send alerts and get clear errors

Alerts. Send every warning where your team will see it (Slack, Sentry, metrics...):

@endofmodel.on_event
def alert(event):  # event.kind: "deprecated" | "retired" | "redirected"
    send_to_slack(event.message)

Clear errors. A retired model usually fails with a vague 404. Turn it into an error that says what happened and what to use instead:

with endofmodel.translate_errors():
    client.chat.completions.create(model="gpt-4-0613", messages=[...])
# ModelRetiredError: gpt-4-0613 (openai) was retired on ... -> use gpt-5.6-sol

CI gate

endofmodel scan finds model IDs in your code and config, and exits with code 1 if any are retired or retire within --fail-under-days (default 30).

endofmodel scan output: app.py line 2 uses retired gpt-4o-2024-05-13; app.py line 3 uses claude-opus-4-5-20251101, retiring 2027-01-22; NOTES.md mentions gpt-4o-2024-05-13 in docs; scan failed with exit code 1
Mark Meaning Fails the build?
✖ Retired, or retires within --fail-under-days yes
~ Deprecated, retires later no
· Mentioned in docs (.md, .txt) never

It scans Python, JS/TS, Go, Ruby, Java, Kotlin, Rust, C#, PHP, shell, notebooks, and config files (.json, .yaml, .toml, .ini, .cfg, .env), and skips .git, node_modules and virtualenvs.

GitHub Action

Findings show up as comments on the exact lines of the pull request:

# .github/workflows/endofmodel.yml
name: endofmodel
on: [pull_request]

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: Agentdrops/endofmodel@v0.3.2
        with:
          fail-under-days: 30

To also get them as alerts in the Security → Code scanning tab, upload the SARIF report (public repos, or private repos with GitHub Advanced Security):

    permissions:
      contents: read
      security-events: write
    steps:
      - uses: actions/checkout@v4
      - uses: Agentdrops/endofmodel@v0.3.2
        with:
          upload-sarif: true
Input Default Description
path . Files or folders to scan, separated by spaces
fail-under-days 30 Fail if a model is retired or retires within this many days
fail-on-findings true Set to false to report without failing the job
annotations true Show findings as annotations on the PR diff
sarif-file endofmodel.sarif Where to write the SARIF report (empty to skip)
upload-sarif false Upload the report to GitHub code scanning
version (action's version) endofmodel version to install from PyPI
python-version 3.12 Python used to run endofmodel (your PATH is untouched)

Outputs: failed ("true"/"false"), findings (count), sarif-file (path). A summary of the scan is also added to the job summary page.

pre-commit

Stop a retired model before it's committed:

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/Agentdrops/endofmodel
    rev: v0.3.2
    hooks:
      - id: endofmodel
        # args: [--fail-under-days, "14"]

Other CI systems

The CLI works anywhere Python runs. Use the exit code to fail the job, and pick an output format for your tools:

pip install endofmodel
endofmodel scan .                                          # text, exit 1 on failure
endofmodel scan . --format sarif -o endofmodel.sarif      # SARIF 2.1.0 for code-review tools
endofmodel scan . --format json                            # for your own scripts

SARIF is the standard format that most code-scanning and review tools read.

Reference

CLI

Command Description
endofmodel check MODEL [MODEL...] Look up model IDs. --provider, --json
endofmodel list List the registry. --provider, --upcoming DAYS, --json
endofmodel scan [PATH...] Scan files/folders. --fail-under-days N, --format text|json|sarif|github, -o FILE
endofmodel --version Print the installed version

Exit codes for scan: 0 passed, 1 the gate failed, 2 usage error.

Python API

Function Use it to
check(model, provider=None) Get a ModelStatus for one model
assert_models_ok(models, fail_under_days=0) Raise ModelExpiringError if any model is retired or retiring soon
http_client() / async_http_client() Create an HTTP client that warns on live SDK calls
wrap(client) Attach the same warnings to an existing OpenAI/Anthropic client
on_event(fn) Run fn(event) on every new warning
translate_errors(model=None) Turn a retired model's 404 into ModelRetiredError
scan(path) Scan a file or folder from Python; returns findings

Configuration

Environment variable Effect
ENDOFMODEL_REGISTRY_DIR Use a folder of registry JSON files instead of the built-in data

Where the data comes from

The registry is a set of JSON files in src/endofmodel/data/, one per provider:

Provider Source
OpenAI, Anthropic, Gemini Copied by hand from each provider's official deprecation page
OpenRouter, Mistral, Z.ai, Moonshot, Microsoft, Upstage Synced every week from OpenRouter's public model list. A bot opens a PR and a human reviews it before merging.

Each entry links to the official notice, so you can always check the source.

FAQ

Does it send my prompts or model names anywhere? No. The data ships inside the package and every check runs locally. endofmodel makes no network calls of its own.

How do I get new deprecation dates? Upgrade the package: pip install -U endofmodel. To use your own or fresher data, point ENDOFMODEL_REGISTRY_DIR at a folder of JSON files in the same format.

Will it slow down my API calls? No. It reads the model name from the request and the response; the lookup is an in-memory dictionary. It never retries, delays or blocks a call.

A date is wrong, or a model is missing. Please open a PR: it's a one-line JSON edit. See CONTRIBUTING.md.

Azure OpenAI, Amazon Bedrock, Vertex AI? Not yet. They run their own retirement schedules, which are on the roadmap.

Dates can change. Confirm against the linked notice before you migrate.

More

Next up: Azure OpenAI, Bedrock and Vertex AI schedules; automatic scraping of the official deprecation pages; endofmodel update to fetch new data without upgrading.

License

Apache-2.0

Metadata

Release files for endofmodel 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for endofmodel 0.3.2
File Size Uploaded Provenance Actions
endofmodel-0.3.2.tar.gz 44.7 kB With provenance Details for endofmodel-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for endofmodel 0.3.2
File Interpreter ABI Platform Actions
endofmodel-0.3.2-py3-none-any.whl Python 3 none any Details for endofmodel-0.3.2-py3-none-any.whl

Total release size: 83.6 kB

Release files / endofmodel-0.3.2.tar.gz

Download URL endofmodel-0.3.2.tar.gz
Size 44.7 kB
Tags Source
SHA-256 checksum
How to use checksums
27a8bc49558d69a80655cfc443905d4533f218a339c2593f6d17fa6244b8c53a
BLAKE2b-256 checksum
How to use checksums
da49e997834441f24bae01650de8a19c7c603fc5b660a364a2a04a9f1319de67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Release files / endofmodel-0.3.2-py3-none-any.whl

Download URL endofmodel-0.3.2-py3-none-any.whl
Size 38.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee6a5a57fc2321ef102a56fa5a8efcf7dbf80e50e68aed97db8a07c243074aca
BLAKE2b-256 checksum
How to use checksums
e2a035b99e9a1c8a635b1108fc575b8ef0378534d4c233bdf029fcb0802e6f0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Security for endofmodel 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for endofmodel-0.3.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page