Integration guide

Connect your tools

Use your TokensAreOnMe wallet key with a coding agent or make a request from your own code.

Prelaunch. API access is not live. App setups were tested locally with a simulated supplier and have not been run against a live key.

Connection settings

Base URL
https://tokensareonme.com/v1
Provider type
Custom · OpenAI-compatible
API key
Your wallet’s taom_ spending key
Model
An exact ID from GET /v1/models

Use the custom provider with this base URL. Don’t put your wallet key in a built-in provider or commit it to source control.

App setup

Open the instructions for your app. Disable automatic retries when testing. Each call can spend wallet credit.

If your app uses a terminal environment variable, set your wallet key in the terminal before opening the app.

OpenCode

Add a custom provider to ~/.config/opencode/opencode.json (all projects) or opencode.json in one project. Merge with existing providers rather than replacing your whole configuration. For a new install, use OpenCode 2.x, distributed as @opencode/cli (tested with 2.4.1). The older opencode-ai package is 1.x (tested with 1.19.6). Check opencode --version; their config formats are not interchangeable.

Already using opencode 1.x? Use this legacy configuration.
opencode 1.x · opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "tokensareonme": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "TokensAreOnMe",
      "options": {
        "baseURL": "https://tokensareonme.com/v1",
        "apiKey": "{env:TOKENSAREONME_API_KEY}"
      },
      "models": {
        "anthropic/claude-sonnet-5.5": {
          "name": "Claude Sonnet 5.5",
          "limit": { "context": 30000, "output": 4096 }
        }
      }
    }
  }
}

Then run opencode and choose tokensareonme/anthropic/claude-sonnet-5.5 with /models.

OpenCode 2.x configuration: list each catalog model under models; the modelID is sent to our API.

opencode 2.x · opencode.json
{
  "model": "tokensareonme/claude-sonnet-5.5",
  "providers": {
    "tokensareonme": {
      "name": "TokensAreOnMe",
      "env": ["TOKENSAREONME_API_KEY"],
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": { "baseURL": "https://tokensareonme.com/v1" },
      "models": {
        "claude-sonnet-5.5": {
          "modelID": "anthropic/claude-sonnet-5.5",
          "capabilities": { "tools": true, "input": ["text"], "output": ["text"] },
          "limit": { "context": 30000, "output": 4096 }
        }
      }
    }
  }
}

With the key available in this terminal, run opencode --standalone. The example selects tokensareonme/claude-sonnet-5.5 by default. Standalone mode starts a fresh private server with this terminal's environment.

Hermes Agent

Tested with Hermes Agent 0.23.1. After setting the wallet key, run these commands to configure your active profile. They change its default provider and model without hand-editing YAML or storing your key in it:

Hermes Agent · configuration commands
hermes config set model.provider custom
hermes config set model.default anthropic/claude-sonnet-5.5
hermes config set model.base_url https://tokensareonme.com/v1
hermes config set model.key_env TOKENSAREONME_API_KEY
hermes config set model.context_length 64000
hermes config set compression.threshold_tokens 24000

Hermes refuses a context window below 64,000 tokens, so keep context_length at that value and let threshold_tokens make it compact earlier. Hermes does not send an output limit; we apply 1,024 tokens.

T3 Code

Tested with T3 Code 0.1.11 using pi 1.6.0. T3 runs a coding agent you have configured; the following is the verified pi setup route.

  1. Configure pi first. In the same terminal where TOKENSAREONME_API_KEY is available, run t3 serve. A desktop app opened separately may not inherit that terminal's environment variables.
  2. On first launch, use Add more agents → Pi → Turn on, then Start. For an existing setup, open Settings → Providers and enable Pi. Check that Pi is ready and that its Models list includes tokensareonme/anthropic/claude-sonnet-5.5.
  3. Open a new thread. In the model picker beside the composer, choose Pi's anthropic/claude-sonnet-5.5 entry with the tokensareonme provider label. The Settings Models list controls availability; it does not choose the active thread model.

If Pi works in a terminal but T3 says it failed to run, check the Node version in T3's login shell. Pi 1.6.0 requires Node 22.19 or newer; a terminal's temporary PATH override may not survive that login shell. Fix its default Node version, restart T3, and refresh provider status. Use Pi's Binary path setting if your executable is not on that PATH.

pi

Tested with pi 1.6.0 from @earendil-works/pi-coding-agent (Node.js 22.19 or newer). Upgrade the deprecated @mariozechner/pi-coding-agent package before using this example; its older key-reference syntax is different.

Add this provider to ~/.pi/agent/models.json. Merge it with any existing providers rather than replacing your whole file. Keep the leading $ in apiKey: pi resolves it from your terminal environment, not from a literal key in the file.

pi · models.json
{
  "providers": {
    "tokensareonme": {
      "baseUrl": "https://tokensareonme.com/v1",
      "api": "openai-completions",
      "apiKey": "$TOKENSAREONME_API_KEY",
      "models": [
        {
          "id": "anthropic/claude-sonnet-5.5",
          "contextWindow": 30000,
          "maxTokens": 4096
        }
      ]
    }
  }
}

Start with pi --provider tokensareonme --model anthropic/claude-sonnet-5.5. The provider and exact catalog model are selected explicitly.

Aider

Aider reads the endpoint from environment variables. The openai/ prefix tells Aider to use an OpenAI-compatible endpoint; the rest is our model ID.

Aider · shell
export OPENAI_API_BASE=https://tokensareonme.com/v1
export OPENAI_API_KEY="$TOKENSAREONME_API_KEY"
aider --model openai/anthropic/claude-sonnet-5.5

