Short answer. Call Plugsky from Rust with reqwest. 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 Rust integration covers
This page is for Rust applications calling Plugsky. The API is OpenAI-compatible HTTPS JSON, so any HTTP client works. There is no official Plugsky Rust SDK; the examples use reqwest with serde for (de)serialization, which is the common Rust stack.
Dependencies
[dependencies]
reqwest = { version = "0.12", features = ["json"] }
serde = { version = "1", features = ["derive"] }
tokio = { version = "1", features = ["full"] }Chat completion
use serde::{Deserialize, Serialize};
#[derive(Serialize)]
struct Msg { role: String, content: String }
#[derive(Serialize)]
struct Req { model: String, messages: Vec }
#[derive(Deserialize)]
struct Choice { message: Msg }
#[derive(Deserialize)]
struct Resp { choices: Vec }
#[tokio::main]
async fn main() -> Result<(), Box> {
let client = reqwest::Client::new();
let req = Req {
model: "plugsky-pro".into(),
messages: vec![Msg { role: "user".into(), content: "What is an OpenAI-compatible API?".into() }],
};
let resp: Resp = client
.post("https://api.plugsky.com/v1/chat/completions")
.bearer_auth(std::env::var("PLUGSKY_API_KEY")?)
.json(&req)
.send().await?
.json().await?;
println!("{}", resp.choices[0].message.content);
Ok(())
} Streaming
Set stream: true and read the response body as a byte stream, splitting on newlines. 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 reqwest::Client 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 environment or a secret manager.
- Reuse a single
reqwest::Clientwith 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 Rust client.
- We used
https://api.plugsky.com/v1; confirm the host in your account docs.
Frequently asked questions
Is there an official Plugsky Rust SDK?
No. The API is OpenAI-compatible HTTPS JSON, so use reqwest or any HTTP client with serde.
What base URL should Rust code use?
Use https://api.plugsky.com/v1, including the /v1 suffix and without a trailing slash.
Does streaming work in Rust?
Yes. Set stream: true and read the body as a byte stream; 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 the HTTP client?
Yes. Create one reqwest::Client and reuse it for connection pooling and keep-alive.
Related pages
Run your Rust service on Plugsky
Start free, test your request path, then choose the plan that matches your concurrency.
Start Free → Read the docsSources
API behaviour was checked against the OpenAI API reference on 20 November 2026. Plugsky limits were checked against its docs on the same date.
| Source | Page checked | Checked |
|---|---|---|
| OpenAI | platform.openai.com/docs/api-reference | 20 Nov 2026 |
| Plugsky | plugsky.com/docs and plugsky.com/pricing | 20 Nov 2026 |
| Plugsky | plugsky.com/models | 20 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.