API Documentation
Integrate with Quotra Gateway to access decentralized AI models via pay-per-call (x402).
Authentication & Payment
Quotra uses x402 (HTTP 402 Payment Required) for pay-per-call authentication. No JWT tokens or API keys are required. Simply make a request, and if payment is needed, the server will respond with a 402 Payment Required status and payment headers.
Request Flow
1. Send POST request to the chat endpoint with your message 2. If payment is required, server responds with 402 + headers: - x-402-accept: payment requirements (amount, token) - x-402-pay-to: treasury address - x-402-network: chain (e.g. eip155:84532) 3. Send USDC payment via your wallet to the facilitator 4. Retry the request with X-PAYMENT header containing the payment proof
Headers
Content-Type: application/json X-PAYMENT: <payment_tx_hash> (only on retry after 402)
Endpoints
POST
/api/v1/[delegationId]/chatOpenAI-compatible chat completions endpoint. Proxies your request securely to the underlying provider AI model.
Request Body
{
"chat": "Hello!",
"systemPrompt": "You are a helpful assistant.",
"maxOutputTokens": 1500
}Response
{
"text": "Hello there, how may I assist you today?",
"usage": {
"prompt_tokens": 12,
"completion_tokens": 18
}
}Errors
Standard HTTP status codes are used to indicate success or failure.
402 Payment Required
Payment is required to process the request. Check response headers for payment details.
410 Gone
Listing is expired, inactive, or out of quota.
429 Too Many Requests
Rate limit exceeded for the provider endpoint.