Groq, OpenRouter & others
Every other provider is one prefix away. They all use the openai SDK (pip install "dyui[openai]") against the provider’s OpenAI-compatible endpoint, so switching is a change of model string and key. The full table of prefixes, endpoints, key variables and base-URL overrides is on Models & providers, and where to get each key is on API keys & environment.
The model id may itself contain slashes. Inside your handler, any of these works:
dyui.llm.stream("nvidia/moonshotai/kimi-k2.6", chat.history, components=app.catalog)dyui.llm.stream("openrouter/anthropic/claude-sonnet-5-5", chat.history, components=app.catalog)dyui.llm.stream("together/meta-llama/Llama-3.3-70B-Instruct-Turbo", chat.history, components=app.catalog)dyui.llm.stream("groq/llama-3.3-70b-versatile", chat.history, components=app.catalog)dyui.llm.stream("gemini/gemini-2.5-flash", chat.history, components=app.catalog)base_url= and api_key= arguments override the environment. A provider DyUI doesn’t list still works if it speaks the OpenAI API: use openai/<model> with base_url=, or bring your own SDK.
Free tiers (Groq, NVIDIA NIM, Gemini) limit tokens per minute. Keep the catalog and history short; see rate limits and free tiers.
Complete example
Section titled “Complete example”One app for every provider: pick it with DYUI_MODEL. It trims the catalog and the history so requests stay inside free-tier limits.
"""One app, any provider: pick it with DYUI_MODEL.
Needs: pip install "dyui[openai]" and the key for your provider in a .env file next to this one,e.g. GROQ_API_KEY for groq/..., OPENROUTER_API_KEY for openrouter/..., GEMINI_API_KEY for gemini/...Save as app.py, then run: dyui run app.py"""import os
import dyui
MODEL = os.getenv("DYUI_MODEL", "groq/llama-3.3-70b-versatile")
app = dyui.App(title="Any Model", description=f"Answering with {MODEL}.", starters=["Show a bar chart of planet sizes"])
# Free tiers limit tokens per minute: a short catalog keeps every request small.CATALOG = app.catalog.only("table", "stats", "stat", "chart", "callout", "quick_replies")
@app.on_messageasync def reply(msg: dyui.Message, chat: dyui.Chat): async for part in dyui.llm.stream( MODEL, chat.history[-12:], # cap the history you resend system="You are a concise assistant.", components=CATALOG, ): yield part-
Save it as
app.pyin a new, empty file, or download app.py. -
Put the provider’s key and, if you like, the model in a
.envfile next to it:.env GROQ_API_KEY=gsk_...# DYUI_MODEL=openrouter/anthropic/claude-sonnet-5-5 (with OPENROUTER_API_KEY) -
Run it:
Terminal window pip install "dyui[openai]"dyui run app.py -
Open http://localhost:8000 and send the starter.
See also
Section titled “See also”- Models & providers: every argument and the provider table.
- Ollama & local models: no key at all.