Built from a maintained OpenAPI description because Gonka does not currently publish a direct SDK OpenAPI document.
Direct network auth
Signs each request with secp256k1 ECDSA and sends the Gonka requester headers required by provider endpoints.
Modern .NET
Targets current .NET practices including nullability, trimming, NativeAOT awareness, and source-generated serialization.
Docs from examples
Examples stay in sync between the README, MkDocs site, and integration tests through the AutoSDK docs pipeline.
Usage
1 2 3 4 5 6 7 8 91011121314151617
usingGonka;usingvarclient=awaitGonkaClient.CreateFromEnvironmentAsync();varresponse=awaitclient.CreateChatCompletionAsync(newCreateChatCompletionRequest{Model="Qwen/Qwen3-235B-A22B-Instruct-2507-FP8",Messages=[ new ChatCompletionMessage { Role = ChatCompletionMessageRole.User, Content = "Hello, Gonka!", }, ],});
Set GONKA_PRIVATE_KEY plus either GONKA_ENDPOINTS (https://host/v1;gonka1provider...) or GONKA_SOURCE_URL. GONKA_ADDRESS can override the derived requester address.
Generate
Basic example showing how to create a client and make a request.
1 2 3 4 5 6 7 8 9101112131415161718192021
// Direct Gonka requests are signed with your Gonka private key.// Provide either GONKA_ENDPOINTS (`https://host/v1;gonka1provider...`) or GONKA_SOURCE_URL for endpoint discovery.usingvarclient=awaitGetAuthenticatedClientAsync().ConfigureAwait(false);varmodel=Environment.GetEnvironmentVariable("GONKA_CHAT_MODEL")is{Length:>0}modelValue?modelValue:"Qwen/Qwen3-235B-A22B-Instruct-2507-FP8";varresponse=awaitclient.CreateChatCompletionAsync(newCreateChatCompletionRequest{Model=model,Messages=[ new ChatCompletionMessage { Role = ChatCompletionMessageRole.User, Content = "Hello, Gonka!", }, ],}).ConfigureAwait(false);
Stream Chat
Streaming example showing how to read server-sent chat completion chunks.
1 2 3 4 5 6 7 8 9101112131415161718192021222324
// Streaming requests use the same direct Gonka signing layer as non-streaming requests.usingvarclient=awaitGetAuthenticatedClientAsync().ConfigureAwait(false);varmodel=Environment.GetEnvironmentVariable("GONKA_CHAT_MODEL")is{Length:>0}modelValue?modelValue:"Qwen/Qwen3-235B-A22B-Instruct-2507-FP8";varchunks=newList<CreateChatCompletionResponse>();awaitforeach(varchunkinclient.CreateChatCompletionStreamingAsync(newCreateChatCompletionRequest{Model=model,Messages=[ new ChatCompletionMessage { Role = ChatCompletionMessageRole.User, Content = "Write one short sentence about Gonka.", }, ],})){chunks.Add(chunk);}
Microsoft.Extensions.AI Chat Client
MEAI example showing how to use Gonka through the standard IChatClient abstraction.
1 2 3 4 5 6 7 8 91011
// The Gonka client implements Microsoft.Extensions.AI.IChatClient for shared chat workflows.usingvarclient=awaitGetAuthenticatedClientAsync().ConfigureAwait(false);Microsoft.Extensions.AI.IChatClientchatClient=client;varmodel=Environment.GetEnvironmentVariable("GONKA_CHAT_MODEL")is{Length:>0}modelValue?modelValue:"Qwen/Qwen3-235B-A22B-Instruct-2507-FP8";varresponse=awaitchatClient.GetResponseAsync([new Microsoft.Extensions.AI.ChatMessage(Microsoft.Extensions.AI.ChatRole.User, "Write one short sentence about Gonka.")],newMicrosoft.Extensions.AI.ChatOptions{ModelId=model}).ConfigureAwait(false);