Patterns for using custom LLM providers in Go
mainThe SDK supports several ways to integrate non-OpenAI providers, mirroring the patterns available in the Python SDK:
- Runner-level provider: Provide a custom
ModelProviderdirectly to theRunnerto control the provider for the entire execution context. - Per-agent client: Use
WithModelInstance(...)to set a specific custom client for an individual agent. - Global default client: Set a global default OpenAI client and default API (e.g.,
chat_completions) to be used across the application. - MultiProvider with prefix routing: When using LiteLLM, you can implement prefix routing (e.g., using
litellm/...prefixes) to route requests to different providers via a single entry point.