Skip to content
Sign Up Free
Coding and development

Droid setup: API key, Base URL, and models

Install Droid, configure the BetterToken Base URL and API key, choose an available model, and troubleshoot common errors. Includes setup guidance.

To connect Droid to BetterToken, prepare an API key, enter the Base URL shown below, and choose a current Model ID from the model plaza.

Key settings

FieldValue
API KeyBetterToken API key
Base URLhttps://bettertoken.ai/v1
ModelA current Model ID from the model plaza

Prerequisites

Sign up and get a BetterToken API Key

Already have an account? Sign in, top up, then create a key in the console.

Additional requirements

Install

Install Droid

macOS / Linux

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

Windows

Terminal window
irm https://app.factory.ai/cli/windows | iex

Manual setup

You can add a model in the CLI through /settings → Custom models or /model → Manage custom models. In the Desktop app, open Settings → Custom Models. Both editors save to ~/.factory/settings.json; the file setup below is an alternative. See Factory’s custom-model guide.

FieldValue
API KeyBetterToken API key
Base URLhttps://bettertoken.ai/v1
ModelA current Model ID from the model plaza

Setup

Set the BetterToken API Key

macOS / Linux

Terminal window
export BETTERTOKEN_API_KEY="YOUR_API_KEY"

Windows PowerShell

Terminal window
$env:BETTERTOKEN_API_KEY="YOUR_API_KEY"

Replace YOUR_API_KEY with your BetterToken API Key. Droid supports ${BETTERTOKEN_API_KEY} environment-variable expansion in its JSON configuration.

Edit the Droid config file

Config file path: ~/.factory/settings.json

{
"customModels": [
{
"displayName": "BetterToken Codex",
"model": "YOUR_MODEL_ID",
"baseUrl": "https://bettertoken.ai/v1",
"apiKey": "${BETTERTOKEN_API_KEY}",
"provider": "openai"
}
]
}

Replace YOUR_MODEL_ID with a current model ID copied from the model plaza.

Start Droid and select the model

Terminal window
cd /path/to/your/project
droid

Enter /model in Droid and select BetterToken Codex. Factory watches the settings file for changes; if the model list does not refresh, exit and relaunch Droid.

Run a small test task

Start with a small task such as “Explain this project’s directory structure.” Once Droid returns a result, continue with cross-file edits or longer agent tasks.

In testing with Droid 0.248.0 in a fresh profile without a Factory sign-in, droid exec --model custom:YOUR_MODEL_ID "Reply with only: OK" succeeded with both values: openai sent requests to /v1/responses, and generic-chat-completion-api sent them to /v1/chat/completions. Use droid exec for a non-interactive check.

Verify the connection

Send a short test prompt. If the tool returns a response without an authentication or Model ID error, the connection works. Fully restart the tool after changing its configuration.

Switch models

Open the model selector or change the Model field in the configuration. Use the exact Model ID from the model plaza, then restart the current session.

Common errors

Troubleshooting

SymptomWhat to check
The custom model is missing from /modelValidate the JSON and confirm that model, baseUrl, apiKey, and provider are all present
Invalid providerUse the exact lowercase value "openai" or "generic-chat-completion-api", not a UI display label
401 or 403Copy the API Key again, confirm the Droid process can read BETTERTOKEN_API_KEY, and check your account balance
404 or Model not foundUse https://bettertoken.ai/v1 and copy a current GPT model ID from the model plaza
The old model remains after editingOpen /model again; if it still does not refresh, fully exit and relaunch Droid

FAQ

Configure the model

Copy the exact Model ID from the model plaza.

Set provider to openai to use OpenAI Responses API with Base URL https://bettertoken.ai/v1, or generic-chat-completion-api for Chat Completions.

Do I need custom headers?

No extra headers are required for a standard BetterToken setup. Add tenant, routing, or audit headers only when another gateway explicitly requires them.

Where can I check pricing and usage?

Use the live model plaza for current model pricing. Request usage and balance are available in the BetterToken Dashboard.

Advanced setup

Technical details

Protocol, endpoint, and internal provider fields

This setup uses https://bettertoken.ai/v1. The tool appends the OpenAI-compatible endpoint path. Do not add /chat/completions or /responses unless a specific field explicitly requires it.