@belte/anthropic 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/engine.ts +3 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belte/anthropic",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Anthropic Messages API engine for belte's agent() — a model-of-your-choosing assistant over your app's MCP surface",
6
6
  "license": "MIT",
package/src/engine.ts CHANGED
@@ -24,6 +24,8 @@ are no provider built-ins to fence here.
24
24
  type AnthropicConfig = {
25
25
  model: string
26
26
  apiKey: string
27
+ // Alternate Messages API origin — a gateway, a proxy, or a test double.
28
+ baseURL?: string
27
29
  maxTokens?: number
28
30
  effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'max'
29
31
  // Hard cap on tool-loop turns so a model that never stops requesting tools can't
@@ -103,7 +105,7 @@ function toolResultText(result: Record<string, unknown>): string {
103
105
  }
104
106
 
105
107
  export function engine(config: AnthropicConfig): AgentEngine {
106
- const client = new Anthropic({ apiKey: config.apiKey })
108
+ const client = new Anthropic({ apiKey: config.apiKey, baseURL: config.baseURL })
107
109
  const maxSteps = config.maxSteps ?? MAX_STEPS
108
110
  return async function* ({ surface, messages }) {
109
111
  /*