Short answer. Call Plugsky from Go with net/http. 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 Go integration covers
This page is for Go applications calling Plugsky. The API is OpenAI-compatible HTTPS JSON, so any Go HTTP client works. There is no official Plugsky Go SDK; use net/http directly or a community OpenAI-compatible Go client. The examples below use the standard library so they have no third-party dependency.
Chat completion with net/http
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
)
type msg struct {
Role string `json:"role"`
Content string `json:"content"`
}
func main() {
body, _ := json.Marshal(map[string]any{
"model": "plugsky-pro",
"messages": []msg{{Role: "user", Content: "What is an OpenAI-compatible API?"}},
})
req, _ := http.NewRequest("POST", "https://api.plugsky.com/v1/chat/completions", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("PLUGSKY_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
fmt.Println(string(raw))
}Parsing the response
Unmarshal into a struct with choices[].message.content and usage. Keep the HTTP status check explicit: 401, 404, 429 and 5xx need different handling.
type choice struct {
Message struct {
Content string `json:"content"`
} `json:"message"`
}
type result struct {
Choices []choice `json:"choices"`
Usage struct {
TotalTokens int `json:"total_tokens"`
} `json:"usage"`
}Streaming
Set stream: true and read the response body line by line. Each data: line is a JSON chunk; the stream ends with data: [DONE].
// set "stream": true in the request body, then:
scanner := bufio.NewScanner(resp.Body)
for scanner.Scan() {
line := scanner.Text()
if !strings.HasPrefix(line, "data: ") { continue }
if line == "data: [DONE]" { break }
// parse JSON chunk, print delta content
}Tool calling
Send tools as an array of function definitions and read choices[0].message.tool_calls. Execute the function in your code and append a tool result message before the next call.
Embeddings
// POST /v1/embeddings with {"model":"plugsky-embed","input":"hello"}
// response: data[0].embedding, length 2048Limits 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. Use a context with timeout and reuse an *http.Client with 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 an
*http.Clientwith timeouts and connection pooling. - 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 Go client.
- We used
https://api.plugsky.com/v1; confirm the host in your account docs.
Frequently asked questions
Is there an official Plugsky Go SDK?
No. The API is OpenAI-compatible HTTPS JSON, so use net/http or a community OpenAI-compatible Go client.
What base URL should Go code use?
Use https://api.plugsky.com/v1, including the /v1 suffix and without a trailing slash.
Does streaming work in Go?
Yes. Set stream: true and read the response body 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.
How should I handle retries?
Honour Retry-After on 429 and use jittered backoff on 5xx; reuse a single http.Client with timeouts.
Related pages
Run your Go 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.