Nests
A Nest is a named selection of LLMs that becomes a virtual model. You pick the models, ANT routes intelligently within that selection.
Key Concept
The system prompt, JSON schema, and any domain logic live in your app. ANT passes your system prompt through unchanged to the selected model. ANT has no knowledge of what your app does — it only decides which model handles the request.
What is a Nest?
Think of a Nest as your own custom virtual model. Instead of using a preset like ant:auto that routes across all available models, a Nest restricts ANT to only the models you have hand-picked.
Example
Create a Nest called fast-coding with GPT-4o, Claude Sonnet, and Gemini Flash. Then reference it in your API requests:
model: "nest:fast-coding"ANT scores only those three models using your Nest's preference weights and routes to the best one for each request. Every other model in the system is excluded.
Creating a Nest
- Go to Dashboard → Models → Create Nest
- Give your Nest a name (lowercase, hyphens allowed — e.g.
fast-coding) - Select models from the catalog. Use the filters (vision, thinking, provider) to narrow down, then click Select All to quickly add every matching model
- Set preference weights for Speed, Quality, and Cost to control how ANT ranks models within the Nest
- Save the Nest. It is immediately available as
nest:your-nest-name
Select All Shortcut
When creating a Nest, use the filter bar to narrow models by capability (vision, thinking), provider, or cost tier. Then click Select All to add every model that matches your filters in one click. This is the fastest way to build provider-specific or capability-specific Nests.
Using a Nest
Reference your Nest by passing nest:your-nest-name as the model parameter. This works with both the OpenAI and Anthropic API formats.
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
base_url="https://antbase.ai/v1",
api_key="ant_your-api-key",
)
# Route within your "fast-coding" nest
response = client.chat.completions.create(
model="nest:fast-coding",
messages=[
{"role": "system", "content": "You are a senior Python developer."},
{"role": "user", "content": "Write a Redis cache wrapper with TTL support"},
],
)TypeScript
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://antbase.ai/v1',
apiKey: 'ant_your-api-key',
});
const response = await client.chat.completions.create({
model: 'nest:fast-coding',
messages: [
{ role: 'system', content: 'You are a senior TypeScript developer.' },
{ role: 'user', content: 'Implement a rate limiter using the token bucket algorithm' },
],
});cURL
curl https://antbase.ai/v1/chat/completions \
-H "Authorization: Bearer ant_your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "nest:fast-coding",
"messages": [
{"role": "system", "content": "You are a senior developer."},
{"role": "user", "content": "Explain the CAP theorem"}
]
}'Nest-Locked API Keys
You can create API keys that are locked to specific Nests. When a key is nest-locked, every request made with that key routes exclusively through the Nest's models — regardless of what model name the client sends.
Why Nest-Lock a Key?
Production Safety
Lock your production key to a vetted Nest so deployed apps can never accidentally route to an untested or expensive model.
Team Isolation
Give each team a key locked to their Nest. The frontend team gets fast, cheap models; the ML team gets reasoning-capable models.
Cost Control
Lock keys to Nests containing only budget-friendly models. Developers can request any virtual model and costs stay predictable.
Compliance
Restrict a key to models hosted in approved regions or by approved providers. The Nest enforces the policy automatically.
How It Works
# With a nest-locked key, the client can use any model name.
# ANT ignores it and routes within the locked nest.
response = client.chat.completions.create(
model="ant:auto", # ANT uses the nest's preferences instead
messages=[{"role": "user", "content": "Hello!"}],
)
# Requesting a specific model works only if it's in the nest.
# If it's not in the nest, ANT returns an error.
response = client.chat.completions.create(
model="gpt-4o", # Must be in the locked nest
messages=[{"role": "user", "content": "Hello!"}],
)Projects
Nests live inside Projects. A Project groups related Nests and API keys together, giving you a clean organizational boundary.
One Project per app or environment. For example, create a “Production” project with a cost-controlled Nest and a “Development” project with a Nest that includes experimental models.
Each Project has its own set of API keys. Keys in a Project can be locked to any Nest within that Project. This keeps credentials, routing rules, and usage telemetry organized by logical boundary.
Preference Weights
Each Nest has three preference weights that influence how ANT ranks the models in the nest:
| Weight | Effect | Example |
|---|---|---|
| Speed | Favors models with lower latency | Set high for real-time chat, autocomplete |
| Quality | Favors models with higher capability scores | Set high for code review, analysis, reasoning |
| Cost | Favors models with lower per-token pricing | Set high for high-volume, budget-sensitive workloads |
Weights are set on a 0–100 scale. ANT combines them into a composite score for each model in the Nest and picks the winner. You can adjust weights at any time without changing application code.
Example Nest Configurations
fast-coding
S:80 Q:70 C:50
GPT-4o, Claude Sonnet, Gemini Flash. Optimized for quick code generation with good quality. Ideal for AI coding assistants.
budget-chat
S:60 Q:40 C:100
Free-tier and low-cost models only. Great for high-volume chatbots, prototyping, and internal tools where cost matters most.
compliance-us
S:50 Q:80 C:40
Only models from US-hosted providers. Ensures all data stays within approved infrastructure boundaries.
deep-think
S:20 Q:100 C:20
o1, Claude Opus, DeepSeek R1. Maximum reasoning capability for the hardest problems. No speed or cost constraints.
Nests vs Virtual Models
| Feature | Virtual Models | Nests |
|---|---|---|
| Model selection | All available models | Only the models you selected |
| Preferences | Preset (auto, fast, best, etc.) | Fully customizable per Nest |
| Key locking | Not supported | API keys can be locked to a Nest |
| Best for | Quick start, general-purpose use | Production, compliance, cost control |
| Usage | ant:auto | nest:your-name |
You can use both. Start with Virtual Models for prototyping, then create Nests when you need fine-grained control for production.