.do
AI & Intelligence

models

AI model management and selection

models

AI model management for discovering, selecting, and routing between language models across multiple providers with automatic fallback and cost optimization.

Overview

The models primitive provides centralized management of AI models including provider routing, model selection, cost optimization, performance monitoring, and automatic fallback strategies.

Parent Primitive: llm - Universal LLM interface

SDK Object Mapping

This primitive maps to the ai SDK object for model management:

import { ai, models } from 'sdk.do'

// AI - Use specific model (ai is one of 8 core SDK objects)
const response = await ai.generate({
  prompt: 'Explain quantum computing',
  model: 'gpt-5',
  provider: 'openai.llm.do',
})

// List available models
const availableModels = await models.list({
  provider: 'openai',
  capabilities: ['text-generation', 'function-calling'],
})

// Get model info
const modelInfo = await models.get('gpt-5')
console.log(`Context window: ${modelInfo.contextWindow}`)
console.log(`Cost per token: $${modelInfo.costPerToken}`)

// Select best model for task
const bestModel = await models.select({
  task: 'code-generation',
  maxCost: 0.01,
  minContextWindow: 128000,
})

// Model routing with fallback
const response2 = await ai.generate({
  prompt: 'Complex task...',
  models: [
    { provider: 'openai', model: 'gpt-5' },
    { provider: 'anthropic', model: 'claude-sonnet-4.5' }, // Fallback
    { provider: 'meta', model: 'llama-4' }, // Second fallback
  ],
})

Quick Example

import { ai, models } from 'sdk.do'

// List available models
const models = await models.list()

// Select best model for task
const model = await models.select({
  task: 'code-generation',
  maxCost: 0.01,
  minContextWindow: 128000,
})

// Use selected model
const code = await ai.generate({
  prompt: 'Write a React component',
  model: model.name,
  provider: model.provider,
})

Core Capabilities

  • Multi-Provider - OpenAI, Anthropic, Google, Meta, and more
  • Model Discovery - Browse available models by capability
  • Cost Optimization - Select models based on price and performance
  • Automatic Fallback - Route to backup models on failure
  • Performance Monitoring - Track model latency and success rates

Access Methods

SDK

TypeScript/JavaScript library for AI model management

await models.list({ provider: 'openai', capabilities: ['text-generation'] })

SDK Documentation

CLI

Command-line tool for model operations

do models list --provider openai --capability text-generation

CLI Documentation

API

REST/RPC endpoints for model management

curl https://api.do/v1/models?provider=openai&capability=text-generation

API Documentation

MCP

Model Context Protocol for AI-driven model selection

List available OpenAI models with text generation capability

MCP Documentation

Parent Primitive

  • llm - Universal LLM interface

Sibling Primitives

  • ai - AI operations (SDK object mapping)
  • agents - AI agents (agentic functions)
  • functions - Generative functions (parent category)