Antbase/Documentation

Virtual Models

Instead of specifying a real model, request a virtual model and let ANT pick the best real model based on your preferences.

How Virtual Models Work

  1. You request a virtual model like ant:auto
  2. ANT applies the model's preset preference weights (speed, quality, cost)
  3. Combined with your prompt's task type and complexity, ANT scores all real models
  4. Reasoning models (ant:reasoning*) additionally hard-filter to thinking-capable models only, and auto-tune reasoning effort (low/medium/high) based on task complexity
  5. The highest-scoring real model handles your request

Available Virtual Models

ant:autoAuto

S:50 Q:50 C:50

Balanced routing. Good for general-purpose use.

Best For

Default choice for most applications

Example Use Cases

General chatbots, mixed workloads

ant:fastFast

S:100 Q:30 C:70

Optimized for lowest latency. Uses fast models.

Best For

Real-time applications, simple queries

Example Use Cases

Autocomplete, logging, health checks

ant:balancedBalanced

S:50 Q:60 C:50

Slightly favors quality over speed.

Best For

Business applications with moderate complexity

Example Use Cases

Email drafts, documentation, structured tasks

ant:bestBest

S:20 Q:100 C:20

Maximum quality. Uses the most capable models.

Best For

Complex reasoning, coding, critical decisions

Example Use Cases

Code review, strategic planning, analysis

ant:freeFree

S:50 Q:30 C:100

Zero cost. Routes to continuously health-checked free models.

Best For

Testing, prototyping, low-stakes tasks

Example Use Cases

Hobby projects, experiments, learning

ant:reasoningReasoning

S:30 Q:90 C:30

Routes exclusively to thinking-capable models (o-series, Claude with extended thinking, DeepSeek R1). Reasoning effort is automatically tuned to task complexity.

Best For

Multi-step problems, proofs, complex analysis

Example Use Cases

Math proofs, legal reasoning, scientific analysis

ant:reasoning-fastReasoning Fast

S:80 Q:60 C:60

Thinking-capable models optimized for speed. Uses lighter reasoning models with lower effort levels.

Best For

Quick reasoning tasks with latency constraints

Example Use Cases

Code debugging, quick calculations, step-by-step explanations

ant:reasoning-premiumReasoning Premium

S:10 Q:100 C:10

Maximum reasoning capability. Routes to the highest-quality thinking models with full reasoning effort.

Best For

The hardest problems — no latency or cost constraints

Example Use Cases

Research synthesis, complex code architecture, formal proofs

ant:coderCoder

S:40 Q:95 C:30

Optimized for code generation and review. Strongly favors high-quality models with function calling support.

Best For

Code generation, debugging, refactoring, architecture

Example Use Cases

AI coding assistants, code review, test generation

ant:creativeCreative

S:40 Q:85 C:40

Balanced for creative and conversational tasks. Favors expressive models with good prose quality.

Best For

Writing, storytelling, dialogue, brainstorming

Example Use Cases

Game dialogue, creative writing, marketing copy, chatbots

ant:visionVision

S:50 Q:80 C:50

Routes exclusively to vision-capable models. Guaranteed to handle images, screenshots, and visual content.

Best For

Image analysis, OCR, visual Q&A, screenshot understanding

Example Use Cases

Photo scanners, document extraction, UI review, diagram analysis

ant:ocrOCR

S:50 Q:90 C:50

Extracts text from images and PDFs via the Mistral OCR bridge and returns markdown. Not a chat model — send an image/PDF and get structured text back. See the OCR section below.

Best For

Document and image text extraction

Example Use Cases

Invoice parsing, PDF ingestion, receipt and screenshot scanning

ant:image-genImage Generation

S:40 Q:80 C:50

Routes to models that can generate images natively. Includes Gemini Image, GPT-5 Image, and any future image generation models. Auto-discovered from the catalog.

Best For

Creating images from text prompts, product shots, illustrations

Example Use Cases

Marketing visuals, concept art, social media graphics, product mockups

ant:video-genVideo Generation

S:20 Q:80 C:30

Routes to models that can generate video natively. Auto-discovered from the catalog as providers add video generation capabilities.

Best For

Creating short videos from text prompts, animations

Example Use Cases

Product demos, social clips, animated explainers

Usage Examples

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    base_url="https://antbase.ai/v1",
    api_key="ant_your-api-key",
)

# Use ant:auto for balanced routing
response = client.chat.completions.create(
    model="ant:auto",
    messages=[{"role": "user", "content": "Explain quantum computing"}],
)

# Use ant:best for complex code review
response = client.chat.completions.create(
    model="ant:best",
    messages=[{"role": "user", "content": "Review this code for security issues: ..."}],
)

# Use ant:free for zero-cost requests (free models only)
response = client.chat.completions.create(
    model="ant:free",
    messages=[{"role": "user", "content": "What is the capital of France?"}],
)

TypeScript

import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://antbase.ai/v1',
  apiKey: 'ant_your-api-key',
});

// Fast model for simple queries
const response = await client.chat.completions.create({
  model: 'ant:fast',
  messages: [{ role: 'user', content: 'What time is it in Tokyo?' }],
});

Task-Specific Models

# Use ant:coder for coding tasks — favors high-quality function-calling models
response = client.chat.completions.create(
    model="ant:coder",
    messages=[{"role": "user", "content": "Write a Redis cache wrapper in Python with TTL support"}],
)

