API
The PAAVS AI API is the Anthropic Messages API with your organisation's key, plus document search. Create a key in the console under API keys.
Model calls
curl https://api.ai.paavs.com/v1/messages \
-H "authorization: Bearer $PAAVS_AI_KEY" \
-H "content-type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{"model":"fast","max_tokens":300,
"messages":[{"role":"user","content":"Draft a reply to a late-delivery complaint."}]}'The Anthropic SDKs work unchanged: set the base URL to https://api.ai.paavs.com and the API key to your PAAVS AI key.
- Models:
fast,standardandfrontieralways mean the current pinned model of that tier; full model names work too.GET /v1/modelslists them with prices. - Optional headers:
X-Paavs-FeatureandX-Paavs-Userlabel a call in your usage. Don't put personal data in them. - Your organisation is fixed by the key. Don't send
X-Paavs-Tenant; it is refused. - If a model is overloaded: a call that names
fast,standardorfrontieris retried on the next Claude model. The reply'sx-paavs-modelheader says which model answered andx-paavs-fallback-fromwhich one it replaced. A call that names an exact model is never switched;X-Paavs-Fallback: offturns this off for one request.
Document search
Store documents in a named space and search them. Only your organisation's documents are ever returned.
# index (re-sending a document id replaces it)
curl https://api.ai.paavs.com/v1/retrieval/spaces/policies/documents -H "authorization: Bearer $PAAVS_AI_KEY" \
-d '{"documents":[{"id":"refunds","text":"Refunds within 30 days with a receipt.","metadata":{"team":"support"}}]}'
# search
curl https://api.ai.paavs.com/v1/retrieval/spaces/policies/search -H "authorization: Bearer $PAAVS_AI_KEY" \
-d '{"query":"can I get my money back?","limit":5,"where":{"team":"support"}}'
# delete one document, or the whole space
curl -X DELETE https://api.ai.paavs.com/v1/retrieval/spaces/policies/documents/refunds -H "authorization: Bearer $PAAVS_AI_KEY"
curl -X DELETE https://api.ai.paavs.com/v1/retrieval/spaces/policies -H "authorization: Bearer $PAAVS_AI_KEY"Search results are your documents' text. When you pass them to a model, treat them as data, not instructions.
Agents
Give one of your agents a task from your own software. You create and edit agents in the console; the API runs them.
# your agents
curl https://api.ai.paavs.com/v1/agents -H "authorization: Bearer $PAAVS_AI_KEY"
# run one (answers when the agent stops: finished, or waiting for an approval)
curl https://api.ai.paavs.com/v1/agents/agt_…/runs -H "authorization: Bearer $PAAVS_AI_KEY" \
-H "content-type: application/json" \
-d '{"task":"A customer asks if they can return an opened kettle after 20 days. Draft a reply."}'
# the same, as it happens (server-sent events: run, model_start, text, tool_start, tool_end, done)
curl -N https://api.ai.paavs.com/v1/agents/agt_…/runs -H "authorization: Bearer $PAAVS_AI_KEY" \
-H "content-type: application/json" -d '{"task":"…","stream":true}'
# look a run up later
curl https://api.ai.paavs.com/v1/runs/run_… -H "authorization: Bearer $PAAVS_AI_KEY"- The answer:
status(completed,waiting_approval,failed),answer,drafts,steps(each tool the agent used) andusage. - Approvals are for people. When an agent proposes an action, the run stops at
waiting_approvalwithpending_approvalsand anapprovals_url. An owner or admin decides in the console; an API key can't approve. Fetch the run again to see how it ended. - A run usually takes under a minute; allow up to five. Model calls inside a run count against your monthly allowance like any other.
Usage and limits
GET /v1/usage?from=YYYY-MM-DD&to=YYYY-MM-DD: your organisation's calls, tokens and cost per day and model.- Each key may make 60 requests a minute; beyond that you get
429withretry-after. - When your organisation's monthly allowance is used up, calls return
503with typeai_disableduntil the next month (UTC). - Document search: up to 10,000 passages per organisation.