DS0: no Data Safety payload inspection. CPEN still checks the account, model alias, credits, route health, and rate limits before dispatch.
CPEN API URL and model aliases.
Use https://cpenrouter.space/v1 as an OpenAI SDK base URL. Send cpen/* model aliases to chat completions, then choose a Data Safety boundary per key or request.
Use this exact URL anywhere a compatible SDK, gateway, agent, or AI coding tool asks for an API base URL. Do not append /chat/completions to the SDK base URL; the SDK adds endpoint paths itself. CPEN is independent and not affiliated with OpenAI.
CPEN client setup
Point your OpenAI client at CPEN for chat requests. The gpt-* aliases support tool calling and text-only streaming; streaming is text-only, without tools. Usage billing follows measured input and output tokens, with no separate tool-call fee.
curl https://cpenrouter.space/v1/chat/completions \
-H "authorization: Bearer cpen_live_..." \
-H "content-type: application/json" \
-d '{
"model": "cpen/gpt-5-4-mini",
"messages": [{"role": "user", "content": "Summarize this document."}]
}'const client = new OpenAI({
baseURL: "https://cpenrouter.space/v1",
apiKey: process.env.CPEN_API_KEY
});
await client.chat.completions.create({
model: "cpen/gpt-5-4-mini",
messages: [{ role: "user", content: "Summarize this document." }]
});from openai import OpenAI
client = OpenAI(
base_url="https://cpenrouter.space/v1",
api_key=os.environ["CPEN_API_KEY"],
)
response = client.chat.completions.create(
model="cpen/gpt-5-4-mini",
messages=[{"role": "user", "content": "Summarize this document."}],
)Data Safety Levels
Choose DS0-DS4 per API key or with routing.data_safety_level. DS0 performs no payload inspection. DS1 skips payload inspection; account trace storage is off by default, and when enabled can retain policy metadata and model responses for 30 days. DS2 redacts detected supported patterns; DS3 and DS4 block or deny matching requests. DS0 and DS1 have no Data Safety fee. DS2-DS4 add a fee equal to 1% of the model usage charge after cache reconciliation.
DS1: Data Safety inspection is skipped. Account trace storage is off by default; when enabled, it retains request policy metadata and model responses for 30 days.
DS2: detects supported patterns such as emails, phones, cards, government IDs, financial identifiers, and API secrets; detected matches are redacted before dispatch.
DS3: blocks requests matching supported sensitive patterns before dispatch.
DS4: denies requests matching supported sensitive patterns before dispatch.
Runnable chat aliases
These are the three stable aliases highlighted in this frontend and accepted by /v1/chat/completions. Use /v1/models for runtime discovery.
| Model | AI score |
|---|---|
| cpen/gpt-5-4-mini | 78% |
| cpen/gpt-5-6-luna | 88% |
| cpen/gpt-5-6-terra | 90% |
Managing keys from your own tooling
Everything the Keys page does is a REST call you can make yourself, authenticated with a signed-in dashboard session cookie.
# List keys (signed-in dashboard session)
curl -s https://cpenrouter.space/api/account/keys \
-H "Cookie: cpen_session=..."
# Create key
curl -s -X POST https://cpenrouter.space/api/account/keys \
-H "Content-Type: application/json" \
-H "Cookie: cpen_session=..." \
-d '{"label":"ci-bot","rpmLimit":120}'
# Update the per-key request-rate cap
curl -s -X PATCH https://cpenrouter.space/api/account/keys/{keyId} \
-H "Content-Type: application/json" \
-H "Cookie: cpen_session=..." \
-d '{"rpmLimit":1200}'
# Revoke key
curl -s -X DELETE https://cpenrouter.space/api/account/keys/{keyId} \
-H "Cookie: cpen_session=..."Authentication
OAuth signup creates an account usage ledger. Paid API calls use cpen_live API keys issued from the account dashboard.
Authorization: Bearer cpen_live_...
Compatibility subset
v1 supports JSON chat with content arrays, image_url/input_image parts, and OpenAI function/tool calling. Text-only streaming is available on the gpt-* aliases; tool calling uses standard buffered responses. Usage billing follows measured input and output tokens, with no separate tool-call fee.
JSON: model, messages, images, tools, tool_choice, assistant tool_calls, tool messages Streaming: text-only chat on gpt-* aliases with stream and optional stream_options.include_usage Tool calls: buffered responses (stream + tools returns 400 unsupported_streaming_request) Billing: measured input and output tokens; no separate tool-call fee
Set Data Safety level
For API requests, choose DS0-DS4 with routing.data_safety_level. Omit it to use the API-key default.
{
"model": "cpen/gpt-5-4-mini",
"messages": [{"role": "user", "content": "hello"}],
"routing": { "data_safety_level": 2 }
}AI agents and coding tools
For agents that accept a CPEN API endpoint, set the base URL to /v1 and use a cpen_live key. Mini and Luna support tool calling with OpenAI-compatible SSE streaming; streaming is text-only, without tools.
Base URL: https://cpenrouter.space/v1
Model: cpen/gpt-5-4-mini
Minimal body:
{
"model": "cpen/gpt-5-4-mini",
"messages": [{"role": "user", "content": "hello"}]
}
Discovery: GET /v1/modelsCPEN HTTP endpoints
All JSON APIs live under https://cpenrouter.space/v1 unless noted. Authenticated routes require a cpen_live API key.
| Method | Path | Purpose |
|---|---|---|
| GET | /v1/models | CPEN model list of runnable public model aliases. |
| POST | /v1/chat/completions | OpenAI Chat Completions with buffered responses and documented streaming capabilities. |
| POST | /v1/responses | Non-streaming Responses subset with text and function-call output. |
| POST | /v1/extractions | Structured extraction endpoint. |
| GET | /health | Liveness probe for load balancers. |
Response shape
Successful buffered chat completions use the documented JSON shape. Mini and Luna streaming requests use OpenAI-compatible SSE chunks, finish with data: [DONE] only after usage settlement, and can include final usage with stream_options.include_usage. Terra is buffered-only.
{
"id": "chatcmpl_...",
"object": "chat.completion",
"model": "cpen/gpt-5-4-mini",
"request_id": "req_...",
"choices": [{
"index": 0,
"message": { "role": "assistant", "content": "..." },
"finish_reason": "stop"
}],
"usage": { "prompt_tokens": 42, "completion_tokens": 18, "total_tokens": 60 },
"cpen_status": "completed",
"data_safety": { "level": 2, "action": "redacted", "redaction_count": 1 }
}Common errors
| Status | Meaning and action |
|---|---|
| 400 | unsupported_field or unsupported_model: correct the request before retrying. |
| 401 | Missing or invalid API key: replace the credential before retrying. |
| 402 | insufficient_credits: add usage credit before retrying. |
| 422 | validation_error: correct the field identified by param/details before retrying. |
| 429 | rate_limited: retry with backoff; the API does not currently return Retry-After. |
| 503/502 | upstream_unavailable: retry with bounded backoff and retain request_id for support. |
{
"error": {
"code": "unsupported_model",
"type": "unsupported_model",
"message": "Use one of the public cpen/* model aliases.",
"param": "model",
"details": {
"allowed_models": [
"cpen/gpt-5-4-mini",
"cpen/gpt-5-6-luna",
"cpen/gpt-5-6-terra"
]
}
},
"request_id": "req_..."
}