diff options
Diffstat (limited to 'libpanto/src')
| -rw-r--r-- | libpanto/src/provider_anthropic_messages.zig | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libpanto/src/provider_anthropic_messages.zig b/libpanto/src/provider_anthropic_messages.zig index 5721e4a..258ddbd 100644 --- a/libpanto/src/provider_anthropic_messages.zig +++ b/libpanto/src/provider_anthropic_messages.zig @@ -5,10 +5,10 @@ //! //! Responsibilities: //! - Convert `Conversation` → request JSON (delegated to anthropic_messages_json.zig) -//! - POST to `{base_url}/messages` with `stream: true` -//! (caller is responsible for the `/v1` version segment; panto will -//! introduce a new `anthropic_messages_v2` API style for v2 rather than -//! pulling the version into the provider) +//! - POST to `{base_url}/v1/messages` with `stream: true` +//! (the provider owns the current `/v1` suffix; a future wire revision +//! would add a new `anthropic_messages_v2` API style rather than guessing +//! from the configured base URL) //! - Read the chunked body, feed bytes through SSEParser //! - Parse each event payload, drive a thin assembly loop, and emit Receiver //! callbacks. Anthropic gives us explicit block boundaries, so no @@ -72,10 +72,11 @@ pub const AnthropicMessagesRequest = struct { rr.state.deinit(); } + const trimmed_base = std.mem.trim(u8, self.config.base_url, "/"); const url = try std.fmt.allocPrint( self.allocator, - "{s}/messages", - .{self.config.base_url}, + "{s}/v1/messages", + .{trimmed_base}, ); defer self.allocator.free(url); @@ -1270,7 +1271,7 @@ test "oauth-backed anthropic auth uses bearer auth" { test "plain anthropic auth uses x-api-key" { const cfg: config_mod.AnthropicMessagesConfig = .{ .api_key = "k", - .base_url = "https://api.anthropic.com/v1", + .base_url = "https://api.anthropic.com", .model = "claude-sonnet-4-5", }; try testing.expect(!headerSliceUsesBearerAuth(&cfg)); |
