Models
Theazo's model gateway routes to the best LLM for your agent. Use managed models (Theazo handles the API keys) or bring your own model credentials.
Managed models
By default, Theazo manages model credentials via OpenRouter. You select a model and Theazo handles routing, rate limiting, and billing. No API keys to manage.
const agent = await session.agents.create({
compute: 'python',
model: 'anthropic/claude-sonnet', // Theazo handles the API key
})
// Available managed models:
// anthropic/claude-sonnet — Best for complex reasoning + tool use
// anthropic/claude-haiku — Fast + cheap for simple tasks
// openai/gpt-4o — Strong general-purpose model
// openai/gpt-4o-mini — Budget option, good for classification
// google/gemini-2.0-flash — 1M context, fast, very cheapAvailable models
anthropic/claude-sonnet200K contextanthropic/claude-haiku200K contextopenai/gpt-4o128K contextopenai/gpt-4o-mini128K contextgoogle/gemini-2.0-flash1M contextList models programmatically
const models = await theazo.models.list()
models.forEach(m => {
console.log(m.id, m.name, m.capabilities)
})Get model details
const model = await theazo.models.get('anthropic/claude-sonnet')
console.log(model.name) // 'Claude Sonnet'
console.log(model.maxTokens) // 200000
console.log(model.capabilities) // ['text', 'vision', 'tool_use']
console.log(model.inputCostPer1M) // 300 (cents)Cost estimation
Estimate the cost of a model call before running it. Useful for setting cost caps and budgeting.
const estimate = await theazo.models.estimate({
model: 'anthropic/claude-sonnet',
inputTokens: 50000,
outputTokens: 2000,
})
console.log(estimate.estimatedCost.modelCost) // { amount: 45, currency: 'usd' }
console.log(estimate.estimatedCost.theazoMargin) // { amount: 5, currency: 'usd' }
console.log(estimate.estimatedCost.total) // { amount: 50, currency: 'usd' }Bring your own models (BYOI)
If you have your own API keys for model providers, pass them in the Theazo constructor. Theazo will route model calls through your credentials instead of managed ones.
// Configure BYOI models at the platform level (single provider)
const theazo = new Theazo({
apiKey: 'th_live_...',
models: {
provider: 'anthropic',
credentials: { apiKey: process.env.ANTHROPIC_API_KEY },
},
})
// Now model calls use YOUR API key
// Theazo charges only for orchestration, not model usage
const session = await theazo.sessions.forUser('user_123')
const result = await session.run('analyst', 'summarize Q2 results')
// For multi-provider, configure per-agent at creation time:
const agent = await session.agents.create({
compute: 'python',
model: 'openai/gpt-4o',
modelCredentials: { apiKey: process.env.OPENAI_API_KEY },
})With BYOI models, you pay the model provider directly. Theazo still tracks token usage for observability and billing data, but does not charge a model margin.
Gateway BYOI (OpenAI-compatible endpoints)
Use the baseUrl parameter to point Theazo at any OpenAI-compatible endpoint. This unlocks hundreds of models through a single integration.
const theazo = new Theazo({
apiKey: 'th_live_...',
models: {
baseUrl: 'https://openrouter.ai/api/v1',
credentialRef: 'openrouter_key',
},
})
// Now any model available on the gateway is accessible
const session = await theazo.sessions.forUser('user_123')
const agent = await session.agents.create({
compute: 'python',
model: 'meta-llama/llama-3.1-405b-instruct',
})Compatible gateways include:
https://openrouter.ai/api/v1http://localhost:4000/v1https://{resource}.openai.azure.com/openai/deployments/{model}/v1http://localhost:8000/v1http://localhost:11434/v1baseUrl parameter only works for OpenAI-compatible APIs (any endpoint serving /v1/chat/completions). Direct Anthropic BYOI still uses the anthropic config with createAnthropic() under the hood. If you want to reach Anthropic models through a gateway, use OpenRouter or LiteLLM as the baseUrl instead.Credential references
Instead of passing raw API keys in code, store them in Theazo's secrets vault and reference them by name. Theazo decrypts credentials at runtime when making model calls.
// Store your key in the secrets vault (dashboard or API)
await theazo.secrets.set('openrouter_key', 'sk-or-...')
// Reference it by name — no raw keys in code
const theazo = new Theazo({
apiKey: 'th_live_...',
models: {
baseUrl: 'https://openrouter.ai/api/v1',
credentialRef: 'openrouter_key', // resolved at runtime
},
})
// Works the same with direct provider BYOI
const theazo2 = new Theazo({
apiKey: 'th_live_...',
models: {
provider: 'anthropic',
credentials: { credentialRef: 'my_anthropic_key' },
},
})credentialRef over raw apiKey for production deployments.Per-agent model selection
Model selection supports a 2-level override hierarchy. Set a default at the platform level and override per-agent.
// Level 1: Platform default — all agents use Claude Sonnet
const theazo = new Theazo({
apiKey: 'th_live_...',
defaultModel: 'anthropic/claude-sonnet',
})
// Level 2: Agent override — this specific agent uses Haiku (cheap + fast)
const session = await theazo.sessions.forUser('user_123')
const triageAgent = await session.agents.create({
compute: 'python',
model: 'anthropic/claude-haiku', // overrides platform default
})
// Another agent in the same session inherits the platform default (Claude Sonnet)
const analystAgent = await session.agents.create({
compute: 'python',
// no model specified → inherits 'anthropic/claude-sonnet' from platform
})anthropic/claude-sonnet). If no model is specified at any level, Theazo falls back to Claude Sonnet as the default.API reference
theazo.models.list()Promise<Model[]>List all available models with pricing and capabilities.theazo.models.get(id)Promise<Model>Get a specific model by ID (e.g., 'anthropic/claude-sonnet').theazo.models.estimate(opts)Promise<CostEstimate>Estimate cost for a model call given input/output token counts.REST endpoints
/v1/modelsList all available models/v1/models/:idGet model details by ID/v1/models/estimateEstimate cost for token counts