Replies: 2 comments
-
Just adding an Authorization header with the API key seems to work for me. using OllamaSharp;
var uri = new Uri("https://ollama.com");
var ollama = new OllamaApiClient(uri);
ollama.SelectedModel = "gpt-oss:120b";
ollama.DefaultRequestHeaders.Add("Authorization", "Bearer [api_key]");
var chat = new Chat(ollama);
while (true)
{
var message = Console.ReadLine();
if (string.IsNullOrEmpty(message))
break;
await foreach (var answerToken in chat.SendAsync(message))
Console.Write(answerToken);
Console.WriteLine();
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
That worked nicely Raymond. Thank you!! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, do you think it is possible to include support for Ollama Turbo in the API? We need to be able to add the API key as a Bearer token in requests.
Beta Was this translation helpful? Give feedback.
All reactions