Skip to content
Popular

Quickstart

Create an account, add credit, create an API key and make your first request to Tokens with cURL, Python or Node.js, then connect your coding agent.

On this page

This quickstart takes you from a new account to a working API call, then to a connected coding agent. You need a terminal and, for the SDK examples, a recent Python 3 or Node.js 18+.

1. Create an account#

Sign up at tokens.bd/register with email or Google. Verify your email address: you can't create API keys until it is verified.

2. Add credit: a plan or a top-up#

Keys only work when there is something to pay for usage with. Pick one (or both) in /dashboard/billing:

  • Subscribe to a plan for a weekly or monthly credit allowance. Compare them on pricing.
  • Top up your wallet for pay-as-you-go use. The minimum top-up is $5 or ৳500.

Prices are shown in USD, BDT. Available payment methods: Invoice via billing portal. If you want to pay in taka, read paying in BDT first.

3. Create an API key#

Open /dashboard/keys and create a key. Give it a name you will recognise later ("laptop", "ci", "staging-bot"). You can also set a monthly spend cap and limit the key to certain models; both are optional, and both are fixed once the key exists. API keys explains when to use them.

The secret starts with tok_live_ and is shown once. Copy it now and put it in an environment variable:

export TOKENS_API_KEY="tok_live_your_key"

Warning

Never paste the key into code you commit, and never ship it in a web page. Browser calls to Tokens are not supported; call it from a server, script or CLI.

4. Make your first request#

The OpenAI-compatible base URL is https://tokens.bd/v1. The examples use deepseek/deepseek-v4.1-flash; swap in any model id from /models that your plan or wallet covers.

curl https://tokens.bd/v1/chat/completions \
  -H "Authorization: Bearer $TOKENS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4.1-flash",
    "messages": [{"role": "user", "content": "Say hello in one short sentence."}]
  }'

A successful response is a normal OpenAI chat completion. If you get an error instead, the error.code field tells you why:

CodeUsual causeFix
invalid_api_keyTypo, or the variable isn't set in this shellecho $TOKENS_API_KEY and re-export
model_not_foundThe model id is wrongCopy the id from GET /v1/models
tier_permission_deniedYour plan doesn't include that model and the wallet is emptyPick another model or top up
no_funding / insufficient_creditsNo plan and no wallet balanceSubscribe or top up in /dashboard/billing

The full list is in errors.

List the models your key can use#

bash
curl https://tokens.bd/v1/models -H "Authorization: Bearer $TOKENS_API_KEY"

The id of each entry in data is exactly what you put in model.

5. Connect your coding agent#

The quickest route for OpenCode, Claude Code, Codex CLI and Crush is the Tokens CLI. It signs you in through the browser, lets you pick a default model, and edits the agents' config files with a backup of each:

curl -fsSL https://tokens.bd/cli/tokens.mjs -o tokens.mjs && node tokens.mjs setup --base-url https://tokens.bd

See Tokens CLI for what it changes. If you prefer to configure things by hand, or use another tool, /dashboard/connect has copy-and-paste settings for each agent, and the guides cover them in detail:

Test your key from this page#

Paste your key below to send a short test request through the gateway. It costs a few tokens.

Live connection test

Check latency and token generation before you start coding.

POST /v1/chat/completions
Create a key

Next steps#

Was this page helpful?

Still stuck? Open a support ticket

Need help configuring your agent?

Test your connection with the connection tester, or create an API key.