← Back to PRs

#20587: feat: add Tetrate Agent Router Service provider

by RicHincapie open 2026-02-19 03:45 View on GitHub →
docs cli commands agents size: M
## Summary - Adds **Tetrate Agent Router Service** (`api.router.tetrate.ai`) as a first-class provider in OpenClaw - Tetrate is an OpenAI-compatible AI gateway routing to **100+ models** from Anthropic, OpenAI, Google, xAI, DeepInfra, Groq, and more — all behind a single API key - Dynamic model discovery from `/v1/models` endpoint with 6-model static fallback (Claude, GPT-5.2, Gemini 3 Pro, Grok 4) ## What's included - **Auth flow:** `--tetrate-api-key` CLI flag, interactive + non-interactive onboarding, `TETRATE_API_KEY` env var - **Model discovery:** Runtime fetch from `/v1/models` with rich metadata (context window, pricing, vision, caching) - **Live model filter:** Tetrate joins the router-provider block alongside OpenRouter/OpenCode - **Cache TTL:** Anthropic prompt caching support for Claude models via Tetrate - **Docs:** Full provider page with multi-provider model catalog ## Test plan - [x] `tsgo --noEmit` passes (0 errors) - [x] Full test suite: 890 passed, 1 skipped (pre-existing flaky `model-catalog.test.ts` — also fails on clean `main`) - [x] Non-interactive flow: `TETRATE_API_KEY=<key> openclaw onboard --non-interactive --auth-choice tetrate-api-key --accept-risk` - [x] Model listing: `tetrate/claude-sonnet-4-6` registered as `default,configured,alias:Tetrate` - [x] Implicit resolution: Set `TETRATE_API_KEY` and verified provider auto-registers with discovered models <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds Tetrate Agent Router Service as a first-class provider with dynamic model discovery, authentication flow, and comprehensive documentation. The implementation follows existing patterns for provider integration with runtime `/v1/models` discovery and static fallback catalog. **Key changes:** - Dynamic model discovery from Tetrate `/v1/models` endpoint with 6-model static fallback - Authentication via `--tetrate-api-key` CLI flag, `TETRATE_API_KEY` env var, and interactive onboarding - Tetrate added to router-provider filter alongside OpenRouter/OpenCode for live model listing - Cache TTL support for Claude models routed through Tetrate - Documentation page with multi-provider model catalog **Issues found:** - `supports_caching` API field is defined but unused when mapping discovered models, resulting in zero cache costs for models that support prompt caching - Reasoning detection incomplete - only catches opus/sonnet/r1, missing GPT-5, Gemini 3, Grok 4, and o-series models <h3>Confidence Score: 4/5</h3> - This PR is largely safe to merge with one critical fix needed for caching costs - The implementation follows established patterns and includes comprehensive testing (890 tests passed). However, the cache cost calculation issue for discovered models needs fixing before merge, as it affects cost reporting for Claude models with prompt caching support. The reasoning detection limitation is a minor quality issue. - src/agents/models-config.providers.ts requires a fix for the cache cost calculation in `discoverTetrateModels` <sub>Last reviewed commit: 948de50</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs