A provider declares how its key is presented (auth_token: → Authorization: Bearer), what each model is called on the wire (models.<name>.id), and what effort and output cap to ask for; a base URL that already ends in the API version is not doubled¶
TUI decision 61 · accepted · 2026-09-15
A corporate gateway is the normal way to reach a frontier model from inside a company, and Troupe could not talk to one: it sent Anthropic's x-api-key where the gateway wanted a bearer token (opencode writes that key as authToken, which the fallback read as nothing at all), it sent the model name the user addressed where the gateway wanted its own id (eu.anthropic.claude-opus-5), and it appended /v1/messages to a base URL of https://host/anthropic/v1, so every request went to /anthropic/v1/v1/messages — three separate failures before the first token. Each is now part of what a provider declares, so Provider.resolve/3 hands the adapter %{api_key, base_url, auth, reasoning_effort, max_output} and the id to put on the wire, and the name in config.yaml stays the name the user picked. HTTP.api_url/2 is the one place the path is joined, so the catalog fetch stopped doubling the version too. reasoning_effort is a string passed through verbatim to an OpenAI-compatible provider (only the model knows which levels it has, and "none" is as meaningful as "xhigh") together with max_completion_tokens in place of max_tokens, which a reasoning model rejects; for Anthropic, which takes a budget rather than a level, the level becomes thinking.budget_tokens and the output cap is raised to fit it rather than the request failing. The per-provider windows: map is gone: it held one fact about each model where there are now four, and a provider's models are declared once in models:, which also means a provider whose models declare no context window is still listed in the model menu instead of collapsing to name/. opencode's variants are not read — Troupe has no variant cycling, so the effort belongs on the model — and neither are its agent, permission or mcp blocks; agents are files, and that is a bigger surface than a key and a URL.
Governs: clients/tui/lib/troupe/remote/http.ex