Installation
OpenAI
Environment Variable
Usage
Streaming
Anthropic
Environment Variable
Usage
Streaming
Environment Variable
Usage
Streaming
Provider Override
The SDK automatically detects the provider based on the model name. For custom or fine-tuned models not in the built-in list, specify the provider explicitly:API Key Override
Override the environment variable for a specific request:- Multi-tenant applications with per-customer API keys
- Testing with different API keys
- Using organization-specific keys
Error Handling by Provider
Provider Comparison
| Feature | OpenAI | Anthropic | |
|---|---|---|---|
| System messages | Native support | Native support | Converted internally |
| Temperature range | 0-2 | 0-1 | 0-2 |
| Max output tokens | Model-dependent | Model-dependent | Model-dependent |
| Stop sequences | Supported | Supported | Supported |
| Streaming | Supported | Supported | Supported |
| Tool calling | Supported | Supported | Supported |

