Gateway quickstart#
Start the gateway on your machine, send it a first request and see the request's tokens and cost, in a few minutes.
git clone https://github.com/ArtificialAnalysis/Tokedex.git
cd Tokedex
docker compose up --no-buildgateway-1 | Gateway is ready. Sign in with this master key:
gateway-1 |
gateway-1 | <master-key>
gateway-1 |
gateway-1 | Find it as /home/node/.tokedex/master-key. Follow the Quick start on Home after signing in.You need: Docker with Compose, and an API key from a model provider, such as OpenAI, Anthropic or Google. Docker pulls the published image on the first start.
Keep the container logs private because they contain the master key.
git clone https://github.com/ArtificialAnalysis/Tokedex.git
cd Tokedex
npm install
npm start ● Gateway is up
Dashboard http://127.0.0.1:4000/
API http://127.0.0.1:4000/v1
Control http://127.0.0.1:4000/control
Master key
<master-key>
Saved as ~/.tokedex/master-key. Sign in with it, then follow the Quick start
on Home.You need a supported Node.js LTS release (see engines in package.json) and an API key from a model provider, such as OpenAI, Anthropic or Google. npm start builds the gateway and its dashboard first, which takes a few minutes. With pnpm, pnpm install and pnpm start do the same.
Sign in#
- Open
http://127.0.0.1:4000in a browser on the same machine. - Paste the master key and choose Continue with master key. The dashboard opens on Home.
The master key has full access, so keep it private. To sign in with a password from now on, choose Create account in the Using master key banner. Do it before you invite anyone, and keep the master key for recovery after that, so the key that can do everything stays out of daily use.
Send your first request#
Follow the Quick start card at the top of Home:
- Under Connect a model provider, choose your provider, paste its API key and choose Save key. The card says the provider is connected.
- Under Make your first request, choose Create API key. The card's command now holds a new API key, shown this once.
- Choose Copy command and run it in a terminal.
curl http://127.0.0.1:4000/v1/chat/completions \
-H "Authorization: Bearer <your-api-key>" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-6-luna","messages":[{"role":"user","content":"Say hello in one short sentence."}]}'{"id":"chatcmpl-…","object":"chat.completion","model":"openai/gpt-6-luna","choices":[{"index":0,"message":{"role":"assistant","content":"Hello there!"},"finish_reason":"stop"}],"usage":{"prompt_tokens":14,"completion_tokens":2,"total_tokens":16}}The card fills in a model that your provider serves, such as openai/gpt-6-luna for OpenAI. The request calls your provider and can incur charges.
See what it cost#
The Quick start card shows what the request cost. Once the request is served, the card reads You're set up, and See its trace and cost shows what the request used:
Your first request used 16 tokens (14 in, 2 out), costing <$0.0001.
Choose Open its trace → to open the request in Observability, with the provider and model that answered and its Estimated cost. If the request is refused or fails, the card says why and how to fix it.
Check that the gateway is running#
curl -sS http://127.0.0.1:4000/readyz{"ok":true,"release":{"environment":"local"},"service":"tokedex"}The check needs no key.
State and the master key#
The gateway keeps its state, the master key and the provider keys you save in the gateway-data volume. docker compose down keeps the volume. To choose your own master key, set TOKEDEX_MASTER_KEY to at least 32 characters in a .env file in the repository root before the first start.
To back up the volume and rehearse a restore, choose Docker under Run with. Backup and restore
Important: Stop the gateway with docker compose down, without -v. Deleting the volume deletes your accounts, API keys and saved provider keys, and the gateway starts again as a new installation.
The gateway keeps its state and the master key in ~/.tokedex. To back it up, stop the gateway and archive that directory with your .env if you made one. Keep the archive in private, encrypted storage because it contains credentials.
To upgrade, take a backup, check out the new release, then run npm install and npm start. The gateway keeps using ~/.tokedex. If the new release fails, use the backup to restore the release you ran and its state.
To choose your own master key, set TOKEDEX_MASTER_KEY to at least 32 characters in a .env file in the repository root before the first start. .env.example lists the other settings.
The gateway answers only on its own machine. Before anyone else uses it, serve it over HTTPS. To run it in production, see Deploy to production.
Next: Connect your app, Provider credentials or Observability.