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

# Droid BetterToken setup guide

> Connect BetterToken to Droid with Codex group model IDs.

Droid is Factory AI's CLI coding assistant. With BYOK, you can connect BetterToken as a custom OpenAI-compatible provider.

## Prerequisites

* BetterToken API Key (register here (`https://www.bettertoken.ai/register`))

## Install Droid

<Tabs>
  <Tab title="macOS / Linux">
    ```bash theme={null}
    curl -fsSL https://app.factory.ai/cli | sh
    ```
  </Tab>

  <Tab title="Windows">
    ```powershell theme={null}
    irm https://app.factory.ai/cli/windows | iex
    ```
  </Tab>
</Tabs>

## Setup

<Steps>
  <Step title="Clear conflicting environment variables">
    ```bash theme={null}
    unset OPENAI_API_KEY
    unset OPENAI_BASE_URL
    ```
  </Step>

  <Step title="Set the BetterToken API Key">
    ```bash theme={null}
    export BETTERTOKEN_API_KEY="YOUR_API_KEY"
    ```
  </Step>

  <Step title="Edit the Droid config file">
    Config file path: `~/.factory/settings.json`

    ```json theme={null}
    {
      "customModels": [
        {
          "displayName": "BetterToken Codex",
          "model": "YOUR_CODEX_MODEL_ID",
          "baseUrl": "https://www.bettertoken.ai/v1",
          "apiKey": "${BETTERTOKEN_API_KEY}",
          "provider": "openai",
          "maxOutputTokens": 64000
        }
      ]
    }
    ```

    Replace `YOUR_CODEX_MODEL_ID` with a current **Codex group** model ID copied from the model plaza (`https://www.bettertoken.ai/pricing`).
  </Step>

  <Step title="Only configure extra headers when the official docs explicitly require them">
    We did not find an official Droid setup requirement that makes `User-Agent` mandatory for BetterToken. Start with the `Base URL`, API key, and model ID shown on this page.

    If you are also using a custom gateway, tenant routing, observability, or caching layer, add headers only according to that upstream service's official docs.
  </Step>

  <Step title="Restart Droid">
    After updating the config file or environment variables, stop the current Droid process and launch it again.
  </Step>

  <Step title="Start Droid">
    ```bash theme={null}
    cd /path/to/your/project
    droid
    ```
  </Step>
</Steps>

<Note>
  If your version labels the provider as `OpenAI Compatible` instead of `openai`, follow the current UI label. If you need extra headers, follow the current Droid docs or your upstream gateway requirements instead of assuming `User-Agent` is mandatory for BetterToken.
</Note>
