# One API for 50+ AI Models

> Access GPT-4, Claude Sonnet, Gemini Pro, Llama, and other models through a unified interface with intelligent routing and automatic fallbacks. Switch providers instantly with multi-provider redundancy.

Canonical: https://models.do/

## In code

```ts
import { Models } from 'models.do'

// Intelligent routing selects best model per task
on.User.submits.Content($ => {
  const result = await Models.complete({
    task: $.task, // classify, summarize, generate, analyze
    input: $.text,
    routing: 'auto' // GPT-4 → Claude → Gemini → Llama fallback
  })
  return result
})

// Cost-optimize: cheap models for simple tasks, smart for complex
Models.analyze.with.CheapestModel({ text })  // Llama/Gemini Flash
Models.reason.with.SmartestModel({ problem })  // GPT-4/Claude Opus
```

## Frequently asked questions

### What AI models are available through models.do?

OpenAI (GPT-4, GPT-4 Turbo, GPT-3.5 Turbo), Anthropic (Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Haiku), Google (Gemini Pro 1.5, Gemini Flash), Meta (Llama 3 8B/70B), Mistral (Mixtral 8x7B, Mistral Large), Cohere (Command R+), and 40+ other models via OpenAI-compatible endpoints. Add custom models by providing API endpoint and authentication. All models accessible through identical API—switch by changing one parameter.

### How does intelligent routing select the best model?

Models.do analyzes task type (classification vs generation vs reasoning), input length (long context → Gemini/Claude), required speed (<500ms → fast models like GPT-3.5), output format (structured JSON → models good at tool use), cost constraints (budget limits), and historical performance. Machine learning optimizes routing based on your usage patterns. Override with custom routing rules. Save 40-60% on costs vs always using GPT-4 while maintaining quality.

### What happens if my preferred model is unavailable?

Automatic failover to backup models in <200ms. Default chain: GPT-4 → Claude → Gemini → Llama. Configure custom chains per use case or globally. Models.do tracks provider uptime in real-time and routes around outages automatically. 99.99% uptime SLA backed by multi-provider redundancy. We've maintained 100% uptime since launch by failing over during provider incidents.

### Can I A/B test different models for my use case?

Yes. Split traffic between models (e.g., 50% GPT-4, 50% Claude) with automatic quality tracking (accuracy, latency, cost, user satisfaction). Define success metrics and statistical significance thresholds. Automatic winner selection promotes best performer. Gradual rollouts (10% → 50% → 100%) minimize risk. Test prompts, temperatures, and system instructions too. Full experimentation dashboard shows real-time results.

### How do you optimize costs across different models?

Intelligent routing uses cheapest adequate model (Llama/Gemini Flash for simple tasks, GPT-4 for complex reasoning). Automatic prompt compression reduces tokens by 30-50%. Semantic response caching avoids redundant API calls—identical prompts return cached results. Batch processing combines multiple requests. Per-model cost tracking with budget alerts and limits. Typical savings: 50-70% vs naive GPT-4-only usage. ROI calculator shows cost savings per use case.

## Part of Platform.do

models.do is one of the primitives of Platform.do, in the Insight layer (measure, test and trace). Every .do shares one grammar, Business-as-Code, and one SDK.

- What is Business-as-Code? https://platform.do/business-as-code
- Platform.do: https://platform.do/
- Docs: https://docs.platform.do