# Use ant:creative for writing and dialogue
response = client.chat.completions.create(
    model="ant:creative",
    messages=[{"role": "user", "content": "Write a noir detective monologue for a game cutscene"}],
)

Reasoning Models

# Use ant:reasoning for tasks that need extended thinking
response = client.chat.completions.create(
    model="ant:reasoning",
    messages=[{"role": "user", "content": "Prove that sqrt(2) is irrational"}],
)

# Use ant:reasoning-fast for quick reasoning with low latency
response = client.chat.completions.create(
    model="ant:reasoning-fast",
    messages=[{"role": "user", "content": "Debug this function: def fib(n): ..."}],
)

# Use ant:reasoning-premium for the hardest problems
response = client.chat.completions.create(
    model="ant:reasoning-premium",
    messages=[{"role": "user", "content": "Design a distributed consensus algorithm for..."}],
)

Nests

Nests let you create custom routing groups that restrict which models ANT can select from. This is useful when you want to limit routing to a curated set of models — for example, only HIPAA-compliant models, only free models, or only models from specific providers. See the full Nests documentation for detailed setup instructions and advanced configuration.

How Nests Work

  1. Create a nest in the dashboard under Models > Nests
  2. Add models to the nest by selecting them from the model catalog
  3. Set preference weights (speed, quality, cost) and optional thinking mode
  4. Assign the nest to an API key — all requests with that key route through the nest
  5. ANT scores only the models in your nest, using your nest's preference weights

Example Use Cases

Compliance Nest

Only include models hosted in specific regions or by approved providers. Assign to your production API key to ensure every request stays compliant.

Budget Nest

Include only free-tier models or models below a cost threshold. Great for development, testing, and hobby projects.

Speed Nest

Include only models with sub-200ms latency. Use for real-time applications like autocomplete or live chat.

Provider-Specific Nest

Limit to models from a single provider (e.g., only Anthropic or only OpenAI) while still getting ANT's intelligent model selection within that provider.

Using Nests with API Keys

Each API key can be assigned to a specific nest. When a nest is assigned, all requests using that key are routed exclusively through the nest's models — regardless of whether the request uses ant:auto or any other virtual model. The nest's preference weights override the virtual model's weights.

# This request will only use models in the nest assigned to your API key
response = client.chat.completions.create(
    model="ant:auto",  # Nest's preferences take priority
    messages=[{"role": "user", "content": "Hello!"}],
)

# You can still request a specific model — if it's in the nest, it's used directly
# If it's not in the nest, ANT returns an error
response = client.chat.completions.create(
    model="gpt-4o",  # Must be in the nest
    messages=[{"role": "user", "content": "Hello!"}],
)

Tools

In addition to routing models, ANT provides built-in tools that you can attach to any request.

ant:searchWeb Search

Gives your LLM access to real-time web search. Include {"type": "ant:search"} in your tools array — ANT injects a web_search function, and the LLM can call it to fetch live information. Results are fed back into the conversation automatically (non-streaming only).

How It Works

ANT replaces ant:search with a web_search function definition. When the LLM calls it, ANT runs the search through your configured providers (Tavily, Brave, Bing, SearXNG, etc.) and injects the results back. The LLM then generates a grounded answer.

Example Use Cases

Current events, fact-checking, real-time data lookup, research questions.

ant:ocrDocument OCR

Extract structured text from documents and images. POST to /v1/ocr with a document URL, image URL, or file ID. Returns page-level markdown with extracted tables, headers, and images.

Supported Inputs

PDFs, images (JPEG, PNG), screenshots, scanned documents. Supports base64 and URL inputs.

Example Use Cases

Product label scanning, receipt parsing, document digitization, invoice extraction.

Using ant:search

response = client.chat.completions.create(
    model="ant:auto",
    messages=[{"role": "user", "content": "What happened in the news today?"}],
    tools=[{"type": "ant:search"}],  # Enable web search
)

Using ant:ocr

import requests

response = requests.post(
    "https://antbase.ai/v1/ocr",
    headers={"Authorization": "Bearer ant_YOUR_API_KEY"},
    json={
        "model": "ant:ocr",
        "document": {"type": "image_url", "image_url": "https://example.com/label.jpg"}
    }
)

Using ant:image-gen

response = client.chat.completions.create(
    model="ant:image-gen",
    messages=[{"role": "user", "content": "A serene Japanese garden at sunset"}],
)
# Response contains the generated image inline

Using ant:video-gen

response = client.chat.completions.create(
    model="ant:video-gen",
    messages=[{"role": "user", "content": "A timelapse of clouds over mountains"}],
)
# Response contains the generated video

Bypassing Routing

If you want to use a specific model, pass its full name instead of a virtual model. ANT will forward the request directly without classification or routing.

# Use a specific model directly
response = client.chat.completions.create(
    model="anthropic/claude-opus-4-6",  # Real model name
    messages=[{"role": "user", "content": "Hello!"}],
)

ANT supports 2,500+ models from Anthropic, OpenAI, Google, DeepSeek, Mistral, Meta, Together, and 30+ more providers.

Understanding Preference Weights

Each virtual model has preset weights that determine how models are scored:

WeightPrioritizesTrade-off
Speed (S)Low latency, fast responsesMay use smaller, less capable models
Quality (Q)Best outputs, highest capabilityHigher cost, slower responses
Cost (C)Lowest price per tokenMay sacrifice quality or speed

You can also set custom weights in the ANT dashboard under Settings.