Oh-My-Pi

Run the Oh-My-Pi coding agent on TunAI models

Documentation

Use TunAI with Oh-My-Pi

Oh-My-Pi (omp) is a terminal coding agent that talks to OpenAI-compatible APIs natively. Point it at TunAI and it reads, edits and runs code with any model in our catalog, billed to your TunAI balance in TND. No proxy or bridge is needed.

Before you start

  • An API key. Create one on API keys. Use a separate key for omp so you can cap its spend and revoke it on its own.
  • A balance. Agents send many requests per task. Top up on Billing first; every call is charged per token.

1Install Oh-My-Pi

curl -fsSL https://omp.sh/install | sh

Other methods (bun, nix, mise) are listed in the Oh-My-Pi README.

2Store your key in an environment variable

Keep the key out of the config file. omp reads apiKey as the name of an environment variable first, so export it from your shell profile:

# ~/.zshrc or ~/.bashrc
export TUNAI_API_KEY="YOUR_API_KEY"   # your sk-tunai-... key

Open a new terminal, or run source ~/.zshrc, so the variable is set.

3Register TunAI as a provider

Tick the models you want in omp. The file below is built from the live catalog, with each model's real context window, price and image support. The first model you tick becomes your default in step 5.

Loading models…

4Check the connection

List the models omp found for the provider. Every id you ticked should appear:

omp models tunai

If it fails, test the key directly. A JSON reply means the key and balance are fine:

curl https://api.tunai.tn/v1/chat/completions \
  -H "Authorization: Bearer $TUNAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-sonnet-5", "messages": [{"role": "user", "content": "ping"}]}'

5Make TunAI your default

Tick at least one model in step 3 to generate this file.

You can also run omp setup and choose the model in the wizard, switch inside a session with /model, or press Ctrl+P to cycle through your models.

6Start coding

cd your-project
omp

Every request appears on the Logs page within seconds, with its model, tokens and cost. Tool calls, streaming and image input all go through your key.

Keep costs under control

A coding agent can make hundreds of calls in one task.

  • Set a monthly budget on the omp key on API keys. Requests stop with a 402 once it's reached, instead of draining your balance.
  • Use a cheap model for smol. omp routes small jobs (titles, summaries, quick lookups) there.
  • Watch the Usage page for cost per model, and switch the default if one model dominates the bill.

Troubleshooting

401 invalid API keyomp sends the value of apiKey as the key when no environment variable has that name. Check echo $TUNAI_API_KEY prints your key in the shell you launch omp from.
402 insufficient_quotaYour balance is empty or the key reached its monthly budget. Top up on Billing or raise the budget on API keys.
404 model_not_foundThe id must match GET https://api.tunai.tn/v1/models exactly. Regenerate the file above if the catalog changed.
400 on max_tokensKeep maxTokens at 32000 or below for every model.
429 rate_limit_errorAgents send many requests in bursts. Subagents share one key, so raise the key's per-minute limit or give each machine its own key.
Thinking level changes nothingTunAI doesn't forward reasoning-effort settings yet, so models use their default. That's why the generated config sets reasoning: false.