Sign inSign up

johannesfoulds/claude-code-free

By johannesfoulds

•Updated 6 months ago

Image
0

1.7K

johannesfoulds/claude-code-free repository overview

⁠johannesfoulds/claude-code-free

A full AI pair programmer in VS Code, running locally in a container, connected and ready in 2 minutes — at zero cost.

Claude Code⁠ — Anthropic's own coding agent — running against free models via OpenRouter⁠. No Anthropic subscription. No credit card. One free API key and one command.

Maintained by: Johannes Foulds⁠ Where to get help: GitHub Issues⁠ · Source repository⁠ Supported architectures: amd64, arm64


⁠Supported tags

TagDescription
latestLatest stable build — Dockerfile⁠

⁠Quick start

docker run -d \
  --name claude-code-free \
  -p 2223:22 \
  -v claude-workspace:/workspace \
  -e ANTHROPIC_BASE_URL=https://openrouter.ai/api \
  -e ANTHROPIC_AUTH_TOKEN=your-openrouter-api-key \
  -e ANTHROPIC_MODEL=stepfun/step-3.5-flash:free \
  johannesfoulds/claude-code-free

Connect via SSH (key auth — no password needed if SSH_AUTHORIZED_KEY is set):

ssh -p 2223 coder@localhost

Fallback password (if no key is configured): coder

Get a free OpenRouter API key at openrouter.ai/settings/keys⁠.

Note: Free-tier models are community-supported and subject to rate limits. For higher throughput, add credits⁠ to your OpenRouter account or switch to a paid model.


⁠Environment variables

VariableRequiredDescription
ANTHROPIC_BASE_URLYesAPI base URL. Set to https://openrouter.ai/api for OpenRouter.
ANTHROPIC_AUTH_TOKENYesYour OpenRouter API key.
ANTHROPIC_MODELYesModel ID. See Models⁠ below.
ANTHROPIC_API_KEYNoAlternative to ANTHROPIC_AUTH_TOKEN. Either works.
SSH_AUTHORIZED_KEYNoPublic key written to /home/coder/.ssh/authorized_keys at startup. Recommended over password auth.
⁠Using Docker Secrets

Sensitive values can be injected via the _FILE suffix convention. The entrypoint reads the file path and exports the value:

# Example — inject API key from a Docker secret
-e ANTHROPIC_AUTH_TOKEN_FILE=/run/secrets/openrouter_key

⁠Volumes

Mount pathPurpose
/workspaceYour project files. Persist this volume across container restarts.
# Named volume (recommended)
-v claude-workspace:/workspace

# Bind mount your local directory
-v /path/to/your/project:/workspace

⁠Ports

PortProtocolDescription
22TCPSSH — used by VS Code Remote SSH and direct terminal access.

⁠Using with VS Code Remote SSH

Add to ~/.ssh/config:

Host claude-code-free
    HostName localhost
    Port 2223
    User coder

Then connect: Cmd+Shift+P → Remote-SSH: Connect to Host → claude-code-free.


⁠Using with Docker Compose

services:
  claude-code:
    image: johannesfoulds/claude-code-free:latest
    ports:
      - "2223:22"
    volumes:
      - workspace:/workspace
    environment:
      - ANTHROPIC_BASE_URL=https://openrouter.ai/api
      - ANTHROPIC_AUTH_TOKEN=${OPENROUTER_API_KEY}
      - ANTHROPIC_MODEL=${OPENROUTER_MODEL:-stepfun/step-3.5-flash:free}
      - SSH_AUTHORIZED_KEY=${SSH_AUTHORIZED_KEY}
    restart: unless-stopped

volumes:
  workspace:

⁠Injecting an SSH public key

# Use whichever public key you have (id_ed25519, id_rsa, etc.)
docker run -d \
  -e SSH_AUTHORIZED_KEY="$(cat ~/.ssh/id_ed25519.pub)" \
  ... \
  johannesfoulds/claude-code-free

Or mount a Kubernetes ConfigMap at /root/ssh-keys/authorized_keys.


⁠Models

Set ANTHROPIC_MODEL to any OpenRouter model ID. The default is chosen for rate-limit headroom — for best coding quality with occasional use, try qwen/qwen3-coder:free.

ModelContextReq/minNotes
stepfun/step-3.5-flash:free256K50Default — best availability; SWE-bench 74%
qwen/qwen3-coder:free262K8Best coding quality; privacy-safe
openai/gpt-oss-120b:free131K—⚠ Free provider trains on your prompts
openai/gpt-oss-20b:free131K—⚠ Free provider trains on your prompts
nvidia/nemotron-3-super-120b-a12b:free262K—⚠ NVIDIA logs all prompts (trial use only)
meta-llama/llama-3.3-70b-instruct:free65K8Simple tasks; context halved on free tier
google/gemma-3-27b-it:free131K—⚠ No tool use on free tier — incompatible

Full list: openrouter.ai/models?q=free⁠ · Model guide with benchmarks and pricing⁠


⁠What's inside

ComponentDetails
Base imagenode:22-slim (Debian)
Claude CodeLatest stable (@anthropic-ai/claude-code)
Node.js22 LTS
Python3 (system)
Web accessw3m, curl, markdownify
SSH serverOpenSSH
Usercoder (non-root, passwordless sudo)

⁠Updating

Pull the latest image and recreate the container:

docker pull johannesfoulds/claude-code-free:latest
docker stop claude-code-free && docker rm claude-code-free
# re-run your original docker run command

With Docker Compose:

docker compose pull && docker compose up -d

⁠Source

github.com/JohnnyFoulds/claude-code-free⁠ · MIT License

Tag summary

Content type

Image

Digest

sha256:ad95946f3…

Size

182.6 MB

Last updated

6 months ago

docker pull johannesfoulds/claude-code-free