[2/2] feat: report whether the calling account can use each generation model - #142
Merged
Merged
Conversation
dazzatronus
force-pushed
the
derk/model-availability
branch
from
September 25, 2026 10:48
478460e to
96947a7
Compare
|
🎉 This PR is included in version 1.19.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Most models are now plan-gated, so a client that offers every model sends users to a 403. The models endpoints can report, per calling API key, which models the account's plan can use. This documents that: an optional
availableboolean and anunavailableReasonenum onGenerationModel, plus a line on the list endpoint telling clients to offer only available models.availableis optional on purpose. When the account can't be checked the API omits it, and the description tells clients to treat a missing value as unknown, not as available. Generation requests are checked either way.Verify:
pnpm buildandpnpm testpass on Node 22. Live/models,/models?expand=optionsand/models/{id}responses carryingavailableparse; so does an unavailable model withAiCapabilityNotIncludedand one with availability omitted. An unknownunavailableReasonis rejected.Stack
nameanddescriptionavailableandunavailableReasonMerge bottom-up: #141 into
main, then retarget #142 tomain.flowchart LR A["Client lists generation models<br/>with its API key"] --> B{"Account's plan includes<br/>this kind of generation?"} B -- yes --> C["available: true"] B -- no --> D["available: false<br/>+ unavailableReason"] B -- "can't confirm" --> E["available omitted"] C --> F["Offer the model"] D --> G["Hide or disable the model"] E --> H["Treat as unknown;<br/>generation is still checked"]Rules:
availableandunavailableReason, list endpoint guidance.