Guides

Claude Code without a credit card: pay with M-Pesa or MoMo

TchaviBy Gael — Tchavi founder

· 13 min read

Back to blog

Table of contents

You have seen Claude Code everywhere: the agent that reads your repository, edits files and runs the tests for you. You install it, type claude, and the login screen asks for an Anthropic subscription, payable by international card. For many developers in Nairobi, Kampala or Kigali, that is where the story ends.

There is another door. Claude Code accepts an API address other than Anthropic's. You point it at Tchavi, top up with M-Pesa or another mobile money wallet, and pay for each request in credits. No card, no subscription. A spend-capped API key also protects you from the bad surprise of a session that runs all night.

I measured what a real task costs, end to end, on two models. The numbers are below.

In short

  • Tchavi, an OpenAI-compatible AI API gateway you pay for with mobile money, runs Claude Code without a bank card or an Anthropic subscription: two environment variables, ANTHROPIC_BASE_URL=https://tchavi.com/api and your Tchavi key in ANTHROPIC_AUTH_TOKEN.
  • You top up with mobile money from KES 250: M-Pesa in Kenya, MTN or Airtel in Uganda and Rwanda, MTN or Zamtel in Zambia, Orange in Sierra Leone (countries and operators). KES 250 buys about 3,300 credits at October 2026 rates, and the account starts at 0 credits: there are no free signup credits.
  • Give your key a spend limit. Once the limit is reached, Claude Code gets a refusal instead of carrying on spending.
  • A small real task cost 409.8 credits (about KES 31) on Claude Sonnet 5.5 and 49.8 credits (about KES 3.80) on GPT-6 Sol, with all tests green in both cases. The GPT-6 Sol figure assumes a warm cache: a session that starts cold, after a break for example, costs about KES 3 more. The gap comes mostly from prompt caching, which Tchavi does not apply to Claude models through Claude Code today.
  • Send background tasks to Claude Haiku 5.5, twenty times cheaper than Sonnet on input.
  • Cursor works too, but only for its chat panel.

Set up Claude Code in three steps

You need a Tchavi account, a top-up and a key. Create your account and top up KES 250 with mobile money, no card; your first paid top-up adds a bonus of 150 credits. Credits never expire, and there is no subscription. The key starts with sk-tch- and is shown only once: copy it right away.

1. Point Claude Code at Tchavi. In your terminal:

export ANTHROPIC_BASE_URL=https://tchavi.com/api
export ANTHROPIC_AUTH_TOKEN=sk-tch-your-key

The address really does stop at /api: Claude Code adds /v1/messages itself. Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY: the latter has to be approved inside Claude Code and is often ignored without you noticing. If you were already logged in with a claude.ai account, type /logout once in Claude Code.

This is the gateway mechanism Anthropic documents (Claude Code gateway documentation): ANTHROPIC_BASE_URL points to the gateway, and ANTHROPIC_AUTH_TOKEN carries its key.

2. Check the key before launching the agent. A single request is enough:

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-haiku-5-5","max_tokens":16,"messages":[{"role":"user","content":"Say OK"}]}'

