The live gateway, with a public key
Call a model through the gateway
The gateway speaks the same protocol as OpenAI's API, so any client works by changing its base address and key. Every call below is checked against the data policy, written to the ledger before it returns, sealed into the audit chain, and counted on the dashboard.
The key
bnd_sDNukkshOvzZbAgkz0694W_cSN4YgU_knZ8npvkmEDo
Public on purpose, so do not send anything private with it. A prompt goes to the model's vendor; the gateway keeps hashes, counts and identifiers of it, never the text. When today's budget is spent, calls are refused with a 429 that says when it resets.
A call
curl https://gateway.peterparker.ca/v1/chat/completions \
-H "Authorization: Bearer bnd_sDNukkshOvzZbAgkz0694W_cSN4YgU_knZ8npvkmEDo" \
-H "Content-Type: application/json" \
-H "X-Data-Class: public" \
-i -d '{"model": "demo",
"messages": [{"role": "user", "content": "In one sentence, what is a hash chain?"}]}'
The response headers say what the gateway did: x-boundary-data-class,
x-boundary-redacted and x-boundary-call-uid, the row's id in the
ledger.
A refusal
curl https://gateway.peterparker.ca/v1/chat/completions \
-H "Authorization: Bearer bnd_sDNukkshOvzZbAgkz0694W_cSN4YgU_knZ8npvkmEDo" \
-H "Content-Type: application/json" \
-d '{"model": "demo",
"messages": [{"role": "user", "content": "Summarise: Jane Roe, SIN 046 454 286"}]}'
No X-Data-Class header means personal, and the
policy lets personal data go only where processing in Canada can be declared. No hosted
vendor here can declare it, so the call is refused with a 403 before anything is sent, and
the refusal is on the ledger too.
From Python, with the cache
from openai import OpenAI
client = OpenAI(base_url="https://gateway.peterparker.ca/v1", api_key="bnd_sDNukkshOvzZbAgkz0694W_cSN4YgU_knZ8npvkmEDo")
r = client.chat.completions.with_raw_response.create(
model="demo",
messages=[{"role": "user", "content": "What is data residency?"}],
extra_headers={"X-Data-Class": "public", "X-Boundary-Cache": "question"},
)
print(r.headers["x-boundary-cache"], r.headers["x-boundary-call-uid"])
print(r.parse().choices[0].message.content)
X-Boundary-Cache: question marks a bare question the semantic
cache may answer. Ask the same thing twice and the second answer says hit,
costs nothing, and names the call it came from.