Models

Lab supports multiple AI providers and models. This reference covers available providers, popular models, and configuration.

Supported Providers

ProviderPrefixExample
OpenAIopenai:openai:gpt-4o
Anthropicanthropic:anthropic:claude-3-5-sonnet-latest
Googlegoogle:google:gemini-2.0-flash
AWS Bedrockbedrock:bedrock:anthropic.claude-3-5-sonnet
Coherecohere:cohere:command-r-plus
Mistralmistral:mistral:mistral-large-latest

Built-in Shortcuts

For convenience, these shortcuts are available without the provider prefix:

ShortcutFull Model ID
gpt4oopenai:gpt-4o
gpt4o-miniopenai:gpt-4o-mini
claudeanthropic:claude-3-5-sonnet-latest
claude-haikuanthropic:claude-3-5-haiku-latest
geminigoogle:gemini-2.0-flash
bedrock-claudebedrock:anthropic.claude-3-5-sonnet

Popular Models

OpenAI

ModelBest For
gpt-4oGeneral purpose, complex reasoning
gpt-4o-miniFast, cost-effective tasks
gpt-4-turboLong context, detailed outputs
o1-previewAdvanced reasoning, math

Anthropic

ModelBest For
claude-3-5-sonnet-latestBest balance of capability and speed
claude-3-5-haiku-latestFast, efficient for simple tasks
claude-3-opus-latestMost capable, complex analysis

Google

ModelBest For
gemini-2.0-flashFast, multimodal
gemini-1.5-proLong context, complex tasks

AWS Bedrock

ModelBest For
anthropic.claude-3-5-sonnetClaude via AWS
anthropic.claude-3-haikuFast Claude via AWS
amazon.titan-text-premierAWS native model

Configuration

Environment Variables

Set API keys as environment variables:

# OpenAI
export OPENAI_API_KEY=sk-...

export ANTHROPIC_API_KEY=sk-ant-...

export GOOGLE_API_KEY=...

AWS Bedrock

Bedrock uses AWS credentials. Configure via:

  • Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
  • AWS credentials file
  • IAM role (when running in AWS)

Default Model

Set a default model so you don’t need to specify it each time:

%config AiMagics.default_model_name = "anthropic:claude-3-5-sonnet-latest"

Listing Available Models

See what models are available:

# All models
%ai list

%ai list openai
%ai list anthropic

Creating Aliases

Register custom shortcuts:

# Create aliases
%ai register fast openai:gpt-4o-mini
%ai register best anthropic:claude-3-opus-latest

%%ai fast
Quick question about Python syntax

Choosing a Model

For Speed

Use smaller, faster models:

  • gpt4o-mini
  • claude-haiku
  • gemini-2.0-flash

For Quality

Use larger, more capable models:

  • gpt-4o
  • claude (sonnet)
  • claude-3-opus-latest

For Cost

Consider token usage and pricing:

  • Haiku and mini models are most economical
  • Use larger models only when needed
  • Shorter prompts reduce costs

For Privacy

If data sensitivity is a concern:

  • AWS Bedrock keeps data in your AWS account
  • Check provider data policies