API reference
The Pendra API is a REST API at https://api.pendra.ai. The
Python and Node SDKs
are the easiest way to call it. This reference is for calling it directly,
or from an OpenAI or Anthropic client.
Base URL
Endpoints live under /api/v1. The inference endpoints also
answer under /v1, so an OpenAI or Anthropic client works if
you set its base URL to https://api.pendra.ai/v1 and use a
Pendra API key.
https://api.pendra.ai/v1
Every request sends that key as a bearer token. See Authentication.
Endpoints
Chat completions
OpenAI-compatible chat. Streaming and non-streaming.
Embeddings
Vector embeddings for retrieval and RAG.
Rerank
Reorder documents by relevance to a query.
Moderations
Check text and images against content categories on your own worker.
Images
Generate an image from a prompt.
Audio transcription
Turn speech into text. Upload an audio file.
Text to speech
Turn text into spoken audio.
Models & catalogue
List live models and the public Pendra catalogue.
Anthropic Messages
Anthropic-compatible endpoint for Claude SDKs.
OpenAI Responses
OpenAI-compatible Responses API, used by Codex.
GPU rental
Rent an on-demand GPU instance by the hour.
Usage & workers
Read your usage log, in-progress requests and worker status.
Managing workers
Change worker and model settings, such as a model's context size.
Managing API keys
List, create, rotate and revoke API keys from code.
The full schema is at
/api/v1/openapi.json.
Which worker served a request
Every JSON reply has a pendra field naming the worker that ran
it and the request id to quote to support. OpenAI and Anthropic clients
ignore it.
"pendra": {
"worker": {"id": "wrk-1a2b3c4d", "name": "london-gpu-01", "version": "3.115.1"},
"request_id": "3f1c8a2e-5b7d-4e19-9c0a-6d2f8b1e4a73"
}
A stream carries it on the last chunk. Replies that aren't JSON, such as
audio, send the X-Worker-Id and X-Worker-Name
headers instead.
Cancel a request
Close the connection. Pendra stops the model straight away and frees the
GPU for the next request, for streams and normal requests alike. In
JavaScript, use an AbortController:
const controller = new AbortController();
client.chat.completions.create(
{ model: 'qwen3.6:27b', messages: [{ role: 'user', content: 'Write an essay' }] },
{ signal: controller.signal },
);
controller.abort();
A cancelled request shows in the usage log with status 499.
To check from code that it has stopped, see
In-progress requests.