Supported Providers
| Provider | Class | Default Model | Install Extra |
|---|---|---|---|
| OpenAI | OpenAIChat | gpt-4o | (core) |
| DeepSeek | DeepSeekChat | deepseek-chat | (core) |
| Moonshot | MoonshotChat | kimi-k2-turbo-preview | (core) |
| xAI | xAI | grok-3 | (core) |
| Anthropic | Claude | claude-sonnet-4-20250514 | pip install 'definable[anthropic]' |
| Mistral | MistralChat | mistral-large-latest | pip install 'definable[mistral]' |
Gemini | gemini-2.0-flash-001 | pip install 'definable[google]' | |
| Perplexity | Perplexity | pplx-70b-online | (core) |
| Ollama | Ollama | llama3 | pip install 'definable[ollama]' |
| OpenRouter | OpenRouter | — | (core) |
| Custom | OpenAILike | — | (core) |
Basic Usage
Common Parameters
All model classes accept these parameters:The model identifier (e.g.,
"gpt-4o", "deepseek-chat").API key for authentication. Defaults to the provider’s environment variable.
Override the API base URL. Useful for proxies or self-hosted endpoints.
Sampling temperature (0.0 to 2.0). Lower values are more deterministic.
Maximum number of tokens to generate.
Request timeout in seconds.
Maximum number of retries on transient failures.
Invocation Methods
Every model supports four ways to call it:| Method | Sync/Async | Streaming | Returns |
|---|---|---|---|
invoke() | Sync | No | ModelResponse |
ainvoke() | Async | No | ModelResponse |
invoke_stream() | Sync | Yes | Iterator[ModelResponse] |
ainvoke_stream() | Async | Yes | AsyncIterator[ModelResponse] |
Retry Configuration
All models support automatic retries with configurable backoff:Number of retry attempts on failure.
Base delay in seconds between retries.
Whether to use exponential backoff for retries.
Response Caching
Cache model responses locally for development and testing:Model Resolution from Strings
Agents accept string model shorthand — no explicit model import needed:openai, deepseek, moonshot, xai, anthropic, mistral, google, perplexity, ollama, openrouter
Next Steps
String Shorthand
Use string format instead of class imports.
Model Resilience
Key rotation, failover, and rate limit handling.
Streaming
Stream responses token-by-token.
Structured Output
Return Pydantic models from LLM calls.
Multimodal
Images, audio, video, and files.
Metrics & Pricing
Token counting and cost calculation.