ChatCompletionClient interface.
OpenAI
The most commonly used provider:Available models
gpt-4o- Latest multimodal modelgpt-4o-mini- Faster, cheaper versiongpt-4-turbo- Previous generationgpt-3.5-turbo- Legacy, cheaper
Azure OpenAI
For Azure deployments:Anthropic
For Claude models:Available models
claude-3-5-sonnet-20241022- Latest, most capableclaude-3-5-haiku-20241022- Fast and efficientclaude-3-opus-20240229- Most powerful (legacy)
Extended thinking
Claude supports extended thinking mode:Ollama
For local models:Ollama requires running Ollama server locally. Install from ollama.com.
Available models
llama3.2- Meta’s Llama 3.2codellama- Code-specializedmistral- Mistral AI modelsphi3- Microsoft’s Phi-3
Llama.cpp
For GGUF models:Configuration options
All model clients support these common parameters:The model identifier
Sampling temperature (0.0 to 2.0). Lower = more deterministic.
Maximum tokens to generate
Nucleus sampling parameter
API key (can also use environment variables)
Streaming
Enable streaming for real-time responses:Token counting
Track token usage:Model comparison
| Provider | Strengths | Cost | Local |
|---|---|---|---|
| OpenAI | Most capable, multimodal | $$$ | No |
| Azure OpenAI | Enterprise features, compliance | $$$ | No |
| Anthropic | Long context, safety | $$$ | No |
| Ollama | Free, privacy | Free | Yes |
| Llama.cpp | Maximum control, GGUF support | Free | Yes |
Environment variables
Set API keys via environment variables:Switching providers
Switch between providers by changing the model client:Best practices
Use environment variables for API keys
Use environment variables for API keys
Never hardcode API keys in source code. Use environment variables or secret managers.
Start with smaller models
Start with smaller models
Test with cheaper models (gpt-4o-mini, claude-3-5-haiku) before using expensive ones.
Monitor token usage
Monitor token usage
Track token usage to control costs. Use
TokenUsageTermination in teams.Use local models for development
Use local models for development
Use Ollama or Llama.cpp for rapid development without API costs.
Next steps
Model Clients Guide
Full model client documentation
Azure Integration
Azure-specific configuration
Quickstart
Build your first agent
Examples
See model clients in action