---
title: "Deploy OpenHands + DeepSeek AI Coding Agent"
description: "AI coding agent with DeepSeek, GitHub integration, and persistent workspace"
category: "AI/ML"
url: https://railway.com/deploy/openhands-deepseek-ai-coding-agent
---

# Deploy OpenHands + DeepSeek AI Coding Agent

AI coding agent with DeepSeek, GitHub integration, and persistent workspace

**[Deploy OpenHands + DeepSeek AI Coding Agent on Railway](https://railway.com/template/openhands-deepseek-ai-coding-agent)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/openhands-deepseek-ai-coding-agent/manifest.json

- **Creator:** onepluspadtrading's Projects
- **Category:** AI/ML
- **Total deploys:** 1

## Template content

### deepseek-api https://raw.githubusercontent.com/All-Hands-AI/OpenHands/main/logo.png

- **Image:** ghcr.io/railwayapp/function-bun:1.4.0
- **Start command:** `./run.sh aW1wb3J0IEhvbm8gZnJvbSAiaG9ubyI7Cgpjb25zdCBhcHAgPSBuZXcgSG9ubygpOwoKY29uc3QgREVFUFNFRUtfQVBJX0tFWSA9IHByb2Nlc3MuZW52LkRFRVBTRUVLX0FQSV9LRVk7CmNvbnN0IERFRVBTRUVLX0FQSV9VUkwgPSAiaHR0cHM6Ly9hcGkuZGVlcHNlZWsuY29tL2NoYXQvY29tcGxldGlvbnMiOwoKYXBwLnBvc3QoIi9jaGF0IiwgYXN5bmMgKGMpID0+IHsKICB0cnkgewogICAgY29uc3QgeyBtZXNzYWdlIH0gPSBhd2FpdCBjLnJlcS5qc29uKCk7CgogICAgaWYgKCFtZXNzYWdlKSB7CiAgICAgIHJldHVybiBjLmpzb24oeyBlcnJvcjogIk1lc3NhZ2UgaXMgcmVxdWlyZWQiIH0sIDQwMCk7CiAgICB9CgogICAgaWYgKCFERUVQU0VFS19BUElfS0VZKSB7CiAgICAgIHJldHVybiBjLmpzb24oeyBlcnJvcjogIkRFRVBTRUVLX0FQSV9LRVkgbm90IGNvbmZpZ3VyZWQiIH0sIDUwMCk7CiAgICB9CgogICAgY29uc3QgcmVzcG9uc2UgPSBh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ICA1MDAKICAgICk7CiAgfQp9KTsKCmFwcC5nZXQoIi9oZWFsdGgiLCAoYykgPT4gewogIHJldHVybiBjLmpzb24oeyBzdGF0dXM6ICJvayIgfSk7Cn0pOwoKYXBwLmdldCgiLyIsIChjKSA9PiB7CiAgcmV0dXJuIGMuanNvbih7CiAgICBtZXNzYWdlOiAiRGVlcFNlZWsgQVBJIFNlcnZpY2UiLAogICAgZW5kcG9pbnRzOiB7CiAgICAgICJQT1NUIC9jaGF0IjogIlNlbmQgYSBtZXNzYWdlIHRvIERlZXBTZWVrIiwKICAgICAgIkdFVCAvaGVhbHRoIjogIkhlYWx0aCBjaGVjayIsCiAgICB9LAogICAgdXNhZ2U6ICdQT1NUIC9jaGF0IHdpdGggSlNPTiBib2R5OiB7ICJtZXNzYWdlIjogInlvdXIgcXVlc3Rpb24gaGVyZSIgfScsCiAgfSk7Cn0pOwoKZXhwb3J0IGRlZmF1bHQgYXBwOw==`
- **Health check:** /
- **Public domain:** Yes

### openhands-deepseek https://raw.githubusercontent.com/All-Hands-AI/OpenHands/main/logo.png

- **Image:** ghcr.io/openhands/agent-canvas:latest
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# OpenHands + DeepSeek AI Coding Agent

A production-ready deployment of OpenHands on Railway, configured to use DeepSeek as your LLM provider. This brings autonomous AI engineering to your own infrastructure.

## Deploy and Host

Depoy OpenHands with DeepSeek on Railway in minutes. Get a persistent workspace, GitHub integration, basic auth protection, and a public web URL. All conversations and code changes survive redeploys.

## About Hosting

OpenHands runs in local-runtime mode on Railway—the agent executes in the container itself (fast, fine for single-user or trusted use). Your workspace is stored on a persistent 5GB volume. Railway provides automatic HTTPS, HTTP basic auth, and environment-variable-based configuration.

## Why Deploy

- **Self-hosted**: Your code and conversations stay private on your Railway instance
- **DeepSeek-powered**: Uses the affordable deepseek-chat model for code generation
- **GitHub-native**: Clone repos, create branches, write fixes, and open pull requests autonomously
- **Cost-effective**: ~$5–15/month for compute + pay-as-you-go for DeepSeek API tokens
- **Always-on**: Agents continue working even when your laptop is shut down

## Common Use Cases

- **Autonomous issue resolution**: Assign a GitHub issue, get a pull request
- **Full-stack feature development**: Describe a feature, get scaffolded and tested code
- **Codebase refactoring**: Automate legacy migrations, TypeScript conversions, dependency bumps
- **Code review assistance**: Multi-conversation workspace for reviewing and iterating
- **Persistent workflows**: Long-running tasks that outlive a session

## Dependencies for

You'll need:

- **DeepSeek API key**: Sign up at [platform.deepseek.com](https://platform.deepseek.com)
- **GitHub personal access token**: Create at [github.com/settings/tokens](https://github.com/settings/tokens) with `repo` scope
- **Basic auth credentials**: Choose a username and password to protect your instance

## Features

- **Web UI**: Access OpenHands from any browser via a public Railway URL
- **DeepSeek Integration**: Uses deepseek-chat model for code generation and analysis
- **GitHub Integration**: Connect your repos, read code, create branches, and open pull requests
- **Persistent Workspace**: All conversations, files, and history survive redeploys
- **Basic Auth**: Simple username/password protection for your deployment
- **Local Runtime**: Executes in the Railway container (fast, fine for single-user/trusted use)

## Getting Started

1. Click "Deploy" and wait for the build (~3–5 minutes)
2. Once healthy, open the public Railway URL
3. Log in with your basic auth username and password
4. In Settings, add your DeepSeek API key and GitHub token
5. Start a conversation, attach repositories, and assign tasks

## Configuration

| Variable | Description | Example |
|----------|-------------|----------|
| `LLM_MODEL` | DeepSeek model (pre-filled) | `deepseek-chat` |
| `LLM_API_KEY` | DeepSeek API key | Your API key from platform.deepseek.com |
| `LLM_BASE_URL` | DeepSeek API endpoint (pre-filled) | `https://api.deepseek.com/v1` |
| `GITHUB_TOKEN` | GitHub personal access token with repo scope | Your token from github.com/settings/tokens |
| `BASIC_AUTH_USER` | Web UI login username | `admin` |
| `BASIC_AUTH_PASSWORD` | Web UI login password | Your secure password |
| `RUNTIME` | Agent runtime mode (pre-filled for Railway) | `local` |

## Agent Capabilities

- **Read/write files** in your workspace
- **Run shell commands** (within the container)
- **Git operations**: clone, branch, commit, push
- **Create pull requests** via GitHub API
- **Web browsing** for research and context
- **Multi-conversation workspace** with persistent chat history

## Cost

- **Railway**: ~$5–15/month on the Hobby plan for compute
- **DeepSeek API**: Pay per token used (very affordable)
- **No per-seat licensing** — one deployment, unlimited conversations

## Security & Privacy

- Your code stays in your Railway instance (private)
- API keys stored as encrypted Railway secrets
- Basic auth protects HTTP and WebSocket endpoints
- Agent sandbox is isolated to the mounted `/workspace` volume
- **Local-runtime mode**: Agent executes in the container; keep the deployment access-controlled since it has shell access

## Troubleshooting

### Deployment won't start
- Check the deployment logs for errors
- Ensure `LLM_API_KEY` and `GITHUB_TOKEN` are set in Variables
- Verify the image tag is valid (defaults to `latest`)

### Web UI won't load
- Confirm basic auth username and password
- Check browser console for errors
- Wait for deployment to become healthy (initial builds take 3–5 minutes)

### Agent can't access repos
- Verify your GitHub token has `repo` scope
- Check that the token is still valid (not expired)
- Confirm the repo URL is correct and public or accessible to your token

## Upgrading

Bump the Docker image tag in Railway service settings and redeploy. Your workspace and conversation history survive on the persistent volume.

## Resources

- [OpenHands Docs](https://docs.openhands.dev)
- [DeepSeek Docs](https://docs.deepseek.com)
- [Railway Docs](https://docs.railway.com)

## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/openhands-deepseek-ai-coding-agent
