Skip to content
Tech News
← Back to articles

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

read original more articles
Why This Matters

This development introduces compile-time validation for model IDs and their capabilities within the OpenRouter ecosystem, enhancing reliability and reducing runtime errors for developers integrating AI models. By ensuring correctness during compilation, it streamlines the development process and improves overall system robustness.

Key Takeaways

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 ! ( "openai/gpt-5.4" , param :: tools , input :: image , output :: text , ) ;

Dynamic variants work too:

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

Capabilities

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

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

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

Errors at compile time

... continue reading