Claude Code

Run Claude Code on heura with three environment variables. Heura speaks the Anthropic Messages API, so Claude Code needs no proxy and no plugin.

Tested with the real thing

The real Claude Code CLI (version 2.1.310) was run against https://api.useheura.com/anthropic: a one-word answer, then an agent task where it called its own Read tool, read a file and answered from it in two turns. Streaming and tool use were also checked with the official Anthropic SDK. Heura is pre-launch, so use a small balance.

Setup

  1. 1
    Get a key
    Sign in at the app with your wallet, add balance, then create a key under API keys. It starts with sk-.
  2. 2
    Set three variables
    Add them to your shell profile, or run them once before claude.
  3. 3
    Pick a model that has a seller
    Heura routes by model name. Choose one from GET /v1/models or the Market page.
bash
export ANTHROPIC_BASE_URL="https://api.useheura.com/anthropic"
export ANTHROPIC_AUTH_TOKEN="sk-your-heura-key"
export ANTHROPIC_API_KEY=""                 # blank, so a cached login cannot win

# pick models that have a live seller (see GET /v1/models)
export ANTHROPIC_MODEL="deepseek/deepseek-v4.1-flash"
export ANTHROPIC_SMALL_FAST_MODEL="deepseek/deepseek-v4.1-flash"

claude

Pin both model variables. Claude Code uses the small model for background work such as titles and summaries, and an unpinned slot asks for a model that may have no seller.

Check it works

Inside Claude Code run /status. It should show your base URL. Then ask for one word, and ask for something that needs a tool, such as reading a file. Your spend appears on the Usage page of the app within a few seconds.

What works and what does not

FeatureStatus
Text, system prompts, multi-turnWorks
Streaming (server-sent events)Works. Tested with the Anthropic SDK and Claude Code
Tool use, including parallel tool calls and tool resultsWorks. Tested with a real model
Images (base64 or https url)Translated to the OpenAI image format. Works only if the model accepts images
count_tokensAn estimate from the request size. It costs nothing
Extended thinking, cache_control, server tools such as web search, documentsNot carried over. They are ignored and never faked
Prompt caching discountsNone. Heura bills the tokens the seller reports

Things to know

  • A forced tool choice may be retried as automatic. Some providers, DeepSeek among them, refuse a forced tool choice while they are in thinking mode. Heura then asks once more with the choice set to automatic. The model still sees every tool.
  • Model quality varies. You are not running Claude unless a seller offers a Claude model. Smaller models follow the agent tool protocol less reliably on long multi-step tasks.
  • Large prompts cost real money. Claude Code sends a big system prompt on every turn. Set a spend cap on the key.
  • Request size limit is 8 MB.

Errors you may see

MessageMeaning
401 authentication_errorMissing or malformed key. Send it as ANTHROPIC_AUTH_TOKEN and blank ANTHROPIC_API_KEY
404 not_found_error: has no live sellerThat model has no seller now. Change ANTHROPIC_MODEL and ANTHROPIC_SMALL_FAST_MODEL
400 invalid_request_error: credit balance is too lowAdd balance in the app, or raise the key's cap
429 rate_limit_errorToo many requests from this key. Slow down and retry
529 overloaded_errorNo seller could serve the call right now. Retry in a moment

Anthropic SDK

Any Anthropic SDK works with baseURL set to https://api.useheura.com (or with /anthropic on the end) and the heura key as the API key. The endpoints are POST /v1/messages, POST /v1/messages/count_tokens and GET /anthropic/v1/models.

ts
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({ apiKey: process.env.HEURA_API_KEY, baseURL: "https://api.useheura.com" });
const msg = await client.messages.create({
  model: "deepseek/deepseek-v4.1-flash",
  max_tokens: 300,
  messages: [{ role: "user", content: "Say hello in three words." }],
});
console.log(msg.content[0].text);