Skip to content

feat: list the models a provider accepts (GET /v1/models) - #13

Draft
simonx1 wants to merge 1 commit into
obie:mainfrom
simonx1:feat/list-models-endpoint
Draft

simonx1 wants to merge 1 commit into
obie:mainfrom
simonx1:feat/list-models-endpoint

Conversation

@simonx1

@simonx1 simonx1 commented Sep 18, 2026

Copy link
Copy Markdown

Typesafe documents GET /v1/models, and both official SDKs expose it. This client had no way to reach it, so the only way to find out which names the model field takes was to read the docs and hardcode one — and an alias moves when a release ships, which is the thing a list is for.

client = RubyDecisionModel::Client.new(provider: :typesafe)
client.models
# => [#<data ModelCard name="jev-latest", description="...", release_date="2026-02-11">, ...]

ModelCard is name, description, release_date. A provider says whether it has a list at all by declaring models_path, and OpenRouter does not — its /models is the whole gateway catalogue under api/v1, a different base than the api/alpha decisions endpoint, so it raises ConfigurationError rather than composing a URL that means something else.

This is the first request that isn't a POST, so the transport contract grows an optional method: keyword alongside the existing three. A transport that doesn't declare it keeps being called exactly as before, and asking it to list models raises rather than quietly POSTing to the list endpoint.

Listing goes through the same retry loop and the same error classes as asking.

Tests

test/models_test.rb, 14 cases.


Draft: part of a security and API-coverage audit, opened for reference rather than as a request for immediate review. Independent of the other branches, each off main. Suite green on Ruby 3.2.11, 3.3.8 and 3.4.8.

🤖 Generated with Claude Code

Typesafe documents GET /v1/models, and both official SDKs expose it. This
client had no way to reach it, so the only way to find out which names the
`model` field takes was to read the docs and hardcode one -- and an alias
moves when a release ships, which is the thing a list is for.

Client#models returns ModelCards: name, description, release_date. A
provider says whether it has a list at all by declaring models_path, and
OpenRouter does not -- its /models is the whole gateway catalogue under a
different base than the alpha decisions endpoint, so it raises rather than
composing a URL that means something else.

This is the first request that is not a POST, so the transport contract
grows an optional `method:` keyword alongside the existing three. A
transport that does not declare it keeps being called exactly as before,
and asking it to list models raises ConfigurationError rather than
quietly POSTing to the list endpoint.

Listing goes through the same retry loop and the same error classes as
asking does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant