Skip to main content
The SDK ships with zero hard dependencies on any specific vendor. You install & import only what you need.

Supported Providers

OpenAI

GPT models, embeddings, and function calling with full streaming support.

Anthropic

Claude models with OpenAI-compatible API interface.

Quick Start

Provider Features

Authentication

Environment Variables

Set your API keys as environment variables:

Explicit API Keys

Pass API keys directly to the provider functions:

Common Parameters

All providers support these common parameters:

Provider-Specific Features

OpenAI

  • Native structured output with response_format="json_object"
  • Function calling with full tool support
  • Embedding models with automatic batching
  • Vision models with multimodal support

Anthropic

  • OpenAI-compatible API using compatibility layer
  • Function calling via OpenAI SDK
  • Streaming support with real-time deltas
  • System prompts and message-based conversations

Bring Your Own Provider

Implement the LanguageModel or EmbeddingModel interface – only a handful of methods are required:
Pass an instance to generate_text and you instantly get the full SDK experience (tool-calling, streaming, …) without writing another line of glue code.
We maintain zero coupling between helpers and providers, so community packages can live in separate repos.

Error Handling

All providers handle common errors gracefully:
Common error scenarios:
  • Invalid API key - Check your credentials
  • Rate limiting - Implement exponential backoff
  • Model not found - Verify model name
  • Token limit exceeded - Reduce input length

Best Practices

1. Use Environment Variables

Keep API keys secure:

2. Set Default Parameters

Configure once, use everywhere:

3. Handle Rate Limits

Implement retry logic for production:

4. Monitor Usage

Track token usage for cost management: