File size: 1,891 Bytes
373bb4f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ---
title: VS Code + Claude Code + Codex
emoji: 💻
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
---
# VS Code (code-server) with Claude Code & OpenAI Codex
Browser-based VS Code, with the `claude` and `codex` CLIs preinstalled, and persistent
storage via a Hugging Face [Storage Bucket](https://huggingface.co/docs/hub/storage-buckets)
mounted at `/data`.
## 1. Set a password secret
In **Space settings → Variables and secrets**, add a secret:
- `PASSWORD` = a password of your choice
(If you skip this, code-server generates a random password each restart and prints it
to the Space's container logs — check there if you didn't set one.)
## 2. Create and attach a storage bucket (free persistent storage)
```bash
# create the bucket (one-time)
hf buckets create my-vscode-data
# attach it to this Space, mounted at /data
hf spaces volumes set <your-username>/<this-space> -v hf://buckets/<your-username>/my-vscode-data:/data
```
You can also do this from the Space's **Settings → Storage Buckets** UI, mount path `/data`.
Note that `/data` is only available at *runtime*, not during the Docker build — the
`entrypoint.sh` script detects it on container start and, if present, points `$HOME` at
`/data/home` (seeding it from the image's default home on first run). Everything under
your home directory persists: your workspace, VS Code settings/extensions, `claude`/`codex`
logins, shell config, the works. Without an attached bucket, everything still works, just
ephemerally (lost on restart).
## 3. Log in to Claude Code and Codex
Open a terminal inside VS Code (``Ctrl+` ``) and run:
```bash
claude # follow the login prompt (or set ANTHROPIC_API_KEY as a Space secret)
codex # follow the login prompt (or set OPENAI_API_KEY as a Space secret)
```
With a bucket attached, you only need to log in once — credentials persist across restarts.
|