The local proxy
The same endpoint on your own gateway. Install the SDK, run ospp proxy, and point the base URL of your application at the proxy on localhost. Through the proxy, the conversation and the answer never reach OSPP in readable form; the node's definition is registered with OSPP.
What it is#
On OSPP Cloud your application calls the endpoint at OSPP. On a Self-hosted installation OSPP must not see the conversation, so the endpoint runs on your side instead. The local proxy is that endpoint: a small OpenAI-compatible server next to your application. It signs each call with your own key and seals the conversation to your own gateway before anything leaves, and your gateway calls the model with your own provider keys.
An organisation that runs its own gateway cannot use the Cloud endpoint: a call to https://www.ospp.it.com/api/v1/openai/chat/completions is refused with 409 self_hosted_gateway and an error that points to the local proxy.
What reaches OSPP, and what does not#
| Reaches OSPP? | |
|---|---|
| The conversation: the user, assistant and tool messages after the system messages | Only sealed. The proxy seals it to your gateway's inputs key on your machine; OSPP carries text it cannot read |
| The answer | Only sealed. The proxy asks for the answer sealed back to a key that only the proxy process holds; OSPP relays text it cannot read and does not store it |
| The node's definition: the model, the parameters, the system prompt and the tool definitions | Yes |
| The signed request, the fingerprints, and the figures (tokens, cost, duration) | Yes |
| The trace and the reference you send in headers | Yes |
The proxy sends the node's definition to OSPP (POST /v1/openai/nodes/observe) so OSPP can name and register the node. That request carries everything in your request body except the conversation: the system messages at the start, the model, the parameters and the tools. OSPP stores it.
Text that OSPP must not store therefore goes in the conversation, not in the system prompt or a tool description.
Start it#
pip install https://www.ospp.it.com/sdk/ospp-0.4.4-py3-none-any.whl
OSPP_API_KEY=<your OSPP API key> ospp proxy
The proxy prints where it listens: http://127.0.0.1:8787/v1.
On the server that runs the package, the proxy already runs as the package's endpoint on port 8787, and it asks for its token as the API key; see the admin UI's Endpoint page. Use --port for a second proxy on that server.
Point your application at it#
Change the base URL of your OpenAI-compatible client to the proxy:
OPENAI_BASE_URL=http://127.0.0.1:8787/v1
Or in code:
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8787/v1", api_key="unused")
r = client.chat.completions.with_raw_response.create(
model="provider/model-name",
messages=[{"role": "user", "content": text}],
extra_headers={"X-OSPP-Node": "support-bot"})
answer, passport = r.parse().choices[0].message.content, r.headers["x-ospp-passport"]
The proxy holds your OSPP API key, so the key your application sends is not used unless you set a proxy token (below). You name the model in the model field, and the answer carries its passport in the response headers and under ospp in the body. See The endpoint and Responses.
GET /v1/models on the proxy lists the models, as OSPP's GET /v1/openai/models does. GET /health answers without a token and says the proxy is up.
Lookups and outcomes through the proxy#
From SDK 0.4.4 the proxy also passes three requests on to OSPP with its own API key, so a tool that holds only the proxy's address and token can look a call up and report an outcome. They carry figures and passport details, never a conversation. <base> is the base URL your application uses (http://127.0.0.1:8787/v1, or /v1/openai on a published endpoint).
| Request | Passed on to OSPP as |
|---|---|
GET <base>/calls?passport_id=… (or run_id, reference, node, limit) | GET /v1/calls |
GET <base>/passports/<passport id>/outcome | GET /v1/passports/<passport id>/outcome |
POST <base>/outcomes | POST /v1/outcomes |
Whoever holds the proxy's token can therefore also read your organisation's call list. The OSPP node for n8n uses these requests.
A settings file for n8n, written by hand#
The Self-hosted package exports this file from its admin UI (Endpoint > n8n). With the SDK's own proxy, write it yourself and paste it into the node's credential under Settings File:
{"ospp_n8n_settings": 1, "endpoint_url": "http://127.0.0.1:8787/v1", "token": "<the proxy token>", "api_url": "https://www.ospp.it.com/api"}
The endpoint address must be https, or http on the machine itself.
Headers#
The proxy handles these request headers:
| Header | What it does |
|---|---|
X-OSPP-Node | Names the task; the calls are grouped under that node |
X-OSPP-Provider | Names the provider when more than one offers a plain model name |
X-OSPP-Reference | Your own case or ticket number; cut to its first 200 characters |
X-OSPP-Trace | Groups the calls of one conversation or agent task. Cut to its first 120 characters; a value with spaces or other characters that do not fit is not refused, and the call is then recorded without a trace |
Idempotency-Key | The key counts together with the conversation, as on Cloud, and a retry never makes a second call. Unlike Cloud, the proxy does not return the first answer again: a retry of a request that already started is refused with status 409 (IDEMPOTENCY_CONFLICT). Without the header the proxy makes a key per call |
X-OSPP-Store | true or false; any other value is refused. On your own gateway OSPP holds no conversation or answer either way |
It returns these response headers:
| Header | What it is |
|---|---|
X-OSPP-Run | The run id of the call |
X-OSPP-Node | The node version the call ran as |
X-OSPP-Passport | The passport id |
X-OSPP-Verify-URL | The passport's public verification address |
X-OSPP-Passport-File | The address of the .ospp file: the verification address followed by /bundle |
X-OSPP-Outcome-URL | The call's own outcome address, at OSPP. An outcome is figures, never the conversation |
X-OSPP-Passport-Status | pending, sent instead of the passport headers when the answer is there and the passport is not issued yet |
The same values are under ospp in the body, with signed_by: "own client key". See Request headers and Outcomes.
Options#
| Option | Environment variable | Default | Meaning |
|---|---|---|---|
--port | OSPP_PROXY_PORT | 8787 | The port the proxy listens on |
--host | 127.0.0.1 | The address it listens on | |
--token | OSPP_PROXY_TOKEN | none | A token every request must send as its API key (Authorization: Bearer <token>) |
--api | OSPP_API_URL | https://www.ospp.it.com/api | The OSPP API the proxy talks to. Versions before 0.4.3 defaulted to an older address; upgrade, or set this |
--timeout | 170 | Seconds the proxy waits for a call to finish | |
OSPP_API_KEY | Your organisation's OSPP API key | ||
OSPP_KEY_FILE | The file that holds the proxy's signing key | ||
OSPP_ORG | asked from OSPP | Your organisation's id; setting it saves one request at start |
The signing key#
The proxy signs every call with a key of your organisation that stays on your machine. By default it reads the key from, or creates it in, ~/.ospp/<organisation>/client-key.hex, and registers its public half on first use. On a server, set OSPP_KEY_FILE to a file of your choosing, or put the key in a secret and pass it as OSPP_CLIENT_KEY. The key appears under client keys on the Platform, where it can be revoked; see Settings, members and keys.
Keep it on localhost#
The proxy listens on 127.0.0.1 only. It signs with your key, so nobody else may reach it. To listen on an address other than this machine's own (127.0.0.1, ::1, localhost) you must pass --host and set a token; the proxy refuses to start without one. Every request must then send that token as its API key. Do not expose the proxy to the internet.
Streaming, tools and limits#
The proxy does not stream live. stream: true is accepted: the proxy waits for the finished answer and then sends it as a server-sent event stream, with the ospp object on the last chunk. X-OSPP-Stream is not handled by the proxy.
Tool calls are passed through; your application runs its tools itself. Only text content is accepted. A call that does not finish within the timeout is answered with an error, as is a call that failed. See Streaming, Tool calling and Errors.
On the Platform#
Calls made through the proxy appear in the Platform's Passports list with their figures and passports, and with the content state own_gateway. Their passports are searched, downloaded and shared like any other; see Passport management.
Three things on the Platform are for OSPP Cloud only, because OSPP does not hold your content:
- Model Compare: switching it on answers
409 SELF_HOSTED_GATEWAY. - Opening the content of a call from its passport.
- "Run again on another model" and Model Arena comparisons made from passports: both answer
409 SELF_HOSTED_GATEWAY.
Running a call again#
Your own gateway holds the inputs of the calls it ran, encrypted under its own key. A past call can be run again there on the same inputs without the inputs leaving your server; see Run again on your own gateway. To try another model, send the request again through the proxy with the other model in the model field: that is a new call with its own passport.
What the passport proves#
The same as on Cloud. The passport proves that this call was recorded at that moment with these fingerprints, in a log that independent validators cosign, and that the record is unchanged since. It does not prove that the answer is correct. See What a passport proves.
