zidane/ providers/ baseten
The Baseten Model APIs provider, with per-model reasoning settings.
import { … } from 'zidane/providers/baseten'src/providers/baseten.ts
Use baseten() when your agent runs on Baseten Model APIs. It reads BASETEN_API_KEY when you pass no key, and you can point baseURL at a dedicated deployment. planBasetenReasoning() maps a thinking level to the request shape each model expects.
import { createAgent } from 'zidane'
import { baseten } from 'zidane/providers/baseten'
const agent = createAgent({ provider: baseten({ defaultModel: 'zai-org/GLM-5.3' }) })
const stats = await agent.run({ prompt: 'Summarize README.md in three bullets.' })
console.log(stats.turns)Functions#
basetenFunction#
Baseten Model APIs provider.
Thin wrapper around openaiCompat pinned to the reasoning_content
round-trip mode: thinking arrives in the reasoning_content delta field and
is echoed back on assistant messages under the same name so reasoning
models resume their chain-of-thought across tool calls. The thinking level
maps to Baseten's request shape via planBasetenReasoning.
function baseten(params?: BasetenParams): ProviderParameters
| Name | Type | Description |
|---|---|---|
| params? | BasetenParams | API key, base URL, default model, capabilities, extra headers and prompt-cache key settings. |
Returns
Example
import { createAgent } from 'zidane'
import { baseten } from 'zidane/providers/baseten'
const agent = createAgent({
provider: baseten({ apiKey: process.env.BASETEN_API_KEY }),
})
await agent.run({ prompt: 'Say hello.' })planBasetenReasoningFunction#
Map zidane's thinking level to Baseten's per-model reasoning request shape:
reasoning_effortmodels (DeepSeek V4 Pro, GPT-OSS 120B) reason by default; the effort string tunes depth.'minimal'maps to'low', Anthropic-only upper tiers map to'high','adaptive'sends nothing (server default = medium);'off'sends nothing (cannot be disabled).- All other models opt in via
chat_template_args.enable_thinking— any non-off level enables it (the template arg is boolean, no depth knob).
Exported for tests.
function planBasetenReasoning(
ctx: { model: string; thinking?: 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'adaptive' },
): Record<string, unknown> | undefinedParameters
| Name | Type | Description |
|---|---|---|
| ctx | { model: string; thinking?: 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'adaptive' } | Request model id and thinking level. |
Returns
Record<string, unknown> | undefinedInterfaces#
BasetenParamsInterface#
Options for baseten.
interface BasetenParamsProperties
| Name | Type | Default | Description |
|---|---|---|---|
| apiKey? | string | API key. Falls back to the | |
| baseURL? | string | Override the base URL — e.g. point at a dedicated Baseten deployment's OpenAI-compatible bridge instead of the shared Model APIs endpoint. | |
| capabilities? | ProviderCapabilities | Provider capability flags. Default: | |
| defaultModel? | string | 'zai-org/GLM-5.3' | Model used when a request does not set one. |
| extraHeaders? | Record<string, string> | Extra HTTP headers sent on every request. Forwarded to the underlying
| |
| promptCacheKey? | PromptCacheKeyOption | Prompt-cache affinity key, sent as Expect no measurable effect on Baseten's own Model APIs: their load
balancer already routes on replica KV-cache state and caching is
unconditional. Worth enabling when a proxy or AI gateway sits in front (via
| |
| promptCacheKeyHeader? | string | Additionally send the affinity key as this HTTP header, for gateways that route on a header rather than a body field. |