API Reference
Everything you need to integrate with 24K Labs AI services.
Base URL
https://api.24klabs.ai Endpoints
Public Endpoints
/health Server health check
/services List all available services and pricing
/stats Platform usage statistics
/.well-known/x402.json x402 payment discovery manifest
/discovery/resources Service discovery for AI agents
Free Demo
/api/demo/explain Free code explanation (rate limited, 5/day)
Paid Services (x402)
/api/explain-code Plain-English code explanation
/api/debug-assist Bug detection and fix suggestions
/api/code-review Quality, style, and best-practice review
/api/security-audit Vulnerability scanning and analysis
/api/automation-script Generate automation scripts from descriptions
/api/mcp-blueprint MCP server architecture blueprints
Request Body
All POST endpoints accept the same JSON body schema.
{
"code": "string", // Required. The code to analyze.
"language": "string", // Optional. Language hint (auto-detected if omitted).
"context": "string", // Optional. Additional context for the analysis.
"tier": "quick" | "standard" | "pro" // Required. Analysis depth.
} Tiers map to different models and depths of analysis. Quick uses Haiku, Standard uses Sonnet, Pro uses Opus.
Response (200 OK)
{
"service": "explain-code",
"tier": "quick",
"result": "...", // The AI-generated analysis
"model": "claude-3-haiku",
"tokens_used": 1247,
"request_id": "req_abc123"
} 402 Payment Required
Returned when a paid endpoint is called without a valid payment receipt.
{
"error": "Payment Required",
"price": "0.50",
"currency": "USDC",
"network": "base",
"wallet": "0x...",
"paymentMethods": ["x402"],
"x402": {
"version": 1,
"scheme": "exact",
"mimeType": "application/json"
}
} Authentication: x402 Payment Flow
24K Labs uses the x402 protocol. There are no API keys or OAuth tokens. The payment itself is the authentication.
- Send a request to any paid endpoint without payment.
- Receive a
402response with price, wallet, and payment details. - Transfer the exact USDC amount on Base L2 to the provided wallet.
- Resend the original request with the
X-Payment-Receiptheader containing the transaction hash. - The server verifies the on-chain transaction and returns the result.
AI agents using x402-compatible SDKs handle this loop automatically.