Recipe: OpenRouter
OpenRouter gives one API, and one key, for models from many companies. It bills by tokens, per model.
Not tested with Tagent yet. The values below come from OpenRouter’s quickstart; if they don’t work for you, please open an issue.
1. Get a key and pick a model
- Create an API key in your OpenRouter account.
- Pick a model at openrouter.ai/models. Its identifier
names the company and the model, such as
openai/gpt-4o.
The API is at https://openrouter.ai/api/v1.
2. Add the profile
tagent-cli
[provider]
translate_provider = "openrouter"
[provider_options.openrouter]
type = "openai"
endpoint = "https://openrouter.ai/api/v1"
model = "openai/gpt-4o"
and the key in the environment:
export TAGENT_OPENROUTER_API_KEY="sk-or-..."
tagent-gui
- Settings (⚙) > Providers. Under New profile, type
openrouter, keep the kindopenai, and click Add. - Options… on the
openrouter (openai)row:endpoint,model, and the key inapi_key. Click Test. - OK, then pick
openrouterin Translation, and OK in the dialog.
Notes
- Whether
response_formatandtemperaturework depends on the model behind OpenRouter. Leave them unset unless you know the model supports them. - OpenRouter’s optional attribution headers (
HTTP-Referer,X-OpenRouter-Title) aren’t sent; they aren’t needed.