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
/api/read-url Fetch a URL and return clean readable text (flat $0.005)
/api/extract-document Extract key information from any document
/api/analyze-image Analyze images: objects, text, context (URL input)
/api/summarize-session Summarize conversation transcripts
/api/summarize-content Summarize articles and long-form text
Request Body
All POST endpoints accept the same JSON body schema.
// Request body (JSON)
{
"code": "string", // Required. Content to process (code, URL, or text).
"language": "string", // Optional. Language hint (auto-detected if omitted).
"context": "string" // Optional. Additional context or instructions.
}
// Query parameter
?tier=quick|standard|pro // Analysis depth and price tier. Default: standard. The AI model is fixed per service -- see the pricing page for which model each service uses. Tiers control output depth and token budget, not the model.
Response (200 OK)
{
"service": "explain-code",
"tier": "quick",
"result": "...", // The AI-generated analysis
"model": "claude-haiku-4-5",
"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.