Quick Start

Get your first result in 30 seconds. No signup. No API key. Just send a request and pay with USDC.

Step 1: Send a request

curl -X POST https://api.24klabs.ai/api/v1/explain \ -H "Content-Type: application/json" \ -d '{"code": "def fib(n): return n if n < 2 else fib(n-1) + fib(n-2)"}'

Step 2: Pay the 402

The first request returns HTTP 402 with payment details. Your x402-compatible client handles payment automatically. Or use the x402 SDK to add payment headers.

Step 3: Get your result

{ "service": "explain_code", "result": { "explanation": "A recursive Fibonacci function...", "complexity": "simple", "key_concepts": ["recursion", "base case", "ternary expression"], "line_by_line": [...] } }

Authentication

24K Labs uses the x402 protocol for authentication and payment in a single step. No API keys, no OAuth, no signup.

When you send a request without payment, you'll receive a 402 Payment Required response with payment instructions. Your x402 client includes the payment header on the next request, and the service responds with the result.

Payment is in USDC on Base L2. Transaction fees are sub-cent.

Base URL

https://api.24klabs.ai

All endpoints are prefixed with /api/v1/

Explain Code

POST /api/v1/explain
Get a plain-English explanation of any code snippet.

Parameters

FieldTypeRequiredDescription
codestringYesThe code to explain
languagestringNoProgramming language (auto-detected if omitted)

Example

curl -X POST https://api.24klabs.ai/api/v1/explain \ -H "Content-Type: application/json" \ -d '{"code": "xs.filter(x => x % 2 === 0).map(x => x * x)", "language": "javascript"}'

Debug Assist

POST /api/v1/debug
Get root cause analysis and fix suggestions for errors.
FieldTypeRequiredDescription
errorstringYesError message or traceback
codestringNoRelevant source code for context
languagestringNoProgramming language

Code Review

POST /api/v1/code-review
Get a comprehensive code review with security, performance, and quality analysis.
FieldTypeRequiredDescription
codestringYesSource code to review
languagestringNoProgramming language
focusstringNo"security", "performance", "readability", or "all"

Security Audit

POST /api/v1/security-audit
Get a vulnerability assessment with injection testing and hardening recommendations.
FieldTypeRequiredDescription
codestringYesSource code to audit
contextstringNoDeployment context (e.g., "web app", "API", "CLI")

Automation Script

POST /api/v1/automation
Get a custom automation script built to your specifications.
FieldTypeRequiredDescription
taskstringYesDescription of what to automate
languagestringNoPreferred language (default: Python)
constraintsstringNoAny requirements or limitations

MCP Blueprint

POST /api/v1/mcp-blueprint
Get a complete MCP server architecture design for connecting AI to your tools.
FieldTypeRequiredDescription
servicestringYesDescription of the service/API to connect
featuresstringNoSpecific features or tools needed

Error Codes

CodeMeaningWhat to Do
400Bad RequestCheck your JSON format and required fields
402Payment RequiredInclude x402 payment header with USDC
413Input Too LargeReduce input size or contact for Enterprise tier
429Rate LimitedSlow down. Max 10 requests/minute per IP
500Server ErrorTry again. If persistent, email sean@24klabs.ai

Rate Limits

Default limits per IP address:

LimitValue
Requests per minute10
Max input size50,000 characters
Max concurrent requests3

Need higher limits? Contact us for Enterprise access.