Developer documentation

Use KernelFold from anything

One API key reaches the whole fleet through two compatible surfaces: an OpenAI-style Chat Completions API and an Anthropic-style Messages API. That means Claude Code, Codex, Cursor, and any OpenAI or Anthropic SDK work out of the box.

01

Quick start

  1. Create an account (free, no credit card).
  2. Generate a key under API keys — pick the chat scope for coding agents (least privilege).
  3. Point your tool at the gateway. First request:
curl
curl https://api.kernelfold.com/v1/chat/completions \
  -H "Authorization: Bearer $KERNELFOLD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kernelfold-ultra",
    "messages": [{ "role": "user", "content": "Explain CRDTs in one paragraph." }]
  }'

All examples use https://api.kernelfold.com — the dedicated API host. It serves the same gateway as www.kernelfold.com/api but without the CDN edge in front, so long-running requests (deep kernelfold-ultra runs, big agentic turns) are never cut off by an edge timeout. The /api path keeps working, but the API host is the recommended base URL for all programmatic use.

02

Authentication

Keys look like sk_kernelfold_… and are shown once at creation. Send them either way — both are equivalent:

  • Authorization: Bearer sk_kernelfold_…— OpenAI SDKs, Codex, Claude Code's ANTHROPIC_AUTH_TOKEN
  • x-api-key: sk_kernelfold_… — Anthropic SDK default

Scopes: full (everything), chat (completions only — recommended for coding agents), read (dashboard data only). Treat keys like passwords; revoke instantly from settings.

03

Models

Three kinds of model names. The KernelFold chat tiers (kernelfold / kernelfold-ultra) run the multi-agent pipeline (plan → parallel workers → verify → synthesize) — best answer quality for research, design, and analysis. The KernelFold coding tiers (kernelfold-code / kernelfold-code-pro) are for Claude Code, Codex, and other coding agents — see the Claude Code and Codex sections below. The fleet models are direct passthroughs with tool-calling — pin a specific model when you want full control. Every fleet model fails over automatically if it errors mid-request.

ModelModel IDProviderTierContextBest for
kernelfold-ultrakernelfold-ultraKernelFoldEnsemble1MHardest questions — full multi-agent pipeline
kernelfoldkernelfoldKernelFoldEnsemble1MInteractive chat — latency-tuned pipeline
kernelfold-codekernelfold-codeKernelFoldCoding200KDirect routing — one model, fastest coding
kernelfold-code-prokernelfold-code-proKernelFoldCoding200KThinker→Worker→Verifier — expert + verified
Claude Fable 5claude-fable-5AnthropicFrontier200KAnthropic's Mythos-class flagship — the sharpest reasoner in the fleet
GPT-5.6 Solgpt-5.6-solOpenAIFrontier400KOpenAI's frontier lane — elite reasoning & agentic coding
Claude Opus 4.8claude-opus-4-8AnthropicFrontier1MDeep reasoning, verification & vision at million-token context
GPT-5.6euro.gpt-5.6OpenAIFrontier400KFrontier reasoning with native tool use
Claude Opus 4.7claude-opus-4-7AnthropicFrontier1MLong-form writing & careful analysis
Claude Sonnet 5claude-sonnet-5AnthropicStrong200KThe Claude 5 workhorse — frontier-family quality, everyday speed
Claude Opus 4.6claude-opus-4-6AnthropicStrong1MIndependent second-opinion reviews
DeepSeek V4 Prodeepseek-v4-proDeepSeekStrong128KDeep technical reasoning at great value
Kimi K2.7 Codekimi-k2p7-codeMoonshot AIStrong256KThe fleet's top dedicated coder
GLM 5.2glm-5.2Z.aiStrong1MGeneral work at million-token context, great value
Qwen 3.7 Plusqwen3p7-plusQwenBalanced128KSnappy reasoning for everyday tasks
GPT-5.6 Lunagpt-5.6-lunaOpenAIBalanced400KBalanced drafting & summaries
MiniMax M3minimax-m3MiniMaxBalanced200KFast, capable generalist
Kimi K2.6kimi-k2p6Moonshot AIBalanced262KQuick general-purpose chat
DeepSeek V4 Flashdeepseek-v4-flashDeepSeekFast128KLightning-fast lightweight tasks

Programmatic listing: GET /v1/models (no auth required).

04

Chat Completions API (OpenAI-compatible)

POST /v1/chat/completions — a drop-in replacement for the OpenAI endpoint: streaming, tool calling, and the standard request/response shapes.

javascript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.kernelfold.com/v1",
  apiKey: process.env.KERNELFOLD_API_KEY, // sk_kernelfold_…
});

const res = await client.chat.completions.create({
  model: "kernelfold-ultra",          // or any fleet model, e.g. "kimi-k2p7-code"
  messages: [{ role: "user", content: "Explain CRDTs in one paragraph." }],
  stream: true,
});

for await (const chunk of res) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}
python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.kernelfold.com/v1",
    api_key=os.environ["KERNELFOLD_API_KEY"],  # sk_kernelfold_…
)

res = client.chat.completions.create(
    model="kernelfold-ultra",
    messages=[{"role": "user", "content": "Explain CRDTs in one paragraph."}],
)
print(res.choices[0].message.content)

Tool calling works with any concrete fleet model — the full tools / tool_calls / role: "tool" loop:

javascript
const res = await client.chat.completions.create({
  model: "kimi-k2p7-code",   // concrete models support tool calling
  messages: [{ role: "user", content: "What's the weather in Paris?" }],
  tools: [{
    type: "function",
    function: {
      name: "get_weather",
      description: "Get current weather for a city",
      parameters: {
        type: "object",
        properties: { city: { type: "string" } },
        required: ["city"],
      },
    },
  }],
});
// res.choices[0].message.tool_calls → [{ function: { name: "get_weather", … } }]
05

