Show HN: Compile-time model-id validation with declared capability

yujonglee1 pts1 comments

GitHub - yujonglee/openrouter-toolkit · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

yujonglee

openrouter-toolkit

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>8 Commits<br>8 Commits

.github/workflows

.github/workflows

crates

crates

src

src

tests

tests

.gitignore

.gitignore

.oxfmtrc.json

.oxfmtrc.json

Cargo.lock

Cargo.lock

Cargo.toml

Cargo.toml

README.md

README.md

package.json

package.json

pnpm-lock.yaml

pnpm-lock.yaml

rust-toolchain.toml

rust-toolchain.toml

View all files

Repository files navigation

openrouter-toolkit

Compile-time checked OpenRouter model ids.

model_supports! validates a model id and its required capabilities against a vendored OpenRouter index, then expands to the model id string.

use openrouter_toolkit::model_supports;

const MODEL: &str = model_supports!(<br>"openai/gpt-5.4",<br>param::tools,<br>input::image,<br>output::text,<br>);

Dynamic variants work too:

const MODEL: &str = model_supports!("moonshotai/kimi-k2-0905:exacto", param::tools);

Capabilities

param::* — request parameters (e.g. param::tools)

input::* — input modalities (e.g. input::image)

output::* — output modalities (e.g. output::text)

Errors at compile time

Unknown capability:

const MODEL: &str = model_supports!("qwen/qwen3.7-max", param::toolz);

error: unknown OpenRouter capability `param::toolz`; did you mean `param::tools`?

Capability not supported by the model:

const MODEL: &str = model_supports!("qwen/qwen3.7-max", input::image);

error: OpenRouter model `qwen/qwen3.7-max` does not support required capability(s): input::image

About

No description, website, or topics provided.

Resources

Readme

Uh oh!

There was an error while loading. Please reload this page.

Activity

Stars

stars

Watchers

watching

Forks

forks

Report repository

Releases

No releases published

Packages

Uh oh!

There was an error while loading. Please reload this page.

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

Rust<br>100.0%

You can’t perform that action at this time.

model openrouter input param reload model_supports

Related Articles