chickadee » llm » openai-base-uri

openai-base-uriparameter

Parameter holding the base URL for the OpenAI-compatible API, including any path prefix (defaults to "https://api.openai.com/v1"). Endpoint segments (e.g. "chat/completions") are appended to this URL's path, and the scheme, host, and port are preserved. Override it to target any OpenAI-compatible server such as Ollama, vLLM, or LM Studio.

Note: Ollama exposes the OpenAI-compatible Chat Completions API, not the Responses API, so pair this with the openai-chat-provider. A value for OPENAI_API_KEY is still required (Ollama ignores it locally, so any non-empty string works).

(import llm llm-openai)

;; Point the OpenAI backend at a local Ollama server
(openai-base-uri "http://localhost:11434/v1")

;; Use the chat-completions provider with a local model
(llm/use-provider openai-chat-provider)
(define conv (llm/chat system: "You are a helpful assistant."
                       model: "llama3.1"
                       provider: openai-chat-provider))