Skip to content

[2/2] feat: report whether the calling account can use each generation model - #142

Merged
dazzatronus merged 1 commit into
mainfrom
derk/model-availability
Sep 25, 2026
Merged

dazzatronus merged 1 commit into
mainfrom
derk/model-availability

Conversation

@dazzatronus

@dazzatronus dazzatronus commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

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 available boolean and an unavailableReason enum on GenerationModel, plus a line on the list endpoint telling clients to offer only available models.

available is 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 build and pnpm test pass on Node 22. Live /models, /models?expand=options and /models/{id} responses carrying available parse; so does an unavailable model with AiCapabilityNotIncluded and one with availability omitted. An unknown unavailableReason is rejected.

Stack

Order PR Adds Why separate
1 #141 Declares name and description Corrects the spec to the current response
2 #142 current Adds available and unavailableReason New field clients will rely on; revertible alone

Merge bottom-up: #141 into main, then retarget #142 to main.

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"]
Loading

Rules: available and unavailableReason, list endpoint guidance.

@dazzatronus
dazzatronus added this pull request to stack #143 September 25, 2026 10:48
Base automatically changed from derk/model-display-fields to main September 25, 2026 10:48
@dazzatronus
dazzatronus force-pushed the derk/model-availability branch from 478460e to 96947a7 Compare September 25, 2026 10:48
@dazzatronus
dazzatronus merged commit cedac2e into main Sep 25, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.19.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@dazzatronus
dazzatronus deleted the derk/model-availability branch September 25, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant