PL Log inCreate account
Launching in October 2026. Accounts, model catalog, calculator and docs are live. Studio is available in preview; generation is awaiting activation.

Claude Code with a Custom Base URL and Prepaid Balance

Point Claude Code at a custom ANTHROPIC_BASE_URL and pay from a prepaid balance. Env vars, settings.json, model pinning, VS Code and troubleshooting.

To run Claude Code against a custom endpoint, set two environment variables before you start it: ANTHROPIC_BASE_URL=https://jantaris.com and ANTHROPIC_AUTH_TOKEN=sk-jt-.... Claude Code then sends every request to that base URL's Anthropic-compatible /v1/messages endpoint, and usage is charged to your prepaid Jantaris balance instead of a subscription or a separate Anthropic Console account. Run /status inside Claude Code to confirm it worked.

I use this setup daily. Below is the exact configuration for macOS, Linux and Windows, how to make it permanent, how to pick models, and what to do when something returns 401 or 402.

Why use a custom base URL for Claude Code

Claude Code is a client. It talks to the Anthropic Messages API, and it lets you choose where that API lives through ANTHROPIC_BASE_URL. Anthropic's own docs call this connecting to an LLM gateway.

Reasons I route Claude Code through Jantaris:

  • Prepaid, no subscription. I top up a balance (from $10) and it does not expire. No monthly plan, no minimum commitment.
  • One balance for everything. The same key and balance pay for Claude in the terminal, image and video generation in my scripts, and chat models in my apps.
  • Clear per-token pricing. Claude Opus 5.5 costs $5.40 / $27.00 per 1M tokens and Claude Sonnet 5 costs $3.24 / $16.20 per 1M tokens, listed on the pricing page.
  • No training on your code. Prompts and outputs are not used to train models.

Claude Code's behavior does not change. Only the destination of its API calls does.

Step 1: get an API key and check it works

Sign up at jantaris.com/signup, top up, and create a key in the dashboard. It starts with sk-jt-.

Before touching Claude Code, send one request by hand. This rules out key and balance problems up front:

bash
export ANTHROPIC_BASE_URL=https://jantaris.com
export ANTHROPIC_AUTH_TOKEN=sk-jt-...

curl -sS -w '\n%{http_code}\n' -X POST "$ANTHROPIC_BASE_URL/v1/messages" \
  -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 64,
    "messages": [{"role": "user", "content": "Reply with the word ok."}]
  }'

A JSON message and 200 on the last line means you are ready. Note that the base URL has no /v1 suffix. Claude Code appends /v1/messages itself, so https://jantaris.com/v1 would produce a broken path.

Step 2: set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN

macOS and Linux (current shell)

bash
export ANTHROPIC_BASE_URL=https://jantaris.com
export ANTHROPIC_AUTH_TOKEN=sk-jt-...
claude

Start claude from the same shell so it inherits the variables.

Windows PowerShell (current session)

powershell
$env:ANTHROPIC_BASE_URL = "https://jantaris.com"
$env:ANTHROPIC_AUTH_TOKEN = "sk-jt-..."
claude

Why AUTH_TOKEN and not API_KEY

Claude Code has two credential variables and they end up in different headers:

VariableHeader sentWhen to use
ANTHROPIC_AUTH_TOKENAuthorization: Bearer ...Recommended for Jantaris
ANTHROPIC_API_KEYx-api-key: ...Also accepted by Jantaris

Jantaris reads both headers, so either works. I use ANTHROPIC_AUTH_TOKEN because it takes precedence over a saved claude.ai login immediately, while ANTHROPIC_API_KEY asks you to approve the key once in interactive mode.

Step 3: verify with /status

Inside Claude Code, run:

text
/status

On the Status tab, check two lines:

  • Anthropic base URL should show https://jantaris.com.
  • Auth token should name ANTHROPIC_AUTH_TOKEN.

Then send any prompt. A normal answer confirms the whole path works.

Step 4: make it permanent in settings.json

Shell exports vanish when you close the terminal. To make the setup stick, put the variables in your user settings file:

  • macOS and Linux: ~/.claude/settings.json
  • Windows: %USERPROFILE%\.claude\settings.json
json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://jantaris.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-jt-..."
  }
}

If both a shell export and the settings file set the same variable, the settings file wins.

One warning I repeat to everyone: never put the key in a project's .claude/settings.json. That file usually gets committed, and your key ends up in the repository for every clone.

Choosing models in Claude Code

Jantaris exposes Claude models under stable ids: claude-opus-5.5 and claude-sonnet-5. To make Claude Code use them explicitly, pin the model variables in the same env block:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://jantaris.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-jt-...",
    "ANTHROPIC_MODEL": "claude-sonnet-5",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5.5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4.5"
  }
}

