401 missing bearer or basic authentication in header

Hi, I am getting 401 missing bearer or basic authentication in header when calling the Create message API even though the bearer is indeed attached to the header, what happens? it works perfectly fine with postman
Endpoint is also correct, here is the code snippet.

  public async Task<OpenAiMessage?> CreateMessage(string threadId, CreateMessageRequest request)
      var requestUri = $"{Endpoints.Threads}/{threadId}/messages/";
      var requestBody = JsonConvert.SerializeObject(request);

      using (var httpContent = new StringContent(requestBody, Encoding.UTF8, "application/json"))

              Console.WriteLine($"Headers: {JsonConvert.SerializeObject(_httpClient.DefaultRequestHeaders)}");
              Console.WriteLine($"Request Body: {requestBody}");

              using (var response = await _httpClient.PostAsync(requestUri, httpContent))
			var responseBody = await response.Content.ReadAsStringAsync();
                  return JsonConvert.DeserializeObject<OpenAiMessage>(responseBody);
          catch (HttpRequestException ex)
              // Log the exception, handle it, or rethrow with additional context
              Console.WriteLine($"Failed to send message: {ex.Message}");
              return null;

I do not see where you are setting your API key.

Here is another snippet

   public OpenAiClient(string apiKey, string organizationKey = "")
_settings = new OpenAiClientSettings();
_settings.ApiKey = apiKey;
_settings.BaseUri = new Uri("");
_settings.OrganizationKey = organizationKey;

_httpClient = new HttpClient();
_httpClient.BaseAddress = _settings.BaseUri;
_httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {_settings.ApiKey}");