---
title: "Deploy a self hosted AI agent platform with Cohub"
description: "Deploy Cohub as a self hosted AI agent platform on Kubernetes with Postgres, Redis, S3 storage, OIDC auth, and your own model keys—hosted billing off."
lang: "en"
canonical: "https://cohub.live/guides/self-host-cohub"
image: "https://cohub.live/_seo/og/guides/self-host-cohub.png"
updated: "2026-12-02"
---

# Deploy Cohub as a self hosted AI agent platform on your own cluster

To self-host an AI agent platform with Cohub, provision Kubernetes, Postgres, Redis, shared storage, S3-compatible object storage and an OIDC provider, then deploy each service from the repository's templates.

- **Who:** Platform or infrastructure engineers asked to run a shared agent workspace inside their own environment.
- **When:** Hosted Cohub is ruled out by policy, or the team wants to modify and operate the platform itself.
- **Why:** Cohub's source is Apache-2.0 with deploy templates for each service, and without hosted billing everything runs on your infrastructure with your keys.

![Self-hosting architecture overview for Cohub listing the web app, API, worker, agent service, sandbox and gateway](https://cohub.live/_seo/img/github/self-hosting-doc.webp)

The self-hosting guide in the Cohub repository, with the typical production architecture

![Cohub pricing page showing Free, Plus ($10/mo), Pro ($50/mo) and Max ($200/mo) alongside the Apache-2.0 self-hosting FAQ](https://cohub.live/_seo/img/pricing/pricing-faq-self-host.webp)

Bringing up Cohub as a self hosted AI agent platform puts the entire Apache License 2.0 stack onto infrastructure you operate, using your own OIDC provider and model keys with hosted billing off by default. Bring up the local development stack first to verify auth and databases, then deploy each service onto Kubernetes from its template directory.

## Provision the production stack first
Full production expects Kubernetes for per-Space sandboxes alongside the backing data and identity services below:

| Component | Production requirement |
|---|---|
| Kubernetes | Schedules isolated sandboxes per Space; expected for full production |
| Postgres and Redis | Stores application state, background queues, and caches |
| Shared filesystem | Holds Space workspaces and checkpoint caches |
| S3-compatible object storage | Stores assets and checkpoint history as Git packs (no Git host needed) |
| OIDC provider | Logto or another OIDC-compatible identity provider for sign-in |
| Container images | Build and publish your own images, then point deployment configs at them |
| Model keys | Defined in the platform's `.cohub/models.json` |

The repository's deployment guide is concise and assumes Kubernetes familiarity. Under `deploy/`, each component (`api`, `web`, `worker`, `agent`, `gateway`, `fs-api`, `storage`, and more) carries its own README.

## Boot the repo locally before touching Kubernetes
Clone the Cohub source tree and confirm the API and web services start against your database, Redis, and OIDC settings locally:

```bash
# clone the Cohub source, then run the rest from its root
cd cohub
pnpm install
cp apps/api/.env.example apps/api/.env
cp apps/web/.env.example apps/web/.env
# fill DATABASE_URL, REDIS_URL and the OIDC settings
pnpm dev
```

## Wire OIDC sign-in across web and API
Update both the frontend build configuration and the API runtime environment so token validation matches. The API resource value must equal the audience your OIDC provider writes into access tokens:

```bash
# web, at build time
PUBLIC_LOGTO_ENDPOINT=https://auth.example.com/
PUBLIC_LOGTO_APP_ID=...
PUBLIC_LOGTO_API_RESOURCE=https://api.example.com
# API, at runtime
LOGTO_ENDPOINT=https://auth.example.com
AUTH_RESOURCE=https://api.example.com
```

## Configure platform and user model keys
Shared platform providers are registered in the platform's `.cohub/models.json`. Only platform-level configuration is permitted to read keys from service environment variables.

Individual users can also attach their own providers inside their Home Space using literal keys. Supported provider interfaces include `openai-completions`, `openai-responses`, and `anthropic-messages`.

## Roll out services from deploy templates and run migrations
Inside `deploy/<component>/<env>/` for each service, copy `values.example.yaml` to `values.yaml` and `secrets.template.yaml` to `secrets.yaml`, populate real values locally without committing them to Git, and execute `deploy.sh`. The API deployment directory includes the database migration script.

## Point the CLI at your cluster and run a smoke test
Direct the Cohub CLI at your self-hosted API and OIDC issuer, sign in, and create a test Space:

```bash
export COHUB_BASE_URL=https://api.example.com
export COHUB_AUTH_ISSUER=https://auth.example.com
export COHUB_AUTH_CLIENT_ID=<cli-client-id>
cohub auth login
cohub spaces create --name "smoke-test"
```

If the gateway or web frontend runs on separate hosts, export `COHUB_WS_URL` and `COHUB_WEB_URL` as well.

Finish with a four-step end-to-end check inside that Space: create the Space, send a prompt to the agent, start a server and preview its port, and publish an App. That single pass verifies the API, agent service, sandbox runtime, and object storage together.

## Optional integrations and default switches
- **Telemetry:** Export traces by setting `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`; leave it unset to send no telemetry.
- **Shared screens:** Configure a Cloudflare Realtime TURN key when corporate networks block direct WebRTC connections.
- **App room media:** Add an SFU app to enable WebRTC in App rooms; without an SFU, rooms still function over WebSocket.
- **Billing:** Hosted billing is off by default and commerce remains disabled.

## Reference in the docs

**This page:** The order to bring up a self-hosted Cohub in, and how to check each step.

- [CLI](https://cohub.live/docs/developers/cli): the CLI settings for a self-hosted API and OIDC provider
- [Self-hosting](https://cohub.live/docs/developers/self-hosting): the self-hosting architecture, deploy templates, OIDC and storage setup

## FAQ

### Can I run it without Kubernetes?

For development, yes, with pnpm dev. The guide says full production still expects Kubernetes for sandboxes.

### Do image and video generation work self-hosted?

They depend on the model adapters and keys you configure; the guide lists this as a known limit.

## Related

- [Run Cohub as a self-hosted AI workspace on your own cluster](https://cohub.live/use-cases/self-hosted-ai-workspace): Cohub can run as a self-hosted AI workspace: deploy the Apache-2.0 source on your Kubernetes cluster, sign in through your OIDC provider, and point the agent at your own model keys.
- [Cohub as an open source Devin alternative for self-hosted teams](https://cohub.live/compare/devin-alternative): Devin operates as a Cognition-managed autonomous software engineer for ticket-to-PR work; Cohub is an Apache-2.0 agent workspace you can use hosted or deploy on your own cluster with your own model keys.
- [Run an AI agent in Discord or WeChat, backed by a Space](https://cohub.live/use-cases/agent-in-discord-wechat): To run an AI agent in Discord, WeChat, Feishu or QQ, add the messenger as a Channel in Cohub's settings and bind it to a Space; messages go to the Space's agent and replies come back in the same chat.

## Sources

- [Cohub docs: CLI (environments)](https://cohub.live/docs/developers/cli)
- [Cohub pricing (Can I self-host instead?)](https://cohub.live/pricing)

Updated Dec 2, 2026