What each one does:

  • ANTHROPIC_MODEL sets the model a session starts with.
  • ANTHROPIC_DEFAULT_OPUS_MODEL and ANTHROPIC_DEFAULT_SONNET_MODEL decide what the Opus and Sonnet entries in the /model picker map to.
  • ANTHROPIC_DEFAULT_HAIKU_MODEL also controls background tasks such as session titles. Pointing it at claude-haiku-4.5, the cheapest Claude model in the catalog, keeps those small calls cheap.

You can still switch mid-session with /model.

Which Claude model for which task

TaskModelWhy
Everyday edits, tests, refactorsClaude Sonnet 5Fast and much cheaper per token
Large refactors, architecture, hard bugsClaude Opus 5.5Stronger reasoning on long, messy context
Background tasksClaude Sonnet 5Low cost, fine quality

My habit: Sonnet by default, /model to Opus when I hit something Sonnet goes in circles on, then back.

Claude Code in VS Code and CI

VS Code extension

The VS Code extension checks credentials before it launches, so put the variables in VS Code's own user settings (open with Preferences: Open User Settings (JSON)):

json
{
  "claudeCode.environmentVariables": [
    { "name": "ANTHROPIC_BASE_URL", "value": "https://jantaris.com" },
    { "name": "ANTHROPIC_AUTH_TOKEN", "value": "sk-jt-..." }
  ]
}

GitHub Actions

For the Claude Code GitHub Action, set the base URL and token in the workflow env and pass the key as the action's anthropic_api_key input too, which the action requires before it starts:

yaml
env:
  ANTHROPIC_BASE_URL: https://jantaris.com
  ANTHROPIC_AUTH_TOKEN: ${{ secrets.AI_API_KEY }}

steps:
  - uses: anthropics/claude-code-action@v1
    with:
      anthropic_api_key: ${{ secrets.AI_API_KEY }}

Keeping an eye on your prepaid balance

Agentic coding burns tokens faster than chat. A long session that reads many files can use a lot of input tokens. Two habits keep it in check:

  1. Check the balance from the terminal:
bash
curl -s https://jantaris.com/v1/balance -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN"
  1. Scope your sessions. Start new sessions for new tasks instead of dragging one huge context along. Use Sonnet for routine work.

When the balance runs out, requests return 402. Claude Code shows an error, nothing is charged, and it works again as soon as you top up. Top-ups start at $10, and ready-made packs of $10, $25, $50, $100 and $250 make it a two-click job.

Troubleshooting Claude Code with a custom endpoint

SymptomLikely causeFix
401 on every requestKey typo, or key in a header the endpoint ignoresRe-copy the key, keep ANTHROPIC_AUTH_TOKEN
404 on requestsBase URL ends in /v1Use https://jantaris.com exactly
404 naming the modelModel id not in the catalogUse claude-opus-5.5 or claude-sonnet-5
402Balance too lowTop up on pricing
/status shows the old URLSettings file overrides the shellEdit ~/.claude/settings.json
Auth conflict warning at startOld ANTHROPIC_API_KEY still setunset ANTHROPIC_API_KEY, or /logout the claude.ai login
429Rate limitWait and retry

One more thing: features that depend on a claude.ai identity, such as Remote Control and voice dictation, are unavailable while a gateway credential is active. That is a Claude Code rule, not a Jantaris one. Unset the variables to use them.

Other tools that work the same way

The same trick works beyond Claude Code. Anything that speaks the Anthropic Messages API can point at https://jantaris.com, and anything that speaks the OpenAI API can use https://jantaris.com/v1. That includes Cursor, n8n and Make. I cover the OpenAI side in Call Claude, Gemini, DeepSeek and GPT with the OpenAI SDK, and the reference is in /docs/claude-code and /docs/anthropic-messages.

FAQ

What should ANTHROPIC_BASE_URL be for Jantaris?

https://jantaris.com, without /v1. Claude Code adds /v1/messages to the base URL on its own.

Should I use ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY?

Either works, because Jantaris accepts both Authorization: Bearer and x-api-key. I recommend ANTHROPIC_AUTH_TOKEN, which takes precedence over a saved claude.ai login without an extra approval step.

Does Claude Code work the same through a custom base URL?

Yes. The CLI's behavior, tools and commands stay the same. Only features tied to a claude.ai account, such as Remote Control and voice dictation, are unavailable while a gateway credential is set.

What happens when my balance runs out mid-session?

Requests return HTTP 402 and Claude Code shows an error. Top up and continue. There is no subscription and the balance does not expire.

Which Claude models can I use?

claude-opus-5.5 and claude-sonnet-5. Pin them with ANTHROPIC_MODEL and the ANTHROPIC_DEFAULT_*_MODEL variables, or switch with /model.