Pryv API Platform
Keys, credits, and private AI docs in one dashboard.
Use wallet-signed management endpoints to create keys and add credits, then call the public API with Bearer keys. Everything below is production ready and matches the backend contracts.
Quickstart
Purchase credits, mint a key, ship a request.
- 1Set NEXT_PUBLIC_API_BASE_URL and NEXT_PUBLIC_PLATFORM_URL.
- 2Create an API key (shown once).
- 3Buy credits with usdAmount and wait for balance to update.
- 4Call /v1/chat/completions with Bearer auth.
Hello world request
const apiKey = process.env.PRYV_API_KEY
const res = await fetch('https://api.pryv.ai/v1/chat/completions', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'gpt-5.2',
messages: [{ role: 'user', content: 'Hello Pryv!' }],
stream: false
})
})
const data = await res.json()
console.log(data.choices[0].message.content)Base URLs
Keep the dashboard and API on separate hosts for security and CORS control.
Env config
NEXT_PUBLIC_PLATFORM_URL=https://platform.pryv.ai
NEXT_PUBLIC_API_BASE_URL=https://api.pryv.aiAuth model
Public API
Authorization: Bearer pryv_...
Management
walletAddress + message + signature (anti-replay)
Wallet auth
Messages must include action, nonce, and ts. For revoke, include keyId.
Wallet signature payload
const nonce = crypto.randomUUID()
const ts = new Date().toISOString()
const message = `Pryv API key mgmt | action=create | keyId= | nonce=${nonce} | ts=${ts}`
const { walletAddress, signature } = await signWalletMessage(message)
const body = { walletAddress, message, signature, name: 'Production key' }Endpoint catalog
Public and wallet-auth routes
GET
/v1/modelsBearerList available modelsGET
/v1/models/{id}BearerModel detailsPOST
/v1/chat/completionsBearerChat completions (SSE when stream=true)POST
/v1/pii/previewBearerPaid preview ($0.05)POST
/api/v1/keysWalletCreate API key (shown once)GET
/api/v1/keysWalletList keys (no secrets)DELETE
/api/v1/keys/{key_id}WalletRevoke keyPOST
/api/v1/billing/checkoutWalletStripe checkout (usdAmount supported)GET
/api/v1/billing/balanceWalletCredits balanceGET
/api/v1/billing/ledgerWalletUsage ledgerError handling
Handle the key states
401/403Invalid or missing auth (wallet signature or API key).
402insufficient_credits - prompt user to add credits.
429Rate limit exceeded. Respect Retry-After header.
400Invalid params (invalid_model, etc).
500Server error. Retry with backoff.
PII controls
Privacy tuning
Redact emails only
piiEntities: ["EMAIL_ADDRESS"]
Disable image redaction
skip_pii_redaction: { image: true }
Blur faces strongly
piiConfig.image.faces = { blur: "strong" }