Skip to main content

Module openrouter_catalog

Module openrouter_catalog 

Source
Expand description

Cross-vendor model catalog via OpenRouter’s public /api/v1/models endpoint.

Fallback for compat providers that don’t have a models.dev entry and can’t reach their native /models endpoint without a credential. Each OpenRouter model id is <vendor>/<slug>; we filter by vendor prefix (e.g. x-ai/ for xAI, tencent/ for Hunyuan) and return the slug list.

Cached once per process (OnceCell) and shared across all callers.

Functions§

list_models_for_vendor
Return the slug portion of every OpenRouter model id whose vendor prefix matches vendor_prefix. The vendor prefix is the segment before / in the id (e.g. x-ai, tencent, rekaai). The returned slugs are sorted and deduplicated.