From a1cd9c59feda3ac279427ad4039a7dd9d8b37b87 Mon Sep 17 00:00:00 2001 From: Christo du Toit Date: Fri, 24 Oct 2025 16:12:28 +0100 Subject: [PATCH 1/4] CODE RUB: Change to add ApiKey as X-API-Key header --- Standard.AI.PeerLLM/Brokers/PeerLLMs/PeerLLMBroker.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Standard.AI.PeerLLM/Brokers/PeerLLMs/PeerLLMBroker.cs b/Standard.AI.PeerLLM/Brokers/PeerLLMs/PeerLLMBroker.cs index 5b3dfb8..9de81ff 100644 --- a/Standard.AI.PeerLLM/Brokers/PeerLLMs/PeerLLMBroker.cs +++ b/Standard.AI.PeerLLM/Brokers/PeerLLMs/PeerLLMBroker.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Net.Http; -using System.Net.Http.Headers; using System.Runtime.CompilerServices; using System.Text; using System.Text.Json; @@ -106,10 +105,9 @@ private HttpClient SetupHttpClient() if (!string.IsNullOrWhiteSpace(this.peerLLMConfiguration.ApiKey)) { - httpClient.DefaultRequestHeaders.Authorization = - new AuthenticationHeaderValue( - scheme: "Bearer", - parameter: this.peerLLMConfiguration.ApiKey); + httpClient.DefaultRequestHeaders.Add( + name: "X-API-Key", + value: this.peerLLMConfiguration.ApiKey); } return httpClient; From 15612380136a67a05308d487f9e084cf61b6cfb4 Mon Sep 17 00:00:00 2001 From: Christo du Toit Date: Fri, 24 Oct 2025 16:17:52 +0100 Subject: [PATCH 2/4] ShouldStartChatAsync -> PASS --- .../Clients/V1/Chats/ChatClientV1Tests.StartChat.cs | 2 +- .../Clients/V2/Chats/ChatClientV2Tests.StartChat.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.StartChat.cs b/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.StartChat.cs index 9182833..69431f7 100644 --- a/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.StartChat.cs +++ b/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.StartChat.cs @@ -31,7 +31,7 @@ public async Task ShouldStartChatAsync() Request.Create() .UsingPost() .WithPath("/api/chats/start") - .WithHeader("Authorization", $"Bearer {this.apiKey}") + .WithHeader("X-API-Key", this.apiKey) .WithHeader("Content-Type", "application/json; charset=utf-8") .WithBody(expectedBody)) .RespondWith( diff --git a/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.StartChat.cs b/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.StartChat.cs index 1797144..6f33faa 100644 --- a/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.StartChat.cs +++ b/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.StartChat.cs @@ -37,7 +37,7 @@ public async Task ShouldStartChatAsync() Request.Create() .UsingPost() .WithPath("/api/v2/chats/start") - .WithHeader("Authorization", $"Bearer {this.apiKey}") + .WithHeader("X-API-Key", this.apiKey) .WithHeader("Content-Type", "application/json; charset=utf-8") .WithBody(expectedBody)) .RespondWith( From 85914532f03072e5025abf03b01e5ae74580418e Mon Sep 17 00:00:00 2001 From: Christo du Toit Date: Fri, 24 Oct 2025 16:18:19 +0100 Subject: [PATCH 3/4] ShouldStreamChatAsync -> PASS --- .../Clients/V1/Chats/ChatClientV1Tests.StreamChat.cs | 2 +- .../Clients/V2/Chats/ChatClientV2Tests.StreamChat.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.StreamChat.cs b/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.StreamChat.cs index e35e655..167fa34 100644 --- a/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.StreamChat.cs +++ b/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.StreamChat.cs @@ -30,7 +30,7 @@ public async Task ShouldStreamChatAsync() Request.Create() .UsingPost() .WithPath("/api/chats/stream") - .WithHeader("Authorization", $"Bearer {this.apiKey}") + .WithHeader("X-API-Key", this.apiKey) .WithHeader("Content-Type", "application/json; charset=utf-8") .WithBody(expectedBody)) .RespondWith( diff --git a/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.StreamChat.cs b/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.StreamChat.cs index 7fd7c01..4386750 100644 --- a/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.StreamChat.cs +++ b/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.StreamChat.cs @@ -30,7 +30,7 @@ public async Task ShouldStreamChatAsync() Request.Create() .UsingPost() .WithPath("/api/v2/chats/stream") - .WithHeader("Authorization", $"Bearer {this.apiKey}") + .WithHeader("X-API-Key", this.apiKey) .WithHeader("Content-Type", "application/json; charset=utf-8") .WithBody(expectedBody)) .RespondWith( From 7fb9f4e660f2f2da01183fd3821d27b652a448f5 Mon Sep 17 00:00:00 2001 From: Christo du Toit Date: Fri, 24 Oct 2025 16:18:37 +0100 Subject: [PATCH 4/4] ShouldEndChatAsync -> PASS --- .../Clients/V1/Chats/ChatClientV1Tests.EndChat.cs | 2 +- .../Clients/V2/Chats/ChatClientV2Tests.EndChat.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.EndChat.cs b/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.EndChat.cs index f514e3a..0c8459a 100644 --- a/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.EndChat.cs +++ b/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V1/Chats/ChatClientV1Tests.EndChat.cs @@ -25,7 +25,7 @@ public async Task ShouldEndChatAsync() Request.Create() .UsingPost() .WithPath("/api/chats/end") - .WithHeader("Authorization", $"Bearer {this.apiKey}") + .WithHeader("X-API-Key", this.apiKey) .WithHeader("Content-Type", "application/json; charset=utf-8") .WithBody(expectedBody) ) diff --git a/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.EndChat.cs b/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.EndChat.cs index d220dc5..b984322 100644 --- a/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.EndChat.cs +++ b/Standard.AI.PeerLLM.Tests.Acceptance/Clients/V2/Chats/ChatClientV2Tests.EndChat.cs @@ -25,7 +25,7 @@ public async Task ShouldEndChatAsync() Request.Create() .UsingPost() .WithPath("/api/v2/chats/end") - .WithHeader("Authorization", $"Bearer {this.apiKey}") + .WithHeader("X-API-Key", this.apiKey) .WithHeader("Content-Type", "application/json; charset=utf-8") .WithBody(expectedBody) )