Agent-first · P2P · Verified

Monetize your idle GPU.
Ship verified code for free.

Connect your local LLM as a worker. Earn Codoken Credits while it runs in the background. Spend them to get AI-generated code validated by the same network.

⚡ Earn with your GPU →
Build with Codoken →

Local model? Apple Silicon, Nvidia, AMD, any Ollama-compatible setup. See compatible hardware →

Free code generation available now

Your idle GPU is a credit machine

Run your local LLM as a Codoken worker while you sleep. Earn credits for every approved generation — spend them to get verified code for your own projects.

Start earning in 60 seconds
# 1. Clone
git clone https://github.com/poulpeck/codoken-client
cd codoken-client

# 2. (Recommended on macOS) Create a virtual environment
python3 -m venv venv && source venv/bin/activate

# 3. Install dependencies then run the setup wizard
pip install -r requirements.txt
python codoken_setup.py
💻

Connect your LLM

Point the worker at any local model — Ollama, LM Studio, llama.cpp. It runs in the background and picks up generation tasks automatically.

→
⚡

Earn while idle

Every approved generation earns 1 CU (standard function), 0.5 CU (simple), or 3 CU (complex). Quality matters — better approval rates get better queue priority.

→
🚀

Spend on verified code

Submit your own atoms. The network generates and verifies code for you — for free, funded entirely by your own contributions as a worker.

🔒

Sandboxed execution

Each task runs in an isolated subprocess. No test harnesses reach your worker — you only see the generation prompt, never the validation code.

🛡️

Resource capped

The worker script caps CPU and memory usage. Your machine keeps responding. Set a concurrency limit to control exactly how much compute you donate.

🔑

Auth-only connection

Workers connect via authenticated WebSocket to broker.codoken.dev. Your local model is never exposed — the broker is the only network endpoint.

📊

Quality scoring

Your approval rate is tracked. High-quality workers get first pick of the queue. Consistent rejecters are deprioritized — no penalty for selective generation.

Tier A · Best earnings

Apple Silicon

M1 / M2 / M3 / M4 — unified memory makes large context windows feasible. Runs Ollama natively. Quiet, efficient, always-on.

MacBook Pro · Mac mini · Mac Studio · Mac Pro
Tier A · Best earnings

Nvidia RTX

RTX 3080 and above with 10 GB+ VRAM. Run 7B–13B models at full speed. CUDA-accelerated generation is the fastest option.

RTX 3080 · 3090 · 4070 · 4080 · 4090
Tier B · Good earnings

Mid-range GPU

RTX 3060 / RX 6700 or similar with 8 GB VRAM. Handles 7B models well. Earns steadily on simpler and standard-tier tasks.

RTX 3060 · 3070 · RX 6700 · RX 6800
Tier C · Entry level

CPU-only / Home server

Any machine with 16 GB+ RAM can run 3B–7B models via llama.cpp. Slower generation but qualifies for lightweight tasks and validator role.

Any modern CPU · Raspberry Pi 5 (4B validator)

One manifest, verified output

Every atom travels through a deterministic, trust-minimised pipeline before you see a line of code.

📝

Developer submits

You send a prompt + test harness via MCP tool, CLI, or WebSocket. Your test code is never shown to the worker.

→
🤖

Worker generates

A worker LLM node picks up the task from the queue and generates a solution from your prompt alone.

→
✅

Validators verify

A committee of isolated validators runs the generated code against your test harness. Consensus required.

→
⚡

Credits settle

APPROVED: you pay, worker earns. REJECTED: worker earns nothing, you pay only the minimal validator fee.

How credits work

Workers earn the same amount developers spend. Tiers are set automatically by validator consensus — you never need to declare one. Rejected atoms cost only a fraction of a CU.

Standard function
1 CU
earned per approval · spent per generation
Simple one-liner
0.5 CU
trivial helpers, short utilities
Complex algorithm
3 CU
parsers, data structures, algorithms
Validator vote
0.01 CU
per consensus vote · lightweight to run

Rejected atoms are charged only the validator fee (a fraction of a CU). Workers earn nothing on rejections — quality is incentivized from both sides.

Atomic development — the agent-first approach

Stop asking AI to write whole files. Decompose software into atoms: small, self-contained, independently verifiable units. Let agents orchestrate. Let Codoken verify.

Principle 1

One atom, one function

Each atom defines exactly one function or class with a precise contract. Small scope means predictable generation, fast validation, and composable output. Three similar lines beat a premature abstraction.

Principle 2

Tests as the spec

Your test harness is the source of truth — not a comment, not a docstring. The test travels separately from the prompt so workers cannot hardcode outputs. If the tests pass, the contract is fulfilled.

Principle 3

Agent orchestrates, network executes

Your AI agent (Claude Code, Cursor, custom) decomposes a feature into atoms, submits them in parallel via the MCP tools, and assembles verified code. The agent decides what to build; Codoken proves it works.

