ANT for Bots & Agents
Drop-in OpenAI-compatible proxy that classifies, optimizes, and routes every LLM request to the best model across 2,500+ models and 30+ providers. Change one URL, save up to 50% on API costs.
How it Works
┌──────────┐ ┌─────────────┐ ┌──────────────┐ ┌──────────┐ ┌──────────┐
│ Your Bot │──▶│ Classify LLM│──▶│ Optimize LLM │──▶│ Route AI │──▶│ LLM │
└──────────┘ └─────────────┘ └──────────────┘ └──────────┘ └──────────┘
Task type & Compress Score & 2,500+ models
complexity (optional) select 30+ providersWhat ANT Does
- Sits between your agent and LLM providers
- Classifies each prompt (coding, reasoning, chat, etc.)
- Optionally compresses prompts to save tokens
- Routes to the optimal model for that task
- Automatic failover across providers
What You Get
- Up to 50% cost reduction
- ~50ms routing overhead
- Access to 2,500+ models, 30+ providers
- Automatic failover & circuit breakers
- Full OpenAI-compatible API
Quick Start (2 minutes)
Sign up
curl -s -X POST https://antbase.ai/auth/register \
-H 'Content-Type: application/json' \
-d '{"email": "[email protected]", "password": "your-password"}'Response includes your API key and workspace ID. You get $5 free credits to start.
Route traffic
Change your base URL to https://antbase.ai/v1 and set your ANT API key as the bearer token. That's it.
Verify
curl -s https://antbase.ai/healthzFramework Setup
OpenClaw (Recommended)
One-line install. Creates account, generates API key, configures OpenClaw. Works with all OpenClaw-compatible agents and bots.
curl -fsSL https://antbase.ai/install.sh | bashOr manually add to openclaw.json:
{
"providers": {
"antbase": {
"baseURL": "https://antbase.ai/v1",
"apiKey": "YOUR_ANT_API_KEY"
}
},
"defaultProvider": "antbase"
}Virtual Models
Request a virtual model and ANT scores all real models against those preference weights and selects the highest-scoring one.
| Model | Speed / Quality / Cost | Best For |
|---|---|---|
ant:auto | 50 / 50 / 50 | Default — balanced routing |
ant:fast | 100 / 30 / 70 | Logging, simple queries, heartbeats |
ant:balanced | 50 / 60 / 50 | Email, sync tasks, structured work |
ant:best | 20 / 100 / 20 | Complex reasoning, coding, planning |
ant:free | 50 / 30 / 100 | Zero-cost requests via free providers |
ant:reasoning | 30 / 90 / 30 | Math, logic, multi-step problems |
ant:reasoning-fast | 80 / 60 / 60 | Fast reasoning with thinking models |
ant:reasoning-premium | 10 / 100 / 10 | Maximum reasoning capability |
ant:coder | 40 / 95 / 30 | Code generation, review, debugging |
ant:creative | 40 / 85 / 40 | Creative writing, brainstorming |
ant:vision | 50 / 80 / 50 | Image understanding, screenshots |
ant:ocr | Tool | Extract text from images & documents (Mistral OCR) |
ant:search | Tool | Web search with automatic provider failover |
ant:image-gen | Generation | Generate images via Gemini Image, GPT-5 Image, etc. |
ant:video-gen | Generation | Generate videos via capable models (auto-discovered) |
You can also create custom nests that restrict routing to a specific set of models — see Virtual Models docs.
Bypass routing: Pass any real model name (e.g., anthropic/claude-sonnet-4-6) to skip routing and use that model directly.
Model Routing
ANT's classification LLM analyzes your prompt and routes to the most cost-effective model that can handle it.
| Complexity | Example | Likely Routed To |
|---|---|---|
| simple | "What's 2+2?" | Gemini Flash, Haiku, free models |
| medium | "Summarize this article" | Sonnet, GPT-4o-mini |
| complex | "Debug this race condition" | Opus, GPT-4o, DeepSeek R1 |
Response Headers
ANT adds these headers to every response so you can see what happened:
| Header | Example | Meaning |
|---|---|---|
X-Antbase-Model | anthropic/claude-sonnet-4-6 | Actual model used |
X-Antbase-Virtual-Model | ant:best | What you requested |
X-Antbase-Task-Type | coding | Detected task type |
X-Antbase-Complexity | complex | Detected complexity |
X-Antbase-Tokens-Saved | 340 | Tokens saved by optimization |
API Reference
/v1/chat/completionsOpenAI-compatible chat (main endpoint)/v1/modelsList available models/v1/models/catalogFull model catalog with capabilities/healthzService health check/workspaces/:id/usageUsage stats and cost breakdown/workspaces/:id/balanceCredit balance/workspaces/:id/api-keysManage API keysSee the full API Reference for detailed request/response schemas.
Pricing
Managed Credits
- No platform fee on credit purchases
- Provider costs at exact pass-through price
- No API key management needed
- $5 free credits to start
BYOK (Bring Your Own Keys)
- No routing fee on your own keys
- Then $0.001/request
- You pay providers directly
- Full dashboard & analytics
Pure usage-based: No subscriptions. Top up your balance and go.
Errors
| Status | Code | Meaning |
|---|---|---|
400 | INVALID_MODEL | Unknown virtual or real model |
401 | — | Invalid or missing API key |
402 | INSUFFICIENT_CREDITS | Top up your balance |
429 | — | Rate limit exceeded |
502 | PROVIDER_ERROR | Upstream provider returned an error |
503 | ALL_PROVIDERS_DOWN | All providers failing, circuit breaker open |
Multi-Agent Frameworks
ANT works with multi-agent frameworks like Rowboat and CrewAI. Each agent in your system can use a different ANT virtual model — the research agent gets ant:reasoning, the code writer gets ant:coder, the coordinator gets ant:fast. One API key, every agent optimized.
Agent Client Protocol (ACP)
ANT supports the Agent Client Protocol (ACP) — the emerging standard for connecting code editors to AI agents. Any ACP-compatible editor (Zed, JetBrains, Kiro) can use ANT as its AI backend with one configuration change.
ACP is to AI agents what LSP is to language servers. One protocol, every editor, intelligent routing across 20,000+ models.
FAQ
Does ANT store my prompts?
No long-term storage. Prompts are used transiently for classification and routing, then discarded.
Can I pin a specific model?
Yes, pass the real model name (e.g., anthropic/claude-sonnet-4-6) instead of a virtual model to bypass routing.
What if ANT is down?
Requests fail. Implement a direct-to-provider fallback in your agent for resilience.
Which models are available?
Over 20,000 models across 30+ providers including OpenAI, Anthropic, Google, DeepSeek, Mistral, Together, and more. Use ant:free for zero-cost requests via free provider tiers.
Can I restrict which models ANT uses?
Yes, create a custom nest in the dashboard to restrict routing to specific models or providers. Teams can also set a workspace/project model whitelist and hard budget caps.
Can I get guaranteed structured JSON back?
Yes. Pass response_format: { type: "json_schema", json_schema: {...} } and ANT enforces it end-to-end — natively on OpenAI-compatible providers and via a forced tool on Anthropic — so your agent always gets schema-valid JSON, streaming or not.
Does tool calling / function calling work?
Yes. Standard OpenAI tools and Anthropic tool_use are supported end-to-end, including multi-turn tool loops, on both the /v1/chat/completions and /v1/messages endpoints.
Ready to optimize your bot's AI costs?
Start with $5 free credits. No credit card required.