v0.16.0¶
Add OpenRouter as a thick provider, enabling access to 300+ AI models through a single unified API.
Highlights¶
- OpenRouter Provider: Access Claude, GPT-4, Gemini, Llama, Mistral, and 300+ other models through OpenRouter's unified API
- Full Feature Support: Streaming, tool calling, vision, and JSON mode
- OAuth Authentication: Built-in PKCE flow for secure interactive authentication
Added¶
OpenRouter Thick Provider¶
The new omni-openrouter module provides SDK-based integration with OpenRouter:
import "github.com/plexusone/omnillm"
client, _ := omnillm.NewClient(omnillm.ClientConfig{
Provider: omnillm.ProviderNameOpenRouter,
APIKey: os.Getenv("OPENROUTER_API_KEY"),
})
resp, _ := client.CreateChatCompletion(ctx, &omnillm.ChatCompletionRequest{
Model: "anthropic/claude-3.5-sonnet",
Messages: []omnillm.Message{
{Role: omnillm.RoleUser, Content: "Hello!"},
},
})
Provider Constant¶
New ProviderNameOpenRouter constant for configuration:
Feature Support¶
| Feature | Supported |
|---|---|
| Streaming | Yes |
| Tool Calling | Yes |
| Vision | Yes |
| JSON Mode | Yes |
| System Role | Yes |
Available Models¶
OpenRouter provides access to models from multiple providers:
- Anthropic: claude-opus-4, claude-sonnet-4, claude-3.5-sonnet, etc.
- OpenAI: gpt-4-turbo, gpt-4o, gpt-3.5-turbo, etc.
- Google: gemini-pro, gemini-1.5-pro, etc.
- Meta: llama-3-70b, llama-3.1-405b, etc.
- Mistral: mixtral-8x22b, mistral-large, etc.
- And 300+ more
Model names use the format provider/model-name (e.g., anthropic/claude-3.5-sonnet).
Dependencies¶
github.com/plexusone/omni-openrouterv0.1.0
Installation¶
Requirements¶
- Go 1.26+