zidane/ providers/ local
A provider for a local OpenAI-compatible server such as Ollama, llama.cpp or LM Studio.
import { … } from 'zidane/providers/local'src/providers/local.ts
Use local() when the model runs on your machine or network. Pass baseURL and defaultModel, or set LOCAL_LLM_BASE_URL and LOCAL_LLM_DEFAULT_MODEL. A key is optional. Set LOCAL_LLM_API_KEY for a server that checks one. For a model that makes tool-call mistakes, spread localReliabilityBehavior() from zidane into behavior. It caps tool output and steers the model when it writes a tool call as text.
import { createAgent } from 'zidane'
import { local } from 'zidane/providers/local'
const provider = local({ baseURL: 'http://localhost:11434/v1', defaultModel: 'llama3.1:8b' })
const agent = createAgent({ provider })
const stats = await agent.run({ prompt: 'Say hello.' })
console.log(stats.turns)Functions#
localFunction#
Local OpenAI-compatible LLM provider.
Thin wrapper around openaiCompat for self-hosted runtimes that
speak the standard POST /chat/completions + SSE dialect: Ollama, vLLM,
LM Studio, Lemonade, llama.cpp's server, text-generation-webui, etc.
Caching and reasoning are left off — local runtimes typically strict-
validate the request schema and would 400 on the extra fields. Override
capabilities when pointing at a vision-capable deployment.
function local(params?: LocalParams): ProviderParameters
| Name | Type | Description |
|---|---|---|
| params? | LocalParams | Base URL, API key, default model, capabilities and extra headers. |
Returns
Example
import { createAgent } from 'zidane'
import { local } from 'zidane/providers/local'
const agent = createAgent({
provider: local({ baseURL: 'http://localhost:11434/v1', defaultModel: 'llama3.1:8b' }),
})
await agent.run({ prompt: 'Say hello.' })Interfaces#
LocalParamsInterface#
Options for local.
interface LocalParamsProperties
| Name | Type | Description |
|---|---|---|
| apiKey? | string | Optional bearer key. Most local servers don't authenticate; some (vLLM
with |
| baseURL? | string | Base URL of the local OpenAI-compatible server.
Resolution order: explicit |
| capabilities? | ProviderCapabilities | Provider capability flags. Defaults to text-only — typical OSS local deployment. Override when pointing at a vision-capable runtime (e.g. Ollama serving a multimodal model, vLLM with a VLM). |
| defaultModel? | string | Default model id. Local runtimes have no fixed catalogue — whatever the
user has loaded (e.g. |
| extraHeaders? | Record<string, string> | Extra HTTP headers sent on every request. Forwarded to the underlying
|