Skip to main content
Droid is Factory AI’s CLI coding assistant. You can connect BetterToken as a custom Anthropic-compatible provider by editing the config file.

Prerequisites

Install Droid

curl -fsSL https://app.factory.ai/cli | sh

Setup

1

Clear conflicting environment variables

You must unset ANTHROPIC_AUTH_TOKEN before proceeding. If it remains set, it overrides the API key in the config file and causes authentication failures.
unset ANTHROPIC_AUTH_TOKEN
unset ANTHROPIC_BASE_URL
2

Edit the Droid config file

Config file path: ~/.factory/config.json
The file is config.json, not settings.json.
Add the following (replace YOUR_API_KEY with your BetterToken API Key):
{
  "custom_models": [
    {
      "model_display_name": "BetterToken Claude",
      "model": "claude-sonnet-4-5",
      "base_url": "https://www.bettertoken.com/v1",
      "api_key": "YOUR_API_KEY",
      "provider": "anthropic",
      "max_tokens": 64000
    }
  ]
}
3

Navigate to your project and start Droid

cd /path/to/your/project
droid
4

Select the model

Type /model in Droid and select BetterToken Claude.

Using multiple models

To configure multiple models, add additional entries to the custom_models array:
{
  "custom_models": [
    {
      "model_display_name": "Claude Sonnet",
      "model": "claude-sonnet-4-5",
      "base_url": "https://www.bettertoken.com/v1",
      "api_key": "YOUR_API_KEY",
      "provider": "anthropic",
      "max_tokens": 64000
    },
    {
      "model_display_name": "Claude Opus",
      "model": "claude-opus-4-5",
      "base_url": "https://www.bettertoken.com/v1",
      "api_key": "YOUR_API_KEY",
      "provider": "anthropic",
      "max_tokens": 32000
    }
  ]
}