DEV Community

TokenHub
TokenHub

Posted on

Using one LLM API key across OpenAI-compatible clients, Claude Code, and terminal agents

If you test multiple LLM clients, the annoying part is rarely the first API call. It is the mess around it: keys, base URLs, model names, billing pages, and protocol differences.

TokenHub is a prepaid gateway that exposes one endpoint for common LLM workflows:

  • OpenAI SDKs with a custom base_url
  • Claude Code via ANTHROPIC_BASE_URL
  • Codex / Responses-compatible flows
  • OpenCode and DeepSeek-TUI style terminal tools

The core idea is simple:

One key. One endpoint. Multiple LLM protocols.

OpenAI-compatible chat completion

Set your TokenHub API key as TOKENHUB_KEY, then call the OpenAI-compatible endpoint:

curl https://llm.sandboxclaw.com/v1/chat/completions \
  -H "Authorization: Bearer $TOKENHUB_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "moonshot-v1-8k",
    "messages": [{"role": "user", "content": "Reply exactly ok"}],
    "max_tokens": 8
  }'
Enter fullscreen mode Exit fullscreen mode

For SDKs, the important part is setting the base URL to:

https://llm.sandboxclaw.com/v1
Enter fullscreen mode Exit fullscreen mode

Claude Code style setup

For tools that expect Anthropic-style environment variables, point the base URL at TokenHub and reuse the same key:

export ANTHROPIC_BASE_URL=https://llm.sandboxclaw.com
export ANTHROPIC_API_KEY=$TOKENHUB_KEY

claude --bare -p --model moonshot-v1-8k "Reply exactly ok"
Enter fullscreen mode Exit fullscreen mode

When this is useful

This is useful when you are testing model-backed tools and do not want to keep switching between separate dashboards, vendor keys, and billing setups.

A few practical use cases:

  • Trying different models before committing to one provider
  • Running local terminal agents with one prepaid key
  • Giving a small team one endpoint for experiments
  • Keeping demo projects easy to configure

The current public model catalog includes chat, agent, and image options, with examples such as moonshot-v1-8k, kimi-k2.6, deepseek-chat, Claude-compatible models, Gemini-compatible models, and gpt-image-2.

Docs and quickstart:

https://tokenhub.sandboxclaw.com/docs/quickstart?utm_source=devto&utm_medium=article&utm_campaign=launch

Homepage:

https://tokenhub.sandboxclaw.com/?utm_source=devto&utm_medium=article&utm_campaign=launch

Top comments (0)