VPT.Einkr.Client
2.0.0
dotnet add package VPT.Einkr.Client --version 2.0.0
NuGet\Install-Package VPT.Einkr.Client -Version 2.0.0
<PackageReference Include="VPT.Einkr.Client" Version="2.0.0" />
<PackageVersion Include="VPT.Einkr.Client" Version="2.0.0" />
<PackageReference Include="VPT.Einkr.Client" />
paket add VPT.Einkr.Client --version 2.0.0
#r "nuget: VPT.Einkr.Client, 2.0.0"
#:package VPT.Einkr.Client@2.0.0
#addin nuget:?package=VPT.Einkr.Client&version=2.0.0
#tool nuget:?package=VPT.Einkr.Client&version=2.0.0
VPT.Einkr.Client
A small, dependency-free .NET client for Einkr's OpenAI-compatible endpoint.
It talks to the standard POST /v1/chat/completions and GET /v1/models — the same surface any OpenAI
client uses — authenticated with a per-user Einkr API key. Use it when a tool just needs a
system + user → text completion without pulling in the rest of Einkr.
- Single request/response — no streaming, no tool calling, no server-side session.
- Depends only on the base class library (
System.Net.Http.Json). - Shaped as a near drop-in for the official OpenAI .NET SDK's
ChatClient.CompleteChat.
If you'd rather use the official
OpenAISDK, point it athttps://einkr.com/v1with your Einkr API key as the key — it hits the identical endpoint. This package is the lighter first-party option.
Install
dotnet add package VPT.Einkr.Client
Requires .NET 10.
Quick start
using VPT.Einkr.Client;
var einkr = new EinkrAIClient("Stratum-27B", "vrc_your_api_key");
ChatCompletion response = einkr.CompleteChat([
new SystemChatMessage("You are a terse assistant."),
new UserChatMessage("Name three primary colors.")
]);
Console.WriteLine(response.Content[0].Text);
Console.WriteLine($"{response.Usage.CompletionTokens} tokens, finish: {response.FinishReason}");
CompleteChat is synchronous; CompleteChatAsync is the same call with a CancellationToken.
API key
Generate one on Einkr's Profile → API Access tab (it looks like vrc_...). It is sent as a Bearer
token. Treat it as a secret — read it from configuration or an environment variable, don't hard-code it.
Choosing a model
The first argument is an Einkr model id. List what a deployment currently offers:
foreach (var m in einkr.GetModels())
Console.WriteLine($"{m.Id} (context: {m.ContextWindow})");
An unknown or disabled id fails the first call with a model_not_found error.
Base URL
The constructor's optional third argument is the host root; the client appends /v1 itself:
new EinkrAIClient("Stratum-27B", key); // https://einkr.com (default)
new EinkrAIClient("Stratum-27B", key, "https://einkr.com"); // same
new EinkrAIClient("Stratum-27B", key, "https://localhost:7199");// a local deployment
A URL that already ends in /v1 is accepted without doubling up. The EINKR_API_BASE_URL environment
variable overrides the default (but not an explicit argument).
Multi-turn conversations
The client is stateless. To continue a conversation, pass the previous result's History back in — it
already contains your messages plus the assistant's reply:
var first = einkr.CompleteChat([
new SystemChatMessage("You are a helpful assistant."),
new UserChatMessage("My name is Josh.")
]);
var second = einkr.CompleteChat([
..first.History,
new UserChatMessage("What's my name?")
]);
Thinking / reasoning
enableThinking is bool? and defaults to null — meaning use the model's server-side default.
Pass true or false to override it for a single call. Any reasoning the model produces is surfaced
on ChatCompletion.Reasoning (never folded into History).
var res = einkr.CompleteChat(
[new UserChatMessage("Is 91 prime? Think it through.")],
enableThinking: true);
Console.WriteLine(res.Reasoning); // the model's working, if any
Console.WriteLine(res.Content[0].Text);// the answer
reasoningEffort ("low" / "medium" / "high" / …) is an optional related knob, sent only when set.
Other options
einkr.CompleteChat(
messages,
maxTokens: 256, // output ceiling for this call
temperature: 0.2); // omitted when null -> the model's default applies
Result shape
ChatCompletion carries:
| Member | What it is |
|---|---|
Content[0].Text |
the completion text |
Reasoning |
reasoning output, or null |
FinishReason |
"stop", "length", … |
Model |
the underlying model actually served |
Usage |
PromptTokens / CompletionTokens / TotalTokens |
History |
your messages plus this reply, for the next turn |
Errors
A non-success response throws EinkrAIException, with the OpenAI error envelope's message where present
(otherwise the raw body):
try
{
var res = einkr.CompleteChat([new UserChatMessage("Hi")]);
}
catch (EinkrAIException ex)
{
Console.Error.WriteLine(ex.Message); // e.g. "Einkr returned 404: The model '...' does not exist..."
}
Upgrading from 1.x
2.0 retargets from Einkr's own /api/completions to the OpenAI-compatible /v1 surface. Two changes to
be aware of:
ModelInfois now(string Id, int? ContextWindow)—/v1/modelsreturns string ids, not the old numeric ids.enableThinkingis nowbool?(defaultnull= server default). ExistingenableThinking: true/falsecall sites keep working and now mean "force this for the call."
The EinkrAIClient / CompleteChat / Content[0].Text surface is otherwise unchanged.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 76 | 9/28/2026 |