Tested with Aider 0.86.2. Its model database may warn that this custom model has an unknown context window or price. Keep the exact model ID above rather than choosing a suggested provider model. Your wallet balance and API receipts, not Aider's local cost estimate, determine what you are charged.

Other OpenAI-compatible apps

Other clients, including Cline, Kilo Code, Goose, Zed, Crush, Droid, Continue, Open WebUI and LibreChat, have not been qualified here. A custom endpoint option alone does not establish compatibility. If you test another client, use the settings section with Chat Completions, not Responses or Messages. Where a tool asks whether the model supports images, answer no; where it asks about tool calling, answer yes.

Not supported: tools that only speak a different protocol cannot use this key. That includes OpenAI Codex CLI (Responses API only) and Claude Code (Anthropic Messages API only). T3 Chat does not offer a custom endpoint setting.

Custom API calls

Prelaunch. The public API returns HTTP 503. Run this example only in a trusted test environment or after public access opens.

Set your key below, then send a chat completion. Replace the sample model with any exact ID from GET /v1/models.

Set your wallet key in the terminal
Wallet key · terminal environment
read -rs TOKENSAREONME_API_KEY; export TOKENSAREONME_API_KEY; printf '\n'

read -rs waits for you to paste the key and press Enter; the key is not echoed. Run curl or your app in that same terminal.

cURL · one request
curl --fail-with-body --retry 0 --max-time 30 \
  -X POST "${TOKENSAREONME_BASE_URL:-https://tokensareonme.com/v1}/chat/completions" \
  -H "Authorization: Bearer $TOKENSAREONME_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"model":"openai/gpt-6.1-sol","messages":[{"role":"user","content":"Hello"}],"max_tokens":32,"stream":false}'

Python, JavaScript and the full API reference →

Limits and troubleshooting

API limits
  • Tool calling (function calling) is supported: tools, tool_choice, assistant tool_calls and tool result messages. Strict tool schemas (function.strict: true) are not supported and return HTTP 400 before any credit hold or dispatch.
  • Streaming is accepted but not incremental. A request with stream: true is kept open while the model works, then receives the complete answer in one event. Your tool will wait, then show the whole reply at once.
  • Text only. Your agent can read files locally and send their text. Image, audio and binary file input is not accepted.
  • Each request is at most about 120 KB of conversation and tool definitions for most models. We size a request by its bytes, which overstates its tokens, so that nothing we accept can overflow the model. Set a context window of 30,000 tokens and maximum output of 4,096 tokens where the tool exposes those settings. The context limit keeps a tool compacting its history before it reaches that size. A larger request receives 400 context_length_exceeded, which most tools answer by compacting.
  • Each answer is at most 4,096 tokens. A higher requested limit is lowered to 4,096; a long answer ends with finish_reason: "length".
  • Stop sequences, JSON response formats, log probabilities and more than one choice are rejected with a message naming the parameter. temperature and top_p are forwarded; client-specific reasoning options are ignored.
Billing and retries

The ordinary client setup does not need to generate an idempotency header: the gateway assigns a request identity when one is absent. Disable automatic retries in the client. If you intentionally enable SDK retries, configure a stable explicit idempotency key; the gateway refuses SDK retry attempts that lack one.

Before each request we hold credit for the largest it could cost, based on its size and output limit, then charge the actual amount and release the rest. Agents send their whole conversation and tool list every turn, so the hold is several times the final charge. A wallet whose available credit is below the hold receives 402 with a message stating the amount needed. A smaller context window means smaller holds.

Some clients retry failed requests on their own and do not send an Idempotency-Key. The gateway prevents an SDK retry without a stable key; identical requests are also protected from duplicate dispatch. To keep a retry from being charged twice, an identical request that is still running, or that was answered in the last two and a half minutes, is refused with 409 duplicate_request instead of being sent again. The next turn of a conversation is normally different. If you must repeat a request, inspect its receipt first. Do not blindly retry when its outcome is unknown: check its receipt and confirm the charge/state before any repeat. Waiting for the duplicate-request window to pass is not proof that a request was unbilled. Reusing an explicit key returns 409 request_already_recorded, not a cached answer; use a new key only for a genuinely new logical operation after the prior outcome is known. Requests without a supplied key receive an automatic identity the client cannot reuse.

Stopping an agent in the middle of a reply does not cancel the charge. We let the request finish so it can be billed correctly; if it cannot finish, your wallet may pause while the charge is confirmed. A failed request is not necessarily free: see receipts and billing.

Troubleshooting
  • 401 unauthorized: the key is wrong, revoked or replaced, or it was sent to a provider other than our base URL.
  • 400 unsupported_parameter or unsupported_content: the response's message names what to turn off in your tool.
  • 400 context_length_exceeded or 413 body_too_large: the conversation is too large for the model. Compact it, or lower the tool's context window so it compacts earlier.
  • 400 invalid_request: usually a model ID that is not in GET /v1/models, or tool messages out of order.
  • 402: not enough available credit for this request's hold. The response's message states the amount needed.
  • 409 duplicate_request: an identical request was just made. This rejected attempt was not charged; the earlier request may still have been charged. Check its receipt and confirm the earlier outcome before any repeat. Waiting is not proof that the earlier request was unbilled.
  • 409 wallet_frozen or 502: a previous request's charge is still being confirmed. Stop the agent and check your private page before continuing.
  • 503: the API is not enabled.

The HTTP protocol itself is described in the developer API guide. The public API remains disabled until launch.