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.3.tar.gz (19.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.3-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: meshapi_code-0.3.3.tar.gz
  • Upload date:
  • Size: 19.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.3.tar.gz
Algorithm Hash digest
SHA256 e9d773e7ff00783713806f82c918d9fc35ad6e5965e8830887b335e8fe7a62fe
MD5 6bca3e75b46177378eb349d3c5def48f
BLAKE2b-256 b87803eabe1a26397c8ee46f3fe58a2d79c276943adc9ab21c6c52ee1c3ce047

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshapi_code-0.3.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: meshapi_code-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 21.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4604ac7a061e6c0fea544d613b5544acafd17dc1681ff98e5095279032e0d4b0
MD5 09be540fcde976673d7f8246fcdeb33c
BLAKE2b-256 bbcd5cd26d074944e0bb94ab8b00bc78e9be72ca0e9a526add1f6f015ea10ee7

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshapi_code-0.3.3-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