diff --git a/v2/constructors.go b/v2/constructors.go index 846c697..c819505 100644 --- a/v2/constructors.go +++ b/v2/constructors.go @@ -104,8 +104,9 @@ func Groq(apiKey string, opts ...ClientOption) *Client { return NewClient(groqProvider.New(apiKey, cfg.baseURL)) } -// Ollama creates a client for a local Ollama instance (OpenAI-compatible). -// No API key is required. Use WithBaseURL to point at a non-default host/port. +// Ollama creates a client for a local Ollama instance using the native +// /api/chat endpoint. No API key is required. Use WithBaseURL to point at a +// non-default host/port. // // Example: // @@ -117,3 +118,22 @@ func Ollama(opts ...ClientOption) *Client { } return NewClient(ollamaProvider.New("", cfg.baseURL)) } + +// OllamaCloud creates a client targeting Ollama Cloud (https://ollama.com). +// The apiKey is required and is sent as `Authorization: Bearer `. Use +// WithBaseURL to point at a private Ollama deployment that requires auth. +// +// Example: +// +// model := llm.OllamaCloud(os.Getenv("OLLAMA_API_KEY")).Model("kimi-k2.5") +func OllamaCloud(apiKey string, opts ...ClientOption) *Client { + cfg := &clientConfig{} + for _, opt := range opts { + opt(cfg) + } + baseURL := cfg.baseURL + if baseURL == "" { + baseURL = ollamaProvider.DefaultCloudBaseURL + } + return NewClient(ollamaProvider.New(apiKey, baseURL)) +}