Skip to main content

Terminal chat for Mesh API — OpenAI-compatible LLM gateway

Project description

meshapi-code

Terminal chat REPL for Mesh API — one OpenAI-compatible key, 300+ models. Streaming responses, live markdown, file/shell tool calls with approval, real-time cost.

$ meshapi
███╗   ███╗███████╗███████╗██╗  ██╗   ✦  meshapi 0.3.0
████╗ ████║██╔════╝██╔════╝██║  ██║   cwd:   ~/code/myproj
██╔████╔██║█████╗  ███████╗███████║   model: anthropic/claude-sonnet-4.5
██║╚██╔╝██║██╔══╝  ╚════██║██╔══██║   route: cheapest
██║ ╚═╝ ██║███████╗███████║██║  ██║
╚═╝     ╚═╝╚══════╝╚══════╝╚═╝  ╚═╝
type /help for commands, /exit to quit

› add a healthcheck endpoint to server.py and run the tests
… streamed markdown reply …
⚙ approve tool call?  write_file: server.py (1240 chars)   y/n › y
⚙ approve tool call?  run_bash: pytest -q                  y/n › y
   anthropic/claude-sonnet-4.5  •  942→318 tok  •  $0.001234  •  session $0.001234
   mode: approve each   model can request file/shell ops; you confirm each one   shift+tab to cycle

Install

pipx install meshapi-code           # recommended
uv tool install meshapi-code        # if you use uv
pip install meshapi-code            # plain pip

PyPI package is meshapi-code; the command on your $PATH is meshapi (same split Claude Code uses: @anthropic-ai/claude-codeclaude).

export MESHAPI_API_KEY=rsk_your_key_here
meshapi

Get a key at meshapi.ai.

What it does

  • Streaming completions with live markdown rendering (rich).
  • Real cost per turn — Mesh returns cost in the SSE tail; we surface it after every reply and accumulate session $….
  • Tool calling — the model can read files, write files, and run shell commands in the launch directory. Off by default behind an approval prompt; toggle with one key.
  • Permission modesapprove each (default), bypass perms (auto-execute, for trusted prompts), or no access (chat only). Cycle live with Shift+Tab.
  • Mid-session switching/model openai/gpt-4o-mini, /route cheapest, /mode bypass.
  • Smart routing/route cheapest|fastest|balanced hands model selection to Mesh's gateway, so you don't have to.
  • Persistent input history — up-arrow recalls past prompts across sessions.
  • Config + env-var override~/.meshapi/config.json, MESHAPI_API_KEY.

Tool calling

When tools are enabled, the model can call:

Tool What it does
read_file Read a file from the working directory (or absolute path).
write_file Create or overwrite a file. Parent dirs are created.
run_bash Run a shell command in the working directory. 60s timeout, 8000-char output cap.

The launch CWD is baked into the system prompt, so relative paths the model produces resolve where you'd expect. Three permission modes, cycled live with Shift+Tab or set with --mode / /mode:

  • ask (default) — every tool call requires a y/n confirmation. Safe.
  • bypass — the model auto-executes. Fast, like Claude Code's --dangerously-skip-permissions. Use only when you trust the prompt.
  • none — tools aren't sent to the model at all. Pure chat.
meshapi --mode bypass     # start in auto-execute mode
meshapi                   # default ask; press Shift+Tab to cycle

Slash commands

Command What it does
/help List commands
/model <name> Switch model (e.g. anthropic/claude-sonnet-4.5, openai/gpt-4o-mini)
/route <mode> cheapest, fastest, balanced, or default
/mode <perm> ask, bypass, or none (Shift+Tab also cycles)
/file <path> Inject a file into the conversation
/system <text> Replace system prompt and reset chat
/cost Show cumulative session spend
/clear Reset conversation
/exit Quit

Config

~/.meshapi/config.json:

{
  "base_url": "https://api.meshapi.ai/v1",
  "model": "anthropic/claude-sonnet-4.5",
  "system": "You are a helpful coding assistant. Be concise.",
  "route": null
}

The API key is read from MESHAPI_API_KEY (preferred) or stored in the same file. Input history lives at ~/.meshapi/history.

About Mesh API

Mesh API is a unified LLM gateway: one API key, 300+ models from OpenAI, Anthropic, Google, Meta, Mistral, DeepSeek, Alibaba, and more. It's OpenAI-compatible — change the model name in your request, leave everything else alone.

  • Zero platform fees for 12 months. You only pay for tokens.
  • Smart auto routing. route: cheapest|fastest|balanced and the gateway picks for you.
  • Automatic failover. If a provider goes down, your request routes to another. Your users won't know.
  • Highest rate limits. Capacity is pooled across providers, so you hit ceilings later than going direct.
  • Zero data retention. Prompts and completions pass through; we don't store them.
  • Multi-currency billing. USD and INR (for India-based teams) at launch.
  • Ready-made workflows. Pre-built prompt templates you can plug into any model.
  • Full observability. Every request, token, cost, error, and model usage tracked in real time. Per-key spending limits and usage controls.

Built by the founders of TagMango (YC W20) and AI Fiesta (1M+ users across India). We got tired of managing five different provider dashboards ourselves, so we built this.

Why this CLI exists

Any generic OpenAI-compatible chat CLI talks to Mesh. meshapi adds three things a generic CLI can't: (1) the gateway-only cost field shown after every turn, (2) /route controls that drive Mesh's gateway-side model selection, and (3) tool calling that resolves paths against the directory you launched from.

Roadmap

  • ✅ v0.3 — tool calling, ask/bypass/none permission modes, CWD-aware system prompt
  • v0.4 — repo-aware mode, diff apply, /cd to change working dir mid-session
  • v0.5 — npm i -g meshapi-code (Node port using ink + chalk), Homebrew tap, curl|sh installer at meshapi.ai/install.sh

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meshapi_code-0.3.2.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

meshapi_code-0.3.2-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file meshapi_code-0.3.2.tar.gz.

File metadata

  • Download URL: meshapi_code-0.3.2.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for meshapi_code-0.3.2.tar.gz
Algorithm Hash digest
SHA256 e199c7d9a837f2dbee499a12c8bebae962b2b95070910d5be90e39b452a887f7
MD5 62f9aafa1e403fcaee5b0bd3daaaaade
BLAKE2b-256 bbfb784359c96d54ba3c19beea2855f98013584f1819b30ae128e4e0640e2320

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshapi_code-0.3.2.tar.gz:

Publisher: publish.yml on aifiesta/meshapi-code

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file meshapi_code-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: meshapi_code-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for meshapi_code-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 29faed6f793fe62333a2ca845f24aa5c40fcd0e2e1ba81e8848b489afa89b1a7
MD5 adbb12a84cd8fc20cc5f72c3bb7351b9
BLAKE2b-256 4e8ce5f852a0a4faff156ae02daf743add87a3f40700329391df16ac34d9b495

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshapi_code-0.3.2-py3-none-any.whl:

Publisher: publish.yml on aifiesta/meshapi-code

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page