Model routing
Caveman vs Martian: model gateway, routing, compression
Martian Gateway gives one API over 200+ models, backed by routing research. See how it compares with Caveman Router and how Caveman compression runs through it.
- 01Your app builds the request
- 02Caveman shrinks the tool output
- 03Martian Gateway serves the model
- 04Count the finished task
Martian gives you one API key for more than 200 models, from a team that publishes serious research on routing and model behavior. Caveman Router, the Caveman product that overlaps most with it, is not released yet.
What you can use from Caveman today is compression. Caveman Middleware wraps the OpenAI or Anthropic client you already point at Martian, so tool output costs fewer input tokens on whichever model Martian serves.
What is Martian?
Martian describes itself as a research lab focused on understanding machine intelligence, staffed by researchers who left Google DeepMind, Anthropic and Meta. Its work spans measurement (ARES, for online reinforcement learning on coding agents, and Code Review Bench), interpretability (including K-Steering) and products built on that research.
The product most teams touch is the Martian Gateway. It exposes more than 200 models behind endpoints compatible with the OpenAI and Anthropic APIs, at https://api.withmartian.com/v1. The docs list integrations for the OpenAI and Anthropic SDKs, the Vercel AI SDK, LiteLLM, Claude Code, Codex, Cursor, Cline and OpenCode. A dashboard shows usage, model performance and request history, and the model list shows per-model prices, including cache read and write prices where a provider supports caching.
Is Martian a model router?
Partly. Martian publishes routing research, and its Gateway docs mention one cost option on model names. The LiteLLM guide documents an optional :optimized suffix on model names, described as being "for cost optimization". The docs pages read for this comparison don't explain how that option chooses, so ask Martian before you rely on it.
Its best-known routing work is RouterBench, published in March 2024: more than 405,000 inference outcomes across eight datasets covering reasoning, knowledge, conversation, math and code. The headline finding is an honest one. On most RouterBench tasks, basic routing systems did no better than the zero router baseline, while routers did clearly better on retrieval-augmented generation. Routing pays off on some workloads and not on others.
What is Caveman Router?
Caveman Router picks the model for each subagent Claude Code spawns. Simple work like a code search can go to a smaller model, and the lead agent stays on the model you chose. It keeps your claude.ai login, so Claude turns stay on your Pro or Max plan. For apps, the client README also documents an OpenAI-compatible endpoint where you ask for model: "auto" and the router forwards to OpenRouter on your own key.
If the router doesn't answer in time, the request runs exactly as asked. The client is open source under Apache-2.0, the routing service is hosted, and it is not released yet. Caveman hasn't published a savings methodology for it yet, so this page quotes no number.
Martian vs Caveman: feature comparison
| Martian | Caveman | |
|---|---|---|
| Available today | Gateway | Middleware, Proxy, Cloud and Router |
| Model access | 200+ models, one key | Router forwards via OpenRouter on your key |
| API shape | OpenAI and Anthropic compatible | OpenAI compatible; Claude Code hook |
| Automatic model choice | Optional :optimized suffix | Per subagent in Claude Code |
| Claude Code | Base URL swap with a Martian key | Hook that keeps your Pro or Max login |
| Usage dashboard | Yes | One terminal line per routing move |
| Published routing research | RouterBench and more | No |
| Shrinks tool output | No | Yes, Middleware and Proxy |
| Original text recoverable | n/a | Yes, through a retrieve tool |
When should you use Martian?
Use Martian when you want many models behind one key and one bill today. Swapping providers becomes a model string change, and the OpenAI and Anthropic compatible endpoints mean most SDKs and coding agents connect with a base URL and a key.
The research is a plus too. RouterBench is useful reading even if you never buy anything, and it is candid about where routing fails.
Caveman Router isn't a replacement here. It covers subagents in Claude Code, and it isn't open yet.
Does Caveman work with Martian Gateway?
Yes, and it doesn't need a Martian-specific adapter. Caveman Middleware wraps the provider SDK client. Point that client's base URL at Martian as usual and wrap it. The middleware shortens eligible tool results in a copy of the outbound request, Martian forwards the smaller request to the model you asked for, and your app's history keeps the original bytes.
Take an agent that reads a 20,000-token JSON export from an internal API. Without compression, every later turn re-sends that export to the model. With the middleware, the model sees a shortened view plus a handle, and it can call caveman_retrieve if it needs the exact rows. User messages, system prompts and images pass through unchanged.
Adapters exist for the OpenAI, Anthropic and Google Gen AI SDKs in TypeScript and Python, plus frameworks including the Vercel AI SDK, LangChain, Mastra and Pydantic AI. If you reach Martian through LiteLLM, Caveman has a native LiteLLM adapter too; see Caveman with LiteLLM. Both packages are alpha and the runtime runs locally with no Caveman account.
The only published Middleware figures are 13 synthetic samples run through the real runtime, counted as inferred token estimates. They show what the compressor does to sample content, not what your bill will do. Details are on the Middleware page.
Test routing and compression separately
Compression happens in your process before the request leaves. Model choice happens after, at Martian. They don't conflict, which makes it tempting to switch both on at once. Don't. If you change the model and the payload together, you can't tell which one moved cost or quality.
Pin one model through Martian, add compression, and measure. Then try :optimized or a different model on its own. RouterBench is the reason to be strict: a routing change that wins on a benchmark can lose on your workload, and the same caution applies to Caveman's claims. Model routing for agents and cost per completed task lay out the method.
How to add Caveman to Martian
Install the middleware, start the local runtime, wrap the OpenAI client you already point at api.withmartian.com, and compare provider usage for the same task with compression off and on. The Martian setup guide has the code and a rollback.
FAQ
Is Caveman a Martian alternative? Only partly. Caveman doesn't offer a multi-provider gateway. Caveman Router overlaps with Martian's routing for Claude Code subagents, and it is not released yet.
Can I use Caveman and Martian together? Yes. Keep your Martian base URL and key, and wrap the SDK client with Caveman Middleware. Martian still serves the model; Caveman only makes the request smaller.
Does compression change which model Martian uses?
No. With a fixed model string, Martian serves the model you name. How :optimized decides isn't documented in the pages cited here, so test it on its own.
Does Martian compress prompts? Not according to the docs reviewed here. The Gateway handles model access, and none of those pages describe shrinking request content.
Sources
Try it on work you know
Test the route on your tasks.
Bring your models, acceptance cases, and current policy. Walk through them with Julius on a call.
Book a call Explore comparisons ↗