A response that starts with {"id":"msg_ and a 200 at the end means it works. A 401 means the key did not arrive, usually a typo or an export done in another terminal.

3. Make the configuration permanent. export only lasts as long as the terminal. Put the settings in ~/.claude/settings.json, with the main model and the model behind each alias:

{
  "model": "claude-sonnet-5-5",
  "env": {
    "ANTHROPIC_BASE_URL": "https://tchavi.com/api",
    "ANTHROPIC_AUTH_TOKEN": "sk-tch-your-key",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5"
  }
}

The model line matters: without it, Claude Code starts on its default model, which its documentation says is Claude Opus 5.5 with an API key, at twice the price of Sonnet. This file is yours and applies to all your projects. Never put your key in a project's .claude/settings.json: that one is committed with the code. The full guide, with the edge cases, is in the Claude Code documentation.

A capped key to hold your budget

This is the part I recommend to everyone, especially people new to agents. A coding agent chains requests on its own: it reads, tries, reads again, reruns the tests. If you leave it on a big, badly scoped task, spending climbs without you noticing.

In the dashboard, when you create a key, you can set:

  • a spend limit in credits, the most this key can consume over its whole life;
  • an expiry date: 1 hour, 1 day, 3 days, 7 days, 1 month or a custom date.

Each request reserves its estimated cost up front. When that estimate is higher than what is left on the key, Tchavi refuses the request (an error 403, with "spend limit" in the message) and Claude Code stops. Your balance is not touched beyond the limit, and you can raise the limit at any time from the dashboard. The last request can overshoot by a few credits, because its final cost is only known at the end.

A key of 3,000 credits, about KES 230 at October 2026 rates, for one working day: that is the setting I would start with. You will quickly see whether it is too much or too little, and the number will be yours, not an estimate. It is also the right way to lend access to an intern or a CI job: one key per person, capped, set to expire.

Which model to pick in Claude Code

Claude Code does not force you to use Claude. Any model in the catalogue that can call tools works, because Tchavi translates requests from Anthropic's format to the other providers' formats. The prices below are October 2026 prices per million tokens, in KES at about KES 0.076 per credit. Above 100,000 input tokens per request, Claude Haiku 5.5 moves to about KES 83 for input and KES 417 for output; above 272,000, GPT-6 Luna moves to about KES 33 and KES 125.

ModelInputCached inputOutputWhat it is for
Claude Sonnet 5.5KES 333not appliedKES 1,666The recommended main model
Claude Opus 5.5KES 666not appliedKES 3,332Claude Code's default, pin the model
Claude Haiku 5.5KES 17not appliedKES 83Background tasks (titles, summaries)
GPT-6 SolKES 333KES 33KES 1,666Long sessions on a big repository
GPT-6 LunaKES 17KES 1.70KES 83Small repetitive tasks
DeepSeek V4.1 FlashKES 25KES 3.00KES 100A tight budget

The "cached input" column is the most important one for an agent. On every turn, Claude Code resends the whole session context: the files it read, the earlier exchanges, its own instructions. On OpenAI models, the provider automatically caches the start of the prompt, and Tchavi bills those already-seen tokens at one tenth of the price; DeepSeek V4.1 Flash does the same at about one eighth when the cache is hit. On Claude models, through Claude Code and Tchavi, this cache does not apply today: every turn pays for the whole context again at the full rate. The longer the session, the wider the gap.

To change the main model, one variable is enough:

export ANTHROPIC_MODEL=gpt-6-sol

Background tasks (session titles, summaries) go through the Haiku alias, which you never see but do pay for. Pointing it at claude-haiku-5-5 bills them twenty times cheaper than Sonnet.

What a real session costs, in credits and KES

Rather than estimate, I measured. The task: a small Node project for a shop, with two empty functions (formatFcfa, which prints "1 500 F", and totalPanier) and three failing tests. The instruction given to Claude Code, in non-interactive mode: "Implémente formatFcfa et totalPanier dans src/format.js pour que npm test passe. Ne modifie pas les tests. Lance les tests à la fin." (Implement both functions so npm test passes, do not touch the tests, run them at the end.)

Same task, same repository, two models, each with a capped key created for the occasion, on a Tchavi test instance at public prices. The numbers come from Tchavi's usage log, request by request.

ModelRequestsInput tokensof which read from cacheOutput tokensCreditsCost (KES, about)Tests
Claude Sonnet 5.5584,66501,695409.8313 of 3
GPT-6 Sol666,55365,72378149.83.803 of 3

Measured in October 2026 with Claude Code 2.1, one run per model. GPT-6 Sol's cache was already warm from an earlier attempt: expect about KES 3 more for a session that starts cold. KES amounts use about KES 0.076 per credit, the October 2026 rate.

Same result, three tests out of three in about twenty seconds, but a cost eight times lower with GPT-6 Sol. Most of the gap is in the cache column. On every request, Claude Code resends its own instructions, its tools and the session history: about 17,000 tokens per request on Sonnet, for a tiny task. On Sonnet, those tokens are paid again at the full rate each time. On GPT-6 Sol, almost all of them were read from the provider's cache, at one tenth of the price.

A caveat on the GPT-6 Sol figure: the start of Claude Code's prompt was already in that cache, because I had run the same task half an hour earlier. A session that starts cold, after a break for example, pays for that prefix once at the full rate, about KES 3 more (roughly 93 credits in total, about KES 7). Even then, GPT-6 Sol is more than four times cheaper than Sonnet on this task, and the gap grows with session length.

To give you an order of magnitude: on this small task, the minimum top-up of KES 250 (about 3,300 credits) pays for about 8 runs on Claude Sonnet 5.5, and on GPT-6 Sol between about 35 (cold cache) and 65 (warm cache). A real working day is several tasks, often bigger than this one: treat these figures as a ceiling, and count on more for tasks that read many files. That is what the capped key is for: in your first week, it gives you your real number.

What about Cursor?

Cursor also accepts another API address, in Cursor Settings → Models: paste your Tchavi key in the OpenAI section, turn on Override OpenAI Base URL, enter https://tchavi.com/api/v1, then add the models you want by hand (claude-sonnet-5-5, gpt-6-sol…) and click Verify.

Two limits to know before relying on it. Only the chat panel goes through your key: Tab completion and some agent features stay on Cursor's own models. And requests pass through Cursor's servers, which build the prompt before sending it. If you want the whole agent loop to go through Tchavi, a terminal agent like Claude Code is a better fit. The detail is in the Cursor guide.

What about Codex, OpenCode or Deep Code?

The principle is the same for the other terminal agents: an API address and a Tchavi key. Each one's setup is in the documentation: Codex, OpenCode and Deep Code. The prices in the table above apply to them too.

What changes when you go through a gateway

A few Claude Code features depend on a claude.ai account and stop working with a gateway key. Better to know before you start:

  • Remote Control and voice dictation no longer work: they require a claude.ai identity.
  • /fast reports itself as disabled: its check needs a claude.ai login or an Anthropic API key, which a gateway key does not replace.
  • /context shows an estimate: for that screen, Tchavi estimates tokens from the character count. Your bill uses the provider's real counts.

The rest works normally: reading and writing files, running commands, tests.

FAQ

Can you use Claude Code without a credit card?

Yes. Claude Code accepts an API address other than Anthropic's. You point it at https://tchavi.com/api, put your Tchavi key in ANTHROPIC_AUTH_TOKEN, and pay in credits topped up with mobile money, from KES 250.

Do you need an Anthropic subscription?

No. With a Tchavi key you only pay for the requests the agent sends, at each model's rate. There is no monthly subscription, and credits you buy never expire.

How much does Claude Code cost in Kenyan shillings?

It depends on the model and the size of the task. On the small task measured in this article, it was 409.8 credits (about KES 31) with Claude Sonnet 5.5 and 49.8 credits (about KES 3.80) with GPT-6 Sol, whose cache was already warm from an earlier attempt (about KES 3 more otherwise). A longer session costs more, and that is where the cache on OpenAI models makes the biggest difference.

What happens when my key reaches its spend limit?

The next request is refused (an error 403) and Claude Code stops. Your balance is not spent beyond the limit, give or take a few credits for the last request, and you can raise the limit from the dashboard.

Does Tchavi keep my code?

No. For text, Tchavi records the model, the tokens used and the cost, not the content of the requests. Your code is, however, processed by the maker of the model you choose and, depending on the model, by the host that runs it for them, each under its own privacy policy.

Can you use models other than Claude in Claude Code?

Yes, any model in the catalogue that can call tools: export ANTHROPIC_MODEL=gpt-6-sol, or deepseek-v4.1-flash for a small budget. Tchavi translates between Anthropic's format and the other providers' formats.

Does Anthropic accept this setup?

Claude Code itself documents the use of a gateway, with ANTHROPIC_BASE_URL (official documentation). Anthropic does state, however, that it does not verify third-party gateways and does not support using non-Claude models in Claude Code. With GPT-6 Sol it works (the measurement above shows it), but if something goes wrong, you write to Tchavi, not to Anthropic.

What if my mobile money payment does not arrive?

Your credits arrive when the operator confirms the payment you approved on your phone. If they do not, write to support@tchavi.com with the transaction reference from the SMS. How payments work is described in the documentation.


To get started, create your account and top up KES 250 with mobile money, then generate a capped key and follow the Claude Code guide.

This article is part of the series "Building an AI product from Africa". Tchavi is an OpenAI-compatible AI API gateway: one key gives access to over 100 text, image, audio and video models, and you pay for it with mobile money, no bank card (countries and operators). In the series: paying for the OpenAI or Claude API with M-Pesa, Ollama and Tchavi side by side and AI transcription for WhatsApp voice notes in Swahili. More guides, in French: the French blog. Follow us: LinkedIn and X.

Share

Your first API call, paid with mobile money

No bank card. Top up with mobile money in your local currency; your first top-up adds 150 bonus credits, and credits never expire.