Antbase/Bots & Agents

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+ providers

What 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)

1

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.

2

Route traffic

Change your base URL to https://antbase.ai/v1 and set your ANT API key as the bearer token. That's it.

3

Verify

curl -s https://antbase.ai/healthz

Framework 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 | bash

Or 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.

ModelSpeed / Quality / CostBest For
ant:auto50 / 50 / 50Default — balanced routing
ant:fast100 / 30 / 70Logging, simple queries, heartbeats
ant:balanced50 / 60 / 50Email, sync tasks, structured work
ant:best20 / 100 / 20Complex reasoning, coding, planning
ant:free50 / 30 / 100Zero-cost requests via free providers
ant:reasoning30 / 90 / 30Math, logic, multi-step problems
ant:reasoning-fast80 / 60 / 60Fast reasoning with thinking models
ant:reasoning-premium10 / 100 / 10Maximum reasoning capability
ant:coder40 / 95 / 30Code generation, review, debugging
ant:creative40 / 85 / 40Creative writing, brainstorming
ant:vision50 / 80 / 50Image understanding, screenshots
ant:ocrToolExtract text from images & documents (Mistral OCR)
ant:searchToolWeb search with automatic provider failover
ant:image-genGenerationGenerate images via Gemini Image, GPT-5 Image, etc.
ant:video-genGenerationGenerate 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.

ComplexityExampleLikely 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:

HeaderExampleMeaning
X-Antbase-Modelanthropic/claude-sonnet-4-6Actual model used
X-Antbase-Virtual-Modelant:bestWhat you requested
X-Antbase-Task-TypecodingDetected task type
X-Antbase-ComplexitycomplexDetected complexity
X-Antbase-Tokens-Saved340Tokens saved by optimization

API Reference

POST/v1/chat/completionsOpenAI-compatible chat (main endpoint)
GET/v1/modelsList available models
GET/v1/models/catalogFull model catalog with capabilities
GET/healthzService health check
GET/workspaces/:id/usageUsage stats and cost breakdown
GET/workspaces/:id/balanceCredit balance
POST/workspaces/:id/api-keysManage API keys

See 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

StatusCodeMeaning
400INVALID_MODELUnknown virtual or real model
401—Invalid or missing API key
402INSUFFICIENT_CREDITSTop up your balance
429—Rate limit exceeded
502PROVIDER_ERRORUpstream provider returned an error
503ALL_PROVIDERS_DOWNAll 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.