Integration guide

.NET integration with Plugsky

Plugsky is a plain HTTPS JSON API with an OpenAI-compatible shape, so .NET works with HttpClient and System.Text.Json. No Plugsky-specific .NET package is required.

Short answer. Call Plugsky from .NET with HttpClient. POST to https://api.plugsky.com/v1/chat/completions with a Bearer key and a plugsky-* model ID. Chat, streaming, tools and embeddings work.

What the .NET integration covers

This page is for .NET applications calling Plugsky. The API is OpenAI-compatible HTTPS JSON. There is no official Plugsky .NET SDK; the examples use HttpClient with System.Text.Json, which ships with modern .NET. A community OpenAI-compatible .NET client also works if you prefer typed helpers.

Chat completion

C#
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;

var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("PLUGSKY_API_KEY"));

var payload = new {
    model = "plugsky-pro",
    messages = new[] { new { role = "user", content = "What is an OpenAI-compatible API?" } }
};
var content = new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json");
var resp = await client.PostAsync("https://api.plugsky.com/v1/chat/completions", content);
var json = await resp.Content.ReadAsStringAsync();
Console.WriteLine(json);

Parsing the response

Deserialize with JsonSerializer.Deserialize into a type with choices[].message.content and usage. Check resp.IsSuccessStatusCode before parsing.

Async and cancellation

Pass a CancellationToken to PostAsync and ReadAsStringAsync so callers can cancel long requests. Use IHttpClientFactory to avoid socket exhaustion, and set a timeout on the client. For high throughput, prefer streaming the response body instead of buffering the whole payload.

Streaming

Set stream: true and read the response stream line by line with StreamReader. Each data: line is a JSON chunk; the stream ends with data: [DONE].

Tool calling

Send tools as an array of function definitions and read choices[0].message.tool_calls. Execute the function and append a tool result message before the next call.

Embeddings

POST to /v1/embeddings with {"model":"plugsky-embed","input":"hello"}; read data[0].embedding, length 2048.

Limits and gotchas

Main text models: 262,144-token context; plugsky-mistral-medium and vision models: 131,072; plugsky-translate: 32,768; embeddings: 8,192 input. Builder: 256K input / 32K output per request; Scale: 512K input / 32K output. Concurrency: Builder 10 / 600 RPM, Scale 16 / 1,200 RPM, Hobby 4 / 120 RPM. Cap max_tokens at the plan output ceiling. Reuse a single HttpClient (or IHttpClientFactory) for connection pooling.

Common errors

  • 401: missing, revoked or wrong-host key.
  • 404: wrong base URL path or unknown model ID.
  • 400 (context): input plus reserved output exceeds the window.
  • 429: RPM, concurrency or daily quota exhausted. Honour Retry-After.
  • 5xx: retry with jittered backoff.

Production checklist

  • Pin model IDs; load keys from configuration or a secret manager.
  • Reuse a single HttpClient with timeouts.
  • Cap max_tokens; log request IDs, model ID, usage and latency.
  • Test 429 and context-overflow paths before launch.

What we did not verify

  • We did not benchmark latency or throughput.
  • We did not test every community .NET client.
  • We used https://api.plugsky.com/v1; confirm the host in your account docs.

Frequently asked questions

Is there an official Plugsky .NET SDK?

No. The API is OpenAI-compatible HTTPS JSON, so use HttpClient with System.Text.Json, or a community OpenAI-compatible .NET client.

What base URL should .NET code use?

Use https://api.plugsky.com/v1, including the /v1 suffix and without a trailing slash.

Does streaming work in .NET?

Yes. Set stream: true and read the response stream line by line; each data: line is a JSON chunk and the stream ends with data: [DONE].

Does tool calling work?

Yes via the tools parameter with standard OpenAI function schemas.

What embedding dimensions should I expect?

2,048 dimensions with an 8,192-token input window.

How do I fix a 401 or 404?

Confirm the key and host api.plugsky.com; use https://api.plugsky.com/v1 and a model ID from GET /v1/models.

Should I reuse HttpClient?

Yes. Use a single HttpClient or IHttpClientFactory for connection pooling.

Related pages

Run your .NET service on Plugsky

Start free, test your request path, then choose the plan that matches your concurrency.

Start Free → Read the docs

Sources

API behaviour was checked against the OpenAI API reference on 20 November 2026. Plugsky limits were checked against its docs on the same date.

Official pages used for this integration guide
SourcePage checkedChecked
OpenAIplatform.openai.com/docs/api-reference20 Nov 2026
Plugskyplugsky.com/docs and plugsky.com/pricing20 Nov 2026
Plugskyplugsky.com/models20 Nov 2026

Last checked 20 November 2026. Plugsky's canonical plan numbers live at /pricing; this page explains the integration and does not replace the plan terms.

Sources and dated checks

Checked 20 November 2026. Primary sources checked 20 November 2026: OpenAI API reference, Anthropic API getting started, Cloudflare Workers AI. Confirm current limits and pricing in the provider console before capacity planning.