Azure OpenAI
Microsoft’s Azure-hosted OpenAI models with enterprise features.Installation
Azure OpenAI Responses Client
Recommended for new applications:Azure OpenAI Chat Client
Standard chat completions:Azure OpenAI Assistants Client
Persistent assistants with threads:Authentication Options
OpenAI
Direct access to OpenAI’s models.Installation
OpenAI Responses Client
OpenAI Chat Client
OpenAI Assistants Client
Anthropic
Claude models from Anthropic.Installation
Anthropic Client
Streaming Example
Azure AI Foundry
Azure AI Foundry Agent Service (V2) with project-based agents.Installation
Azure AI Agent Client
With Hosted MCP Tools
AWS Bedrock
AWS-hosted foundation models.Installation
Bedrock Chat Client
Ollama
Local open-source models.Installation
Ollama Chat Client
Not all Ollama models support function calling. Models like
llama3.2 and qwen2.5 support tools, while others may not.Provider Comparison
Provider Features
Common Features
All providers support:- Non-streaming and streaming responses
- Function/tool calling (model-dependent)
- Session management
- Middleware
- Chat options (temperature, max_tokens, etc.)
Provider-Specific Features
Azure OpenAI & OpenAI
- Code Interpreter: Execute Python code
- File Search: RAG over uploaded files
- Structured Output: JSON schema-based responses
- Web Search: Bing search integration (OpenAI only)
Anthropic
- Extended Thinking: Claude’s reasoning mode
- Prompt Caching: Reduce costs for repeated prompts
Azure AI Foundry
- Hosted MCP Tools: Pre-configured MCP integrations
- Project-Scoped Agents: Agents tied to Azure AI projects
- Memory Integration: Built-in Azure AI Search memory
Client Options
Common Options
All clients support these options:Runtime Options
Override options per-run:Custom Chat Clients
Create your own provider by implementingBaseChatClient:
Best Practices
Use environment variables for credentials
Use environment variables for credentials
Store API keys and endpoints in environment variables:
Choose the right authentication method
Choose the right authentication method
For Azure:
- Local development: Use
AzureCliCredential - Production: Use
ManagedIdentityCredentialorDefaultAzureCredential
Set appropriate timeouts
Set appropriate timeouts
Configure timeouts based on your use case:
Verify tool support
Verify tool support
Check if your model supports function calling before using tools. Not all models or providers support tools.
Use Azure for enterprise
Use Azure for enterprise
Azure OpenAI and Azure AI Foundry provide:
- Enterprise-grade security
- Data residency
- SLAs
- Managed identity authentication
Provider Selection Guide
Choose Azure OpenAI if you need:
- Enterprise security and compliance
- Data residency requirements
- Azure ecosystem integration
- Managed identity authentication
Choose OpenAI if you need:
- Latest model releases
- Web search capabilities
- Simpler setup for development
Choose Anthropic if you need:
- Claude’s advanced reasoning
- Extended context windows
- Strong safety features
Choose Azure AI Foundry if you need:
- Managed agent infrastructure
- Built-in memory and search
- Project-based organization
Choose Bedrock if you need:
- AWS ecosystem integration
- Multiple model providers (Anthropic, Meta, etc.)
- AWS security and compliance
Choose Ollama if you need:
- Local, offline operation
- Open-source models
- No API costs
- Full data privacy