Developer Guide
Quickstart
Your first API call in 2 minutes. No API keys, no signup, no OAuth.
Step 1: Choose a Service
Pick the AI service you need. Each one accepts code and returns structured analysis.
/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/api/automation-script-- Generate automation scripts/api/mcp-blueprint-- MCP server architecture blueprints
Step 2: Make the Request
Send a POST with your code. No auth headers needed.
curl -X POST https://api.24klabs.ai/api/explain-code \
-H "Content-Type: application/json" \
-d '{
"code": "const add = (a, b) => a + b;",
"language": "javascript",
"tier": "quick"
}' Step 3: Handle the 402
Without payment, the server responds with a 402 Payment Required containing everything you need to pay.
{
"error": "Payment Required",
"price": "0.50",
"currency": "USDC",
"network": "base",
"wallet": "0x1234...abcd",
"paymentMethods": ["x402"],
"x402": {
"version": 1,
"scheme": "exact",
"mimeType": "application/json"
}
} Step 4: Pay with USDC on Base L2
Transfer the exact USDC amount to the wallet address on Base (Coinbase L2). Gas fees are fractions of a cent. Your AI agent or wallet SDK handles this automatically via the x402 protocol.
Step 5: Retry with Receipt
Resend the same request with the payment receipt in the header.
curl -X POST https://api.24klabs.ai/api/explain-code \
-H "Content-Type: application/json" \
-H "X-Payment-Receipt: 0xYOUR_TX_HASH..." \
-d '{
"code": "const add = (a, b) => a + b;",
"language": "javascript",
"tier": "quick"
}' The server verifies the on-chain payment and returns your result. Done.
Free Demo Endpoint
Not ready to pay? Try the free demo endpoint -- no payment required, 5 requests per day.
curl -X POST https://api.24klabs.ai/api/demo/explain \
-H "Content-Type: application/json" \
-d '{
"code": "print('hello world')",
"language": "python",
"tier": "quick"
}'