Quickstart
Point an OpenAI SDK at Unrefused and make your first request in about a minute.
1. Base URL and key
Unrefused speaks the OpenAI API. Every SDK, agent framework and eval harness that takes a base URL works unchanged.
Base URL https://api.unrefused.com/v1
Auth Authorization: Bearer unr_live_…Create a key on the API keys page. Each key carries a policy profile, optional rate limits and an optional expiry. Keys are shown once; only a hash is stored.
2. First request
Python
from openai import OpenAI
client = OpenAI(base_url="https://api.unrefused.com/v1", api_key="unr_live_…")
r = client.chat.completions.create(
model="unrefused-glm-5.3-flash",
messages=[{"role": "user", "content": "Summarise this incident in two lines."}],
)
print(r.choices[0].message.content)TypeScript
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.unrefused.com/v1", apiKey: process.env.UNREFUSED_API_KEY });
const r = await client.chat.completions.create({
model: "unrefused-glm-5.3-flash",
messages: [{ role: "user", content: "Summarise this incident in two lines." }],
});
console.log(r.choices[0].message.content);curl
curl https://api.unrefused.com/v1/chat/completions \
-H "Authorization: Bearer $UNREFUSED_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"unrefused-glm-5.3-flash","messages":[{"role":"user","content":"Hello"}]}'3. What comes back
A standard OpenAI response, plus the policy decisions that were applied to it. The same information is in the response headers and in an unrefused object on the body.
x-request-id: req_93f1a1c7182d44e29542e08c
x-unrefused-policy: eval-harness@v14
x-unrefused-input: redacted=1
x-unrefused-output: pass
x-unrefused-retention: noneNothing you send is stored. Prompts and completions exist in memory for the life of the request. Only token counts, timing and decision codes are metered. See Zero data retention.
Next
- Stream responses with
stream: true, including the hold-back window for blocking. - Write a policy profile and attach it to a key.
- Connect a tool such as OpenCode, Codex or curl.
- Try the Chat page, which uses this same API from your browser.
Spot an error or a gap? Tell us — and quote x-request-id if you have one.