Base URL

https://api.24klabs.ai

Endpoints

Public Endpoints

GET /health

Server health check

GET /services

List all available services and pricing

GET /stats

Platform usage statistics

GET /.well-known/x402.json

x402 payment discovery manifest

GET /discovery/resources

Service discovery for AI agents

Free Demo

POST /api/demo/explain

Free code explanation (rate limited, 5/day)

Paid Services (x402)

POST /api/explain-code

Plain-English code explanation

POST /api/debug-assist

Bug detection and fix suggestions

POST /api/code-review

Quality, style, and best-practice review

POST /api/security-audit

Vulnerability scanning and analysis

POST /api/automation-script

Generate automation scripts from descriptions

POST /api/mcp-blueprint

MCP server architecture blueprints

POST /api/read-url

Fetch a URL and return clean readable text (flat $0.005)

POST /api/extract-document

Extract key information from any document

POST /api/analyze-image

Analyze images: objects, text, context (URL input)

POST /api/summarize-session

Summarize conversation transcripts

POST /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.

  1. Send a request to any paid endpoint without payment.
  2. Receive a 402 response with price, wallet, and payment details.
  3. Transfer the exact USDC amount on Base L2 to the provided wallet.
  4. Resend the original request with the X-Payment-Receipt header containing the transaction hash.
  5. The server verifies the on-chain transaction and returns the result.

AI agents using x402-compatible SDKs handle this loop automatically.