/v1/modelsEvery model your endpoint can route to.
Key: gw_ai_… or gw_sk_… with the AI Gateway scope
curl https://api.penstoke.com/v1/models \
-H "Authorization: Bearer $PENSTOKE_KEY"Docs
The whole surface your code talks to. The AI gateway speaks the OpenAI API, an upload asks for a signed URL, and a notification names an app and who should get it — there is nothing else to learn.
14 days, no card
Every call is a bearer token: Authorization: Bearer <key>. There are three kinds, and choosing wrongly is the most common first mistake — a 403 almost always means the key is real but is not the one this API wants.
gw_sk_…Server key
A general key carrying any of the scopes: Storage API, Storage delete, Push send, AI Gateway.
Dashboard → API keys
Server-side only — never ship it
gw_ai_…AI endpoint key
One AI endpoint, with that endpoint's own model routing and budget. Opens the AI API only.
Dashboard → AI gateway → Endpoints
Server-side only — never ship it
gw_push_…Push app key
One push app. Registers devices and reports opens — and nothing else, which is why it is the only key meant to ship inside an app.
Dashboard → Apps
Safe to ship inside an app
A key is shown once, when it is created or rotated. Only a hash is stored, so a key that is lost is rotated, never recovered.
Every example below already uses yours:
https://api.penstoke.comOpenAI-compatible. Point an existing SDK at the gateway by changing its base URL and key — the request and response bodies are the ones your client already speaks, streaming included. The response says which provider actually served it.
/v1/modelsEvery model your endpoint can route to.
Key: gw_ai_… or gw_sk_… with the AI Gateway scope
curl https://api.penstoke.com/v1/models \
-H "Authorization: Bearer $PENSTOKE_KEY"/v1/chat/completionsA chat completion, routed to your primary model and down your fallback list.
Key: gw_ai_… or gw_sk_… with the AI Gateway scope
Takes the OpenAI body: `model`, `messages`, and optionally `stream`, `temperature`, `top_p`, `max_tokens`, `max_completion_tokens`, `stop`. Unknown fields are passed through. A 429, a 5xx or a timeout moves the same request to the next provider in your order.
curl https://api.penstoke.com/v1/chat/completions \
-H "Authorization: Bearer $PENSTOKE_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"messages": [{ "role": "user", "content": "Say hello" }]
}'Your app never holds provider credentials. It asks the gateway for a short-lived signed URL and talks to the provider directly; which bucket a path lands in is a routing rule, not something your code knows.
/storage/v1/presignA signed URL to upload or download one object.
Key: gw_sk_… with the Storage API scope
`{ path, method }`, where method is `GET` or `PUT`. **A PUT must also declare `contentType` and `sizeBytes`** — both are signed into the URL, so the upload has to match exactly what was announced. `ttlMinutes` is optional and clamped by your routing rule. Uploads are namespaced per key under `uploads/<key id>/`, which is why the returned `key` differs from the path you sent.
curl -X POST https://api.penstoke.com/storage/v1/presign \
-H "Authorization: Bearer $PENSTOKE_KEY" \
-H "Content-Type: application/json" \
-d '{
"path": "/photos/avatar.png",
"method": "PUT",
"contentType": "image/png",
"sizeBytes": 20480
}'/storage/v1/uploads/completeConfirms the upload, so it is indexed and counted.
Key: gw_sk_… with the Storage API scope
`{ path }` — the same path you presigned. The object is verified at the provider against the size and type it declared; one that breaks the limits is deleted there and rejected. Skip this and the next bucket sync picks the object up instead.
curl -X POST https://api.penstoke.com/storage/v1/uploads/complete \
-H "Authorization: Bearer $PENSTOKE_KEY" \
-H "Content-Type: application/json" \
-d '{ "path": "/photos/avatar.png" }'/storage/v1/objects?path=…Removes one object this key uploaded.
Key: gw_sk_… with the Storage delete scope
The path goes in the **query string**, URL-encoded — a storage path contains slashes, and not every HTTP client sends a body on DELETE. Give it the path you uploaded with, or the `key` the presign returned; both name the same object. It reaches only this key's own uploads: never the media library, never another key's objects. Deleting twice gives 200 then 404.
curl -X DELETE "https://api.penstoke.com/storage/v1/objects?path=%2Fphotos%2Favatar.png" \
-H "Authorization: Bearer $PENSTOKE_KEY"
# Or let curl encode it for you:
curl -X DELETE --get --data-urlencode "path=/photos/avatar.png" \
"https://api.penstoke.com/storage/v1/objects" -H "Authorization: Bearer $PENSTOKE_KEY"/storage/v1/resolveWhich bucket and provider a path routes to.
Key: gw_sk_… with the Storage API scope
`{ path }`. Useful for checking a routing rule without uploading anything.
curl -X POST https://api.penstoke.com/storage/v1/resolve \
-H "Authorization: Bearer $PENSTOKE_KEY" \
-H "Content-Type: application/json" \
-d '{ "path": "/photos/avatar.png" }'Two different keys, and the split is the point: the app key registers devices and reports opens, and it is the one you ship. Sending is a server key, so a decompiled app can never broadcast to your users.
/push/v1/devicesRegisters or updates one device.
Key: gw_push_… (the app key — safe to ship)
`{ platform, token }` with platform one of IOS, ANDROID, WEB. Optionally `deviceModel`, `osVersion`, `appVersion`, `locale`, `timezone`, `tags` (replaces the device's tags) and `pushEnabled`. Answers `{ deviceId }`.
curl -X POST https://api.penstoke.com/push/v1/devices \
-H "Authorization: Bearer $PENSTOKE_APP_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "IOS",
"token": "<APNs device token>",
"appVersion": "2.4.0",
"tags": ["beta"]
}'/push/v1/devices/:tokenUnregisters a device, on sign-out or opt-out.
Key: gw_push_… (the app key)
curl -X DELETE https://api.penstoke.com/push/v1/devices/<token> \
-H "Authorization: Bearer $PENSTOKE_APP_KEY"/push/v1/eventsReports that a notification was opened.
Key: gw_push_… (the app key)
`{ messageId, type: "opened" }`. Idempotent: `recorded` comes back false when the open was already counted, or the message was never delivered.
curl -X POST https://api.penstoke.com/push/v1/events \
-H "Authorization: Bearer $PENSTOKE_APP_KEY" \
-H "Content-Type: application/json" \
-d '{ "messageId": "<id from the payload>", "type": "opened" }'/push/v1/sendSends to up to 1,000 devices and waits for the result.
Key: gw_sk_… with the Push send scope (server only)
`{ appId, title, body, target }` plus optional `richMediaUrl`, `actionUrl` and `data` (custom string pairs, 2 KB). `target` takes `tokens`, `deviceIds`, `tags` or `platforms` — at least one. Answers `{ sent, failed, dryRun, messageIds }`.
curl -X POST https://api.penstoke.com/push/v1/send \
-H "Authorization: Bearer $PENSTOKE_SERVER_KEY" \
-H "Content-Type: application/json" \
-d '{
"appId": "<app id>",
"title": "Your order shipped",
"body": "Track it in the app.",
"target": { "tags": ["customers"] },
"actionUrl": "https://example.com/orders/42"
}'Every error is the same shape, so one handler covers all of them. There is no 200 carrying a failure.
{
"error": {
"code": "VALIDATION_ERROR",
"message": "A PUT presign must declare `contentType` and `sizeBytes`",
"details": { "issues": [{ "path": "sizeBytes", "message": "Required" }] }
}
}Before you add provider credentials, calls still work end to end: they are validated, routed, logged and counted exactly as they will be in production — nothing is sent upstream. The response says so with dryRun: true, and the dashboard marks those rows. It is never silent, and a dry run is never reported as a real delivery.
Signed in, this same page at your dashboard carries your own endpoint, so every line can be copied and run as it stands.