Base URL
API origin
Find and call a tool
1
Search
Call
POST /api/credits/tools/search with a task, category, or Tool Pack.2
Describe
Send the selected slug to
POST /api/credits/tools/describe for its
current inputs and access requirements.3
Estimate when needed
Call
POST /api/credits/tools/estimate for a quote, or send
X-Locus-Max-Charge-Credits on the call to cap its charge.4
Execute
Call
POST /api/wrapped/credits/{provider}/{endpoint}. Reuse the same
idempotency key for retries.Recipes and Workflows
Use each Recipe’s current input schema and credit ceiling. Workflow REST calls
use an enterprise server key or scoped agent key; OAuth agents use MCP.
Agent setup
GET /api/credits/mcp/docs returns the MCP URL, OAuth metadata, plugin installation commands, and client configurations. The plugin uses the same MCP connection and permissions.
Authentication
Server credentials use a bearer header:
Authorization header
Request conventions
- Use decimal strings for money. Send amounts like
"10.00"to keep precision. - Reuse idempotency keys on retries. Paid calls and transfers require
Idempotency-Key. A repeat returns the stored outcome, including a failed one, withIdempotent-Replay: true; a changed request with the same key returns409. Locus keeps a key for 24 hours after its call finishes; after that, the same key starts a new call. - Read cost headers. Calls return
X-Locus-Credits-ChargedandX-Locus-Credits-Balance. Secret keys, sandbox keys, and platform-mode agent keys also receiveX-Locus-Cost-Usd. - Keep the call ID. Metered calls return
X-Locus-Api-Call-Id, and provider error bodies repeat it asapiCallId. Read the call later withGET /api/wrapped/credits/calls/{callId}. - Cap a charge. Send
X-Locus-Max-Charge-Credits. If the call would cost more, Locus returns409with codecharge_ceiling_exceededand sends nothing to the provider. - Run long calls asynchronously. Send
Prefer: respond-asyncon a non-streaming call. Once the provider request is out, Locus returns202withapiCallId,statusUrl, andresultUrl. Read the outcome withPOST /api/wrapped/credits/calls/{callId}/resultand{ "waitSeconds": 0-45 }. Result reads are free. - Tag usage. Send
X-Locus-Attributionas a JSON object to associate ledger entries with a customer, task, or project.
providerError.code when the provider sent one. Locus Pro routes send a provider 502 or 504 as 503, with the original status in X-Locus-Origin-Status, so the JSON error body reaches you.
Chat is charged from the provider’s reported usage. A stream is charged when it ends and closes with a locus.billing event; a disconnect after the provider accepts the stream is charged the full hold. Streams are not replayed: reusing the key returns 409 with code stream_not_replayable. See inference and streaming.
Related guides
- SDK reference: calls, balances, funding, and agent key management.
- Connect an agent: OAuth and scoped agent keys.
- Framework integrations: examples for model SDKs and agent frameworks.