> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inferable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Self hosting

> Self-hosting Inferable Control Plane

Inferable is [open source](https://github.com/inferablehq/inferable) (MIT license) and can be self-hosted on your own infrastructure.

This guide will walk you through setting up a self-hosted instance of Inferable using Docker Compose.

Requirements:

* Docker
* Docker Compose

## Infrastructure Requirements

Inferable is designed to run efficiently on commodity hardware. The system has minimal infrastructure dependencies, requiring only:

* PostgreSQL database (with pgvector extension)
* Redis for caching and high-throughput message processing

Both of these services can be run on modest hardware, making Inferable easy to deploy in any environment.

<Steps>
  <Step title="Download Docker Compose definition">
    We provide a [Docker Compose definition](https://raw.githubusercontent.com/inferablehq/inferable/refs/heads/main/control-plane/docker-compose.yml) within the [Inferable repository](http://github.com/inferablehq/inferable).

    Use `curl` to download the file:

    ```bash
    curl -O https://raw.githubusercontent.com/inferablehq/inferable/refs/heads/main/control-plane/docker-compose.yml
    ```
  </Step>

  <Step title="Define environment variables">
    When running using `docker-compose.yml`, most [environment variables](/pages/self-hosting#configuration) have defaults but the following need to be provided explicitly:

    * `MANAGEMENT_API_SECRET` (This can be generated using `openssl rand -hex 32`, take note of the value)
    * `ANTHROPIC_API_KEY` (With access to `claude-3-5-sonnet` / `claude-3-haiku` - our default reasoning models)
    * `COHERE_API_KEY` (With access to `embed-english-v3` - our default embedding model)

    <Note>
      You can alternatively (or in addition) use [AWS Bedrock](https://aws.amazon.com/bedrock) as the model provider. This will require you to provide AWS credentials.
      Please see the [configuration](/pages/self-hosting#configuration) section.
    </Note>

    ```bash
    export MANAGEMENT_API_SECRET=XXXXXXX
    export ANTHROPIC_API_KEY=XXXXXXX
    export COHERE_API_KEY=XXXXXXX
    ```
  </Step>

  <Step title="Start Docker Compose">
    ```bash
    docker-compose up
    ```

    This will start The Inferable [control plane](/pages/control-plane) at `http://localhost:4000` and the following auxiliary resources:

    * PostgreSQL database with pgvector
    * Redis for caching
  </Step>

  <Step title="Manage via the CLI">
    The [Inferable CLI](https://www.npmjs.com/package/@inferable/cli) can be used to manage your Inferable instance.
    Export `INFERABLE_API_ENDPOINT` to target your instance, rather than [Inferable Cloud](https://app.inferable.ai).

    See the section on [headless mode](#headless-mode) for more details.

    ```bash
    npm install -g @inferable/cli
    export INFERABLE_API_ENDPOINT=http://localhost:4000

    # If running in headless mode, you will be prompted for the `MANAGEMENT_API_SECRET` generated above
    inf auth login

    # Create a new cluster
    inf clusters create

    # Create a cluster key (for registering machines)
    inf auth keys create "MY_KEY"
    ```
  </Step>

  <Step title="Register tools and workflows">
    You can now use the SDKs to register tools and workflows (Node) using your-self hosted instance by providing the `baseUrl` option to initialize the client.

    <Tabs>
      <Tab title="TypeScript">
        ```typescript
        const inferable = new Inferable({
          apiSecret: "", // Generated in the previous step
          baseUrl: "http://localhost:4000",
        });
        ```
      </Tab>

      <Tab title="Go">
        ```go

        client, err := inferable.New(
          "", // Cluster API Secret (Generated in the previous step)
          "http://localhost:4000",
        )
        ```
      </Tab>

      <Tab title=".NET">
        ```csharp
          var inferable = new InferableClient(new InferableOptions {
            ApiSecret = "", // Generated in the previous step
            BaseUrl = "http://localhost:4000",

          });
        ```
      </Tab>
    </Tabs>

    For more details, see the [quick start](/pages/quick-start).
  </Step>
</Steps>

## Configuration

The Inferable control-plane accepts the following environment variables:

| Variable                | Description                                                                                           | Required                          |
| ----------------------- | ----------------------------------------------------------------------------------------------------- | --------------------------------- |
| `MANAGEMENT_API_SECRET` | A deployment secret for the management API.                                                           | Yes (If running in headless mode) |
| `ANTHROPIC_API_KEY`     | API key for the [Anthropic API](https://www.anthropic.com/).                                          | Yes (If Bedrock is not available) |
| `COHERE_API_KEY`        | API key for the [Cohere API](https://cohere.ai).                                                      | Yes (If Bedrock is not available) |
| `BEDROCK_AVAILABLE`     | If set to `true`, Bedrock will be used as the model provider (You must also provide AWS credentials). | No                                |
| `DATABASE_URL`          | The connection string for the PostgreSQL database.                                                    | Yes                               |
| `DATABASE_SSL_DISABLED` | If set to `true`, SSL will be disabled for the PostgreSQL database.                                   | No                                |
| `REDIS_URL`             | The connection string for the Redis instance.                                                         | Yes                               |
| `APP_ORIGIN`            | The origin of the Inferable Web UI for CORS.                                                          | No                                |
| `JWKS_URL`              | The URL of the [Clerk JWKS url](https://clerk.com/docs/backend-requests/handling/manual-jwt).         | No                                |
| `CLERK_SECRET_KEY`      | The [Clerk](https://clerk.com) secret key.                                                            | No                                |
| `HYPERDX_API_KEY`       | API key for sending telemetry to [Hyperdx](https://www.hyperdx.io).                                   | No                                |
| `ROLLBAR_ACCESS_TOKEN`  | API key for sending error events to [Rollbar](https://rollbar.com).                                   | No                                |
| `POSTHOG_API_KEY`       | API key for sending analytic events to [Posthog](https://posthog.com).                                | No                                |
| `POSTHOG_HOST`          | The host for sending analytic events to [Posthog](https://posthog.com).                               | No                                |
| `EE_DEPLOYMENT`         | Enable startup check for availability of **all** features.                                            | No                                |

# Headless Mode

This self-hosting guide will produce a "headless" instance of Inferable, meaning the the [control plane](/pages/control-plane) will be running but not the Web UI. Web UI is not essential to interacting with the control-plane.

The Web UI relies on [Clerk](https://clerk.com) for authentication with Cluster being associated with a Clerk Organization.
In headless mode, a `MANAGEMENT_API_SECRET` is used instead.

The `MANAGEMENT_API_SECRET` should only be used for managing clusters. You can use it to create API Keys which are used by the SDK to register tools.

```bash
inf auth keys create "MY_KEY"
```

<Note>
  The [Web UI is also open
  source](https://github.com/inferablehq/inferable/tree/main/app). We will be
  adding a guide for self-hosting the Web UI in the future.
</Note>
