endofmodel 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. endofmodel-0.1.0/.gitignore +14 -0
  2. endofmodel-0.1.0/CHANGELOG.md +15 -0
  3. endofmodel-0.1.0/CONTRIBUTING.md +66 -0
  4. endofmodel-0.1.0/LICENSE +175 -0
  5. endofmodel-0.1.0/PKG-INFO +248 -0
  6. endofmodel-0.1.0/README.md +212 -0
  7. endofmodel-0.1.0/pyproject.toml +65 -0
  8. endofmodel-0.1.0/src/endofmodel/__init__.py +63 -0
  9. endofmodel-0.1.0/src/endofmodel/__main__.py +5 -0
  10. endofmodel-0.1.0/src/endofmodel/cli.py +179 -0
  11. endofmodel-0.1.0/src/endofmodel/core.py +119 -0
  12. endofmodel-0.1.0/src/endofmodel/data/anthropic.json +80 -0
  13. endofmodel-0.1.0/src/endofmodel/data/gemini.json +412 -0
  14. endofmodel-0.1.0/src/endofmodel/data/microsoft.json +18 -0
  15. endofmodel-0.1.0/src/endofmodel/data/mistral.json +18 -0
  16. endofmodel-0.1.0/src/endofmodel/data/moonshot.json +18 -0
  17. endofmodel-0.1.0/src/endofmodel/data/openai.json +763 -0
  18. endofmodel-0.1.0/src/endofmodel/data/openrouter.json +125 -0
  19. endofmodel-0.1.0/src/endofmodel/data/schema.json +42 -0
  20. endofmodel-0.1.0/src/endofmodel/data/upstage.json +18 -0
  21. endofmodel-0.1.0/src/endofmodel/data/zai.json +28 -0
  22. endofmodel-0.1.0/src/endofmodel/exceptions.py +41 -0
  23. endofmodel-0.1.0/src/endofmodel/guard.py +325 -0
  24. endofmodel-0.1.0/src/endofmodel/py.typed +0 -0
  25. endofmodel-0.1.0/src/endofmodel/registry.py +202 -0
  26. endofmodel-0.1.0/src/endofmodel/scan.py +157 -0
  27. endofmodel-0.1.0/tests/conftest.py +75 -0
  28. endofmodel-0.1.0/tests/test_core.py +94 -0
  29. endofmodel-0.1.0/tests/test_guard.py +230 -0
  30. endofmodel-0.1.0/tests/test_openrouter.py +169 -0
  31. endofmodel-0.1.0/tests/test_registry.py +35 -0
  32. endofmodel-0.1.0/tests/test_scan_cli.py +87 -0
  33. endofmodel-0.1.0/tests/test_sync_openrouter.py +225 -0
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .venv/
5
+ venv/
6
+ dist/
7
+ build/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .mypy_cache/
11
+ .coverage
12
+ htmlcov/
13
+ .env
14
+ .DS_Store
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (unreleased)
4
+
5
+ First release.
6
+
7
+ - Bundled registry for OpenAI (89 entries), Anthropic (9) and Gemini API (50), snapshot 2026-12-02.
8
+ - `check()`, `assert_models_ok()`.
9
+ - Runtime guard for httpx-based SDKs: `http_client()`, `async_http_client()`, `wrap()`.
10
+ - Silent-redirect detection (`ModelRedirectedWarning`).
11
+ - `translate_errors()` → `ModelRetiredError`.
12
+ - `on_event()` callbacks for custom alerting.
13
+ - `endofmodel check | scan | list` CLI with `--json` and a CI gate (`--fail-under-days`).
14
+ - Weekly OpenRouter sync (`scripts/sync_openrouter.py`, `sync-models.yml`) that opens registry PRs; adds Microsoft, Mistral, Moonshot, Upstage and Z.ai.
15
+ - OpenRouter schedule (`openrouter.json`): used for requests to `openrouter.ai`, `provider="openrouter"` and `openrouter/...` model IDs.
@@ -0,0 +1,66 @@
1
+ # Contributing to endofmodel
2
+
3
+ Thanks for helping! The registry is only as good as its data, so data fixes matter as much as code.
4
+
5
+ ## Update or add a model (most common)
6
+
7
+ 1. Open the provider's official deprecation page:
8
+ - OpenAI: https://developers.openai.com/api/docs/deprecations
9
+ - Anthropic: https://platform.claude.com/docs/en/about-claude/model-deprecations
10
+ - Gemini API: https://ai.google.dev/gemini-api/docs/deprecations
11
+ 2. Edit `src/endofmodel/data/<provider>.json`. Each entry looks like this:
12
+
13
+ ```json
14
+ {
15
+ "ids": ["gpt-4o-2024-08-06", "gpt-4o-2024-11-20"],
16
+ "deprecated_on": "2026-10-14",
17
+ "retires_on": "2027-01-14",
18
+ "replacement": "gpt-6-luna"
19
+ }
20
+ ```
21
+
22
+ - `ids`: every model ID or alias that shares this schedule.
23
+ - `retires_on`: the day calls stop working. Use `null` if not announced yet.
24
+ - `redirects_to`: add **only** if the provider says requests are automatically routed to another model.
25
+ - `notice_url` (optional): a link to the specific announcement, if it isn't the page in `source_url`.
26
+ 3. Update `snapshot_date` at the top of the file.
27
+ 4. Run `pytest`. The schema test catches typos and duplicate IDs.
28
+ 5. Open a PR and link the source in the description.
29
+
30
+ **Copy IDs and dates exactly from the official page.** Never use news articles or memory.
31
+
32
+ ## OpenRouter-synced providers
33
+
34
+ Files other than `openai.json`, `anthropic.json` and `gemini.json` are maintained by
35
+ `scripts/sync_openrouter.py`, which the weekly `sync-models.yml` workflow runs. You can still
36
+ edit them by hand: the sync only adds entries and updates `retires_on`, and it keeps
37
+ `replacement`, `deprecated_on`, `redirects_to`, `notes` and `notice_url`. Filling in
38
+ `replacement` is the most useful review step on a sync PR. Run it locally with:
39
+
40
+ ```bash
41
+ python scripts/sync_openrouter.py --dry-run
42
+ ```
43
+
44
+ ## Add a provider
45
+
46
+ Create `src/endofmodel/data/<provider>.json` with the same schema, add host and prefix mappings
47
+ in `registry.py` / `guard.py` if needed, and add tests.
48
+
49
+ ## Development
50
+
51
+ ```bash
52
+ git clone https://github.com/Agentdrops/endofmodel
53
+ cd endofmodel
54
+ python -m venv .venv && source .venv/bin/activate
55
+ pip install -e ".[dev]"
56
+ pytest
57
+ ruff check .
58
+ ```
59
+
60
+ Tests never call real APIs: they use `httpx.MockTransport`.
61
+
62
+ ## Ground rules
63
+
64
+ - The core stays dependency-free. Optional features go behind extras (`endofmodel[guard]`).
65
+ - Hooks must never raise exceptions into the user's SDK call (warnings only).
66
+ - Be kind. We follow the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
@@ -0,0 +1,175 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
@@ -0,0 +1,248 @@
1
+ Metadata-Version: 2.5
2
+ Name: endofmodel
3
+ Version: 0.1.0
4
+ Summary: Know before your LLM model dies: warnings, CI checks and silent-redirect detection for deprecated OpenAI, Anthropic and Gemini models.
5
+ Project-URL: Homepage, https://github.com/Agentdrops/endofmodel
6
+ Project-URL: Issues, https://github.com/Agentdrops/endofmodel/issues
7
+ Project-URL: Changelog, https://github.com/Agentdrops/endofmodel/blob/main/CHANGELOG.md
8
+ Author: endofmodel contributors
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: anthropic,claude,deprecation,gemini,llm,llmops,mlops,model-retirement,openai
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Libraries
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.9
26
+ Provides-Extra: dev
27
+ Requires-Dist: httpx>=0.23; extra == 'dev'
28
+ Requires-Dist: jsonschema>=4; extra == 'dev'
29
+ Requires-Dist: openai>=1.0; extra == 'dev'
30
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
31
+ Requires-Dist: pytest>=7; extra == 'dev'
32
+ Requires-Dist: ruff>=0.5; extra == 'dev'
33
+ Provides-Extra: guard
34
+ Requires-Dist: httpx>=0.23; extra == 'guard'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # endofmodel
38
+
39
+ **Know before your LLM model dies.**
40
+
41
+ LLM providers retire models all the time. When it happens, your app either starts
42
+ failing with a confusing `404 model_not_found`, or worse, keeps "working" while the
43
+ provider silently routes your requests to a different model. `endofmodel` tells you
44
+ **before** that happens, and explains it clearly when it does.
45
+
46
+ - ⚠️ **Runtime warnings**: every API call to a deprecated model logs a warning with the
47
+ retirement date, days left, and the recommended replacement.
48
+ - 🔀 **Silent-redirect detection**: flags when the model that answered is not the model you asked for.
49
+ - 💥 **Clear errors**: turns an opaque 404 from a retired model into `ModelRetiredError`.
50
+ - 🔍 **CI gate**: `endofmodel scan` finds model IDs in your code and fails the build
51
+ if any are retired or retiring soon.
52
+ - 📦 **Offline and free**: the registry ships inside the package. No API key, no network
53
+ calls, and no dependencies for the core.
54
+
55
+ Covers **OpenAI**, **Anthropic (Claude)** and **Google Gemini API** today.
56
+
57
+ ## Install
58
+
59
+ ```bash
60
+ pip install endofmodel # check / scan / CLI (zero dependencies)
61
+ pip install "endofmodel[guard]" # + runtime guard (httpx)
62
+ ```
63
+
64
+ ## 30-second tour
65
+
66
+ ```bash
67
+ $ endofmodel check gpt-4o-2024-05-13 claude-opus-4-5-20251101
68
+ gpt-4o-2024-05-13 (openai) was retired on 2026-10-23 and no longer works -> use gpt-5.6-sol [...]
69
+ claude-opus-4-5-20251101 (anthropic) is deprecated and retires on 2027-01-22 (51 days left) -> use claude-opus-5-5 [...]
70
+ ```
71
+
72
+ ### Warn on live API calls
73
+
74
+ ```python
75
+ from openai import OpenAI
76
+ import endofmodel
77
+
78
+ client = OpenAI(http_client=endofmodel.http_client())
79
+ client.chat.completions.create(model="gpt-4o-2024-08-06", messages=[...])
80
+ # DeprecatedModelWarning: endofmodel: gpt-4o-2024-08-06 (openai) is deprecated and
81
+ # retires on 2027-01-14 (43 days left) -> use gpt-6-luna [https://developers.openai.com/...]
82
+ ```
83
+
84
+ The same works for Anthropic, and for async clients:
85
+
86
+ ```python
87
+ from anthropic import Anthropic, AsyncAnthropic
88
+
89
+ client = Anthropic(http_client=endofmodel.http_client())
90
+ aclient = AsyncAnthropic(http_client=endofmodel.async_http_client())
91
+
92
+ # or attach to a client you already have:
93
+ endofmodel.wrap(existing_client)
94
+ ```
95
+
96
+ Each model is reported **once per process**, so your logs don't flood.
97
+
98
+ ### Get alerts where you'll see them
99
+
100
+ ```python
101
+ @endofmodel.on_event
102
+ def alert(event):
103
+ # event.kind: "deprecated" | "retired" | "redirected"
104
+ send_to_slack(event.message)
105
+ ```
106
+
107
+ ### Clear errors for retired models
108
+
109
+ ```python
110
+ with endofmodel.translate_errors():
111
+ client.chat.completions.create(model="gpt-4-0613", messages=[...])
112
+ # endofmodel.ModelRetiredError: gpt-4-0613 (openai) was retired on 2026-10-23
113
+ # and no longer works -> use gpt-5.6-sol
114
+ ```
115
+
116
+ ### Startup check
117
+
118
+ Models often live in `.env` files, databases or feature flags where no code scan can see them.
119
+ Check them when your service boots:
120
+
121
+ ```python
122
+ endofmodel.assert_models_ok(
123
+ [os.environ["CHAT_MODEL"], os.environ["EMBED_MODEL"]],
124
+ fail_under_days=14,
125
+ ) # raises ModelExpiringError if any are retired or retire within 14 days
126
+ ```
127
+
128
+ ### CI gate
129
+
130
+ ```bash
131
+ endofmodel scan ./src --fail-under-days 30
132
+ ```
133
+
134
+ ```
135
+ ✖ app/llm.py:12:15 gpt-4o-2024-05-13 retired 2026-10-23 -> gpt-5.6-sol
136
+ ! app/summarize.py:8:20 gpt-5-mini retires 2026-12-11 (9d) -> gpt-6.1-terra
137
+ · README.md:40:3 gpt-4 retired 2026-10-23 -> gpt-5.6-sol [docs]
138
+
139
+ 3 finding(s): 1 retired, 1 critical, 1 info
140
+ FAILED: retired models or models retiring within 30 days.
141
+ ```
142
+
143
+ Exit code is `1` when the gate fails, so CI blocks the merge. Mentions in `.md`/`.txt` files are
144
+ reported but never fail the build. GitHub Actions:
145
+
146
+ ```yaml
147
+ - run: pipx run endofmodel scan . --fail-under-days 30
148
+ ```
149
+
150
+ ### List what's retiring soon
151
+
152
+ ```bash
153
+ endofmodel list --upcoming 60
154
+ endofmodel list --provider anthropic --json
155
+ ```
156
+
157
+ ## How it works
158
+
159
+ ```
160
+ registry (JSON, shipped in the package)
161
+ │
162
+ check(model) ──► ModelStatus(status, retires_on, days_left, replacement, ...)
163
+ │
164
+ ┌──────┼───────────────┬──────────────────┐
165
+ runtime guard scan (CI) assert_models_ok
166
+ (httpx hooks) static search (startup)
167
+ │
168
+ warnings · logging · on_event callbacks
169
+ ```
170
+
171
+ The runtime guard hooks into **httpx**, the HTTP library the OpenAI and Anthropic SDKs use,
172
+ instead of patching SDK methods. That way it keeps working when the SDKs change. Hooks never
173
+ raise exceptions inside the SDK; they only warn, log and emit events.
174
+
175
+ **Silent redirects.** After a successful non-streaming call, the guard compares the model you
176
+ requested with the model reported in the response (`model` for OpenAI/Anthropic, `modelVersion`
177
+ for Gemini). Dated snapshots (`gpt-4o` → `gpt-4o-2024-08-06`) and `*-latest` aliases are not
178
+ treated as redirects.
179
+
180
+ ## The registry
181
+
182
+ Data lives in [`src/endofmodel/data/`](src/endofmodel/data), one JSON file per provider,
183
+ validated against [`schema.json`](src/endofmodel/data/schema.json). Each entry records the
184
+ model IDs, deprecation date, retirement date, replacement, and (when the provider says so) the
185
+ model requests get redirected to.
186
+
187
+ OpenAI, Anthropic and Gemini are curated by hand from the official deprecation pages. Other
188
+ providers (Mistral, Z.ai, Moonshot, Microsoft, Upstage, …) are generated from the
189
+ [OpenRouter models API](https://openrouter.ai/api/v1/models): a weekly GitHub Action
190
+ ([`sync-models.yml`](.github/workflows/sync-models.yml)) runs
191
+ [`scripts/sync_openrouter.py`](scripts/sync_openrouter.py) and opens a PR with new or changed
192
+ retirement dates. It never edits the hand-curated files; it lists where they disagree with
193
+ OpenRouter in the PR description instead. Generated entries accept both the bare ID
194
+ (`glm-4.5`) and the OpenRouter ID (`z-ai/glm-4.5`).
195
+
196
+ ### Calling models through OpenRouter
197
+
198
+ OpenRouter can stop serving a model on a different day than its author, and some variants
199
+ (like `openai/gpt-5-image`) only exist there. `openrouter.json` tracks OpenRouter's own
200
+ schedule. You get it when:
201
+
202
+ - the runtime guard sees a request to `openrouter.ai` (point the OpenAI SDK's `base_url` at
203
+ OpenRouter and pass `http_client=endofmodel.http_client()` as usual);
204
+ - you pass `provider="openrouter"` (`check("openai/gpt-5", provider="openrouter")`, or
205
+ `endofmodel check openai/gpt-5 --provider openrouter`);
206
+ - the model uses the LiteLLM form `openrouter/openai/gpt-5`.
207
+
208
+ ```text
209
+ $ endofmodel check openai/gpt-5 --provider openrouter
210
+ openai/gpt-5 (via OpenRouter) is deprecated and retires on 2026-12-11 (9 days left) -> use gpt-6.2-sol [https://openrouter.ai/openai/gpt-5]
211
+ ```
212
+
213
+ If OpenRouter has no date for a model, the author's schedule applies. OpenRouter's IDs don't
214
+ always match the author's: Anthropic IDs are matched through derived aliases
215
+ (`claude-opus-4-5-20251101` also answers to `claude-opus-4-5` and OpenRouter's
216
+ `claude-opus-4.5`), and OpenAI and Gemini IDs match after removing the prefix. Other
217
+ OpenRouter-sourced providers (`mistral.json`, `zai.json`, …) use OpenRouter's spelling for the
218
+ bare ID, which may not equal the provider's native API ID. Replacements come from
219
+ the author's entry, because OpenRouter doesn't publish them. Without a provider hint,
220
+ `openai/gpt-5` means OpenAI's own schedule; IDs only OpenRouter knows are still found.
221
+
222
+ To use fresher or private data without waiting for a release, point `ENDOFMODEL_REGISTRY_DIR`
223
+ at a folder of JSON files in the same format. Entries there override the bundled ones.
224
+
225
+ > **Disclaimer:** dates come from the providers' public deprecation pages and can change.
226
+ > Always confirm against the linked notice before migrating. Dates for OpenRouter-sourced
227
+ > providers are when OpenRouter stops serving the model, which can differ from the provider's
228
+ > own API. Platforms like Azure OpenAI,
229
+ > Amazon Bedrock and Vertex AI run their own retirement schedules, which this release does not
230
+ > cover yet.
231
+
232
+ ## Roadmap
233
+
234
+ - [x] v0.1: registry (OpenAI, Anthropic, Gemini), `check`, runtime guard, redirect detection, `scan`, CLI
235
+ - [x] v0.2: weekly GitHub Action that syncs expiry dates from OpenRouter and opens registry PRs
236
+ - [ ] v0.2: scrape official provider deprecation pages for OpenAI / Anthropic / Gemini
237
+ - [ ] v0.3: Azure OpenAI, Amazon Bedrock, Vertex AI, Groq
238
+ - [ ] v0.4: google-genai SDK adapter, LangChain / LiteLLM callbacks, Slack & OpenTelemetry notifiers
239
+ - [ ] v0.5: optional `endofmodel update` to fetch the latest registry (cached)
240
+
241
+ ## Contributing
242
+
243
+ Updating a date or adding a model is the most valuable contribution, and it only takes a
244
+ JSON edit. See [CONTRIBUTING.md](CONTRIBUTING.md).
245
+
246
+ ## License
247
+
248
+ [Apache-2.0](LICENSE). Free for personal and commercial use.