Python
Point the base URL, mint a key per end user, call with that key. Attribution comes from the key — a shared key with an end-user header would be forgeable from the tenant's own code, and would make the spend cap advisory rather than enforced.
- Set the gateway base to https://gw.ourseams.com/v1
- Mint with POST /v1/keys at signup (step 2 — not optional)
- Call with that ak_, model acme/smart
Complete example
import os
import requests
api_base = "https://api.ourseams.com"
gateway_base = "https://gw.ourseams.com"
secret = os.environ["SEAMS_SECRET_KEY"]
# step 2 — mint one ak_ per end user at signup; store it on their row
minted = requests.post(
f"{api_base}/v1/keys",
headers={"Authorization": f"Bearer {secret}"},
json={"endUserId": "user_123", "bundle": "default"},
)
minted.raise_for_status()
key = minted.json()["key"]
# step 3 — call with THAT key, never a shared one
res = requests.post(
f"{gateway_base}/v1/chat/completions",
headers={"Authorization": f"Bearer {key}"},
json={
"model": "acme/smart",
"messages": [{"role": "user", "content": "hello"}],
},
)
res.raise_for_status()
print(res.json())
POST /v1/keys answers 501 not_implemented until #70 lands. The shape above is the contract — run it when that issue closes.
POST /v1/chat/completions answers 501 not_implemented until #60 lands. The shape above is the contract — run it when that issue closes.