aihomelabprivacy

Run Claude Code Locally with OtoDock

🤖 Researched and drafted automatically from the official docs, and reviewed before publishing. Commands are taken from the source projects — but always sanity-check before running anything on your own hardware.

OtoDock lets you run Claude Code and Codex locally on your own server, cutting out the rental model entirely. Instead of paying Anthropic for every interaction, you host the agent runtime yourself and keep all compute costs and data on your hardware.

Prerequisites

You’ll need a Linux server with Docker installed, at least 8GB of RAM, and a stable network connection. OtoDock handles the agent orchestration; you provide the infrastructure.

Step 1: Clone the OtoDock Repository

Start by pulling the latest OtoDock source onto your server:

git clone https://github.com/otodock/otodock.git
cd otodock

Review the README to understand the project structure and any specific requirements for your environment.

Step 2: Review Configuration and Dependencies

Examine the repository for configuration files and dependency manifests (typically requirements.txt, Dockerfile, or docker-compose.yml):

ls -la
cat README.md

This step ensures you understand what services OtoDock needs and what ports it will use.

Step 3: Build and Deploy with Docker

If a Dockerfile is present, build the image:

docker build -t otodock:latest .

If Docker Compose is available, use it to spin up the full stack:

docker-compose up -d

For manual setup, follow the instructions in the repository’s setup guide to install dependencies and start the service.

Step 4: Verify the Service is Running

Check that OtoDock is listening on its designated port (consult the README for the exact port):

netstat -tulpn | grep otodock

Or use curl to test the health endpoint if one is documented:

curl http://localhost:[PORT]/health

Step 5: Configure Local Access and Network Security

OtoDock should only be accessible from your LAN or through a VPN. Do not expose it directly to the public internet. If you’re running this behind a reverse proxy, ensure authentication is enabled and the service is bound to a private interface.

For LAN-only access, bind OtoDock to your internal network IP or 127.0.0.1 and firewall external traffic:

sudo ufw allow from 192.168.1.0/24 to any port [PORT]
sudo ufw deny from any to any port [PORT]

Step 6: Integrate Claude Code and Codex Agents

OtoDock’s agent runtime will now handle Claude Code and Codex operations locally. Refer to the repository documentation for how to configure which models or agent types to enable. Typically this involves editing a config file or environment variables before starting the service.

Step 7: Test the Agent Workflow

Once running, test a simple agent task to confirm the setup works. The exact method depends on OtoDock’s API—check the README for example requests or CLI commands.

Is It Worth It?

Yes, if you run Claude agents regularly. Every call you make through Anthropic’s hosted service costs money; hosting it yourself means you pay once for hardware and electricity, then nothing per interaction. You also keep your data and prompts off their servers. The trade-off is you’re responsible for uptime, security, and keeping OtoDock updated. For a homelab or small team, that’s a fair deal. For one-off experiments, the API is simpler.

Related guides

← All guides