Messages API (Anthropic-compatible)

POST /v1/messages speaks the Anthropic Messages format — system prompts, content blocks, tool_use / tool_result, base64 image blocks (routed to vision-capable models automatically), and the Anthropic SSE streaming events. Any Anthropic SDK works by overriding the base URL.

curl
curl https://api.kernelfold.com/v1/messages \
  -H "x-api-key: $KERNELFOLD_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kernelfold-code",
    "max_tokens": 1024,
    "messages": [{ "role": "user", "content": "Hello!" }]
  }'

POST /v1/messages/count_tokens is also available (estimate).

06

Claude Code

Claude Code talks the Messages API, so it plugs straight into KernelFold. Two environment variables:

bash
export ANTHROPIC_BASE_URL="https://api.kernelfold.com"
export ANTHROPIC_AUTH_TOKEN="sk_kernelfold_your_key_here"
export ANTHROPIC_MODEL="kernelfold-code"

claude   # start Claude Code as usual

Or make it permanent in your Claude Code settings file:

json
// ~/.claude/settings.json
{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.kernelfold.com",
    "ANTHROPIC_AUTH_TOKEN": "sk_kernelfold_your_key_here",
    "ANTHROPIC_MODEL": "kernelfold-code"
  }
}

Prefer ANTHROPIC_AUTH_TOKEN (sends the key as Authorization: Bearerand skips Claude Code's one-time "use this API key?" approval prompt). ANTHROPIC_API_KEY also works — it sends the same key as x-api-key, but Claude Code will ask you to approve the key on first use; if you ever answered No to that prompt, Claude Code keeps demanding /loginuntil the key's entry is removed from ~/.claude.json under customApiKeyResponses.rejected. The gateway accepts either header.

  • kernelfold-code — the default coding alias. Pure routing: one strong model (Claude Fable 5 via euromodels, with GPT-5.6 via your ChatGPT membership as failover) handles each turn directly. No AI review, no prompt modification, no identity injection — the model sees your exact prompt and answers with its full native quality. Fastest path. Use this for everyday coding.
  • kernelfold-code-pro — the expert+verified coding alias. A Sakana Fugu-style 3-role system: a Thinker (GPT-5.6) plans the approach once per task, a Worker(Claude Fable 5) builds across the tool loop, and a Verifier(GPT-5.6) checks the actual results at completion checkpoints. One repair cycle if the Verifier finds blocking issues. The final answer is buffered until verification passes. Each role uses a different provider for diversity (a euromodels outage doesn't kill both Worker and Verifier). Use this for complex builds that benefit from plan + verify.
  • You can also pin a specific fleet model (e.g. claude-fable-5, kimi-k2p7-code) for full control — every fleet model has native tool support and automatic failover.
  • Use a chat-scoped key — Claude Code never needs dashboard access.
  • Images work: pasted screenshots and image files (including ones returned by tools) are routed to vision-capable models automatically. Only embedded images are read — remote image URLs are never fetched.
  • If a model has an outage mid-session, the gateway fails over to the next-best model automatically; your session keeps going.
07

Codex CLI

Codex supports custom OpenAI-compatible providers. Add KernelFold to ~/.codex/config.toml:

toml
# ~/.codex/config.toml
model = "kernelfold-code"
model_provider = "kernelfold"

[model_providers.kernelfold]
name = "KernelFold AI"
base_url = "https://api.kernelfold.com/v1"
env_key = "KERNELFOLD_API_KEY"   # Codex reads the key from this env var

Then export your key and run:

bash
export KERNELFOLD_API_KEY="sk_kernelfold_your_key_here"

codex            # interactive
codex exec "fix the failing test"   # non-interactive

kernelfold-code is the recommended profile for Codex: pure routing — one strong model per turn, direct call, no AI review. For complex builds that benefit from plan + verify, use kernelfold-code-pro(the Thinker→Worker→Verifier 3-role system). If you'd rather pin one model: gpt-5.6-sol (frontier coder, via your ChatGPT membership) or kimi-k2p7-code (code specialist).

08

Cursor & other OpenAI-compatible tools

Anything with an "OpenAI-compatible" or "custom base URL" option works the same way:

Base URL:  https://api.kernelfold.com/v1
API key:   sk_kernelfold_your_key_here
Model:     kernelfold-code   (or kernelfold-code-pro for verified builds)

For plain chat use the kernelfold-ultra tier (the ensemble answers); for agentic/tool-heavy workflows use kernelfold-codex-ultra (the coding profile with automatic failover) or pin a concrete fleet model.

09

Plans & tokens

Usage is measured in tokens— the same units the models bill in. Your plan grants a monthly pool shared across every model and the API: a quick chat spends a few thousand tokens, a deep multi-agent run a few hundred thousand. Every plan's allowance resets monthly, unused tokens don't roll over, and when you run out, requests return 402 until the reset (or an upgrade).

PlanPriceTokens / month
FreeFree1.5M
Pro$19/mo80M
Max$49/mo180M

Manage your plan, balance, and invoices on the billing page. API keys share the account's token balance.

10

Rate limits & errors

  • 429 RateLimited — request burst limit (per key). Back off and retry.
  • 429 QuotaExceeded — daily request quota reached; resets over the next 24 hours.
  • 402 PaymentRequired — out of credits for this period. OpenAI-compatible endpoints return {"error":{"type":"insufficient_quota"}}; the Messages API returns {"error":{"type":"billing_error"}}.
  • 401 — missing/revoked key · 403 — key lacks the required scope.
  • 502 / 529 — upstream model error after all failovers were exhausted (rare; check status).

Every request is visible in your dashboard — tokens, cost, latency, and the models that served it.