Model Filters
Last updated
How to list a provider's models and narrow them to text, speech, transcription, or image models.
Listing models
ids, err := openai.Models(ctx, llmrouter.Config{APIKey: key}, llmrouter.ModelFilter{TextOnly: true})
Flag rules
The four ModelFilter flags intersect. Marker-based providers apply these rules to model IDs:
| Flag | Rule |
|---|---|
TextOnly |
drops image, audio, video, embedding, and other non-chat models |
STTOnly |
keeps transcribe, whisper- markers |
TTSOnly |
keeps -tts, tts- markers |
ImageOnly |
keeps -image, image-, imagen-, imagine-, nano-banana markers and excludes -video, veo-, sora- |
ImageOnly excludes video deliberately: grok-imagine-video also matches the imagine- marker, and without the exclusion it would show up in an image-model picker as a model GenerateImage cannot use.
Provider support
Flag support differs per provider; an unsupported flag is ignored rather than rejected:
| Provider | TextOnly |
STTOnly |
TTSOnly |
ImageOnly |
Source |
|---|---|---|---|---|---|
openai, gemini, grok, grok-oauth |
✓ | ✓ | ✓ | ✓ | model-ID markers above |
openrouter |
✓ | ✓ | ✓ | ✓ | vendor catalogs: /api/v1/images/models, /api/v1/models?output_modalities=speech / transcription |
cloudflare |
✓ | ✓ | ✓ | — | Workers AI task name |
claude, copilot, deepseek, mistral, nvidia, ollama-cloud, codex |
✓ | — | — | — | model-ID markers above |
Related
- Model Filter Symbols:
ModelFilter,ModelInfo, classifier functions