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/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/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.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) ) 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( 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( 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;