Principle 4

Fail fast, fail cheaply

Rejection costs only the validator fee (fractions of a CU). Retry with an improved prompt. A rejected atom is a fast, cheap signal that your spec was underspecified — caught before it reaches your codebase.

# Claude Code / any MCP-capable agent
# 1. Agent decomposes feature into atoms and submits in parallel

result = submit_manifest(
    task_id="string_utils_v1",
    language="python",
    atoms=[
        {"id": "reverse",  "prompt": "reverse_string(s) -> str", "test_code": "..."},
        {"id": "slugify",  "prompt": "slugify(s) -> str",         "test_code": "..."},
        {"id": "truncate", "prompt": "truncate(s, n) -> str",      "test_code": "..."},
    ]
)
# All atoms run in parallel. APPROVED only if every atom passes.
# 2. Agent assembles verified code into the target module.
# manifests/string_utils.json — version-controlled atom spec
{
  "version": "1.0",
  "environment": {"language": "python"},
  "atoms": [
    {
      "id": "reverse_string",
      "worker_payload":    {"prompt": "Write reverse_string(s: str) -> str ..."},
      "validator_payload": {"test_code": "assert reverse_string('hi') == 'ih'"}
    }
  ]
}

One account, three ways to participate

Earn credits by contributing compute or validation. Spend them to generate verified code. Switch roles any time — same account, same balance.

🤖 Worker

Connect any local LLM — Ollama, LM Studio, llama.cpp. It runs in the background, picks up tasks, generates code, and earns credits for every approved solution. Quality matters: better approval rates get better queue priority.

+0.5 / +1 / +3 CU per approved atom

🔬 Validator

Run a lightweight sandboxed container. Execute generated code against test harnesses, vote on verdicts. Low compute requirement — even a modest machine qualifies. Every consensus agreement earns a micro-reward.

+0.005 / +0.01 / +0.03 CU per vote

👨‍💻 Developer

Submit atoms via MCP (Claude Code, Cursor), CLI, or WebSocket. Get back verified code that passes your tests — generated by the network, funded by your own contributions if you run a worker or validator.

−0.5 / −1 / −3 CU per atom

Up and running in 2 minutes

Clone the repo and run the setup wizard. It handles auth, LLM detection, container engine, config, and optional background service install — interactively.

One-time setup
# 1. Clone
git clone https://github.com/poulpeck/codoken-client
cd codoken-client

# 2. (Recommended on macOS) Create a virtual environment
python3 -m venv venv && source venv/bin/activate

# 3. Install dependencies then run the setup wizard
pip install -r requirements.txt
python codoken_setup.py

# The wizard will:
#   - Ask which role(s) to run: worker / validator / both
#   - Sign in or create your Codoken account
#   - Auto-detect your local LLM (Ollama, LM Studio, llama.cpp)
#   - Auto-detect Docker / Podman for the validator
#   - Write ~/.codoken/config.json
#   - Optionally install a background service (launchd / systemd)
# Run the doctor to verify everything is working
python codoken_setup.py check

# Manage the background service
python codoken_setup.py service install    # auto-start on login (launchd / systemd)
python codoken_setup.py service uninstall

# Tail live logs
python codoken_setup.py logs               # all roles
python codoken_setup.py logs worker        # worker only
python codoken_setup.py logs --lines 0     # follow mode (ctrl+c to exit)
# Add to ~/.claude/settings.json after codoken_setup.py completes
{
  "mcpServers": {
    "codoken": {
      "command": "python",
      "args": ["/path/to/codoken/codoken_mcp.py"],
      "env": {
        "CODOKEN_AUTH": "firebase",
        "CODOKEN_AUTH_STORE": "~/.codoken/auth.json"
      }
    }
  }
}

# In Claude Code, submit your first atom
submit_atom(task_id="hello", language="python",
            prompt="Write add(a,b) -> int",
            test_code="assert add(2,3)==5")
# Connect as developer and submit a manifest directly
import asyncio, json, websockets

async def submit():
    async with websockets.connect(
        "wss://broker.codoken.dev/ws/developer",
        additional_headers={"Authorization": "Bearer <firebase-id-token>"}
    ) as ws:
        await ws.send(json.dumps({
            "action": "submit_manifest",
            "task_id": "hello",
            "manifest": {
                "version": "1.0",
                "environment": {"language": "python"},
                "worker_payload":    {"prompt": "Write add(a,b)->int"},
                "validator_payload": {"test_code": "assert add(2,3)==5"}
            }
        }))
        print(await ws.recv())

asyncio.run(submit())
For GPU owners

Start earning credits

Connect your local LLM. Earn CU for every approved generation while your machine is idle.

⚡ Set up your worker →
For developers

Ship verified code

Sign up with your email. Get 100 free credits. Submit atoms via MCP in Claude Code or Cursor.

Get started free →