Skip to content
zkasuranPublic

About

gmi: a community-built command line for GMI Cloud. Built in public during the @GMI_Cloud takeover, Oct 2026.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

gmi: the community command line for GMI Cloud

Tests License: Apache 2.0 Python 3.10 or newer Works with any model GMI Cloud serves Tests run on Linux, macOS and Windows

The terminal app for GMI Cloud.
Chat with any model, generate images, video and audio, run code in cloud sandboxes
and drive the whole GMI API from one command: gmi.

Install | Quick start | Session | Scripting | Media | Sandboxes | API | Agents | Status | What's next

A recorded gmi session: type slash to see every command, open the model picker, ask a question and watch the formatted answer stream in

A real session against the live API. The model spent about 18 seconds reasoning before it answered; the recording skips most of that wait.


What you can do

Chat with any model Every text model GMI serves, read live from the API. Switch with /model mid-conversation and keep the context.
See the price first Context size and USD price per million tokens for every model. Media shows its price before it runs and asks before anything costs $0.25 or more.
Create media Images, video, speech and music from the same session with /image, /video and /audio. Files land in ./gmi-output/.
Run code in the cloud GMI AgentBox sandboxes: run a command in a fresh Linux box, copy files in and out, snapshot a configured box, pause and resume.
Use the whole GMI API A command for each of 108 operations across IAM, IDC, Sandbox and Cluster Engine, with dry runs that mask secrets.
Give agents GMI tools gmi mcp serve exposes GMI to any MCP client. Read-only by default; writes and deletes need explicit flags.
Script everything --json on every command, piped input, clean exit codes and nothing interactive when you ask for it.
Keep keys safe Hidden input, checked against the API before saving, stored with mode 600 and never printed.

Install

Install in one line

Linux and macOS:

curl -fsSL https://raw.githubusercontent.com/zkasuran/gmi/main/install.sh | sh

Include the optional MCP SDK for gmi mcp serve:

curl -fsSL https://raw.githubusercontent.com/zkasuran/gmi/main/install.sh | sh -s -- --mcp

The installer requires Python 3.10 or newer and chooses uv, pipx or Python pip in that order. On Debian and Ubuntu systems without uv or pipx where Python is externally managed it creates a private virtual environment at ~/.local/share/gmi/venv and links gmi from ~/.local/bin. It installs the v1.0.2 tag by default. Set GMI_REF on the shell running the script to choose another ref; GMI_INSTALL_MCP=1 also enables MCP. Use sh install.sh --help from a checkout for usage.

Install with pip, pipx or uv

Requires Python 3.10 or newer.

pip install git+https://github.com/zkasuran/gmi

Prefer an isolated tool install? Either of these puts gmi on your path:

pipx install git+https://github.com/zkasuran/gmi
uv tool install git+https://github.com/zkasuran/gmi

Update later with pip install --upgrade git+https://github.com/zkasuran/gmi. You also need an API key: create one in the GMI Cloud console under API Keys (see the quickstart).

Install on Windows

install.sh is for Linux and macOS. On Windows install with pip, pipx or uv from PowerShell; Python 3.10 or newer is required:

pip install git+https://github.com/zkasuran/gmi
gmi --version

If PowerShell cannot find gmi afterwards, the Scripts directory of your Python install is not on PATH; python -m gmi.cli --version works without it. uv tool install puts gmi.exe in %USERPROFILE%\.local\bin; run uv tool update-shell once to add that directory to PATH. The config file lives at %USERPROFILE%\.config\gmi\config.toml. Set $env:GMI_API_KEY instead of export in PowerShell.

Quick start

gmi

That opens the session. If you are not logged in yet, the banner says so; type /login, paste your key (the input is hidden). gmi checks it against the API before saving it. From a plain shell the same thing is:

gmi auth login          # hidden prompt, verified, saved to ~/.config/gmi/config.toml
gmi auth status         # API reachable. Active key: gmi_...wxyz

Already have the key in your environment? Skip login: export GMI_API_KEY=... and run gmi.

The interactive session

Type / and a menu lists every command. Tab completes. Replies stream in as formatted Markdown with highlighted code blocks. Every reply ends with a dim status line: the model, the token counts the API reported and the time it took.

The gmi banner and the slash command menu listing help, model, models, system, clear, save, load, usage, login and exit
Type / and every command is listed, with a description.

The model picker filtered by 6.1 showing openai/gpt-6.1-sol with its context size and price
/model opens the picker. Type to filter; context size and price are right there.

A streamed answer with highlighted inline terms, a code block and the status line showing model, tokens in and out plus elapsed time
Answers render as Markdown. The dim line under each one shows the model, the API's token counts and the time.

Slash commands

Command What it does
/help List the commands.
/model Open a searchable picker over the live model list. /model <id> switches directly. An unknown id is rejected with a "did you mean" hint while your current model stays active. The conversation is kept across switches.
/models Table of models with context size and price per 1M tokens. Add filter text to narrow it: /models sol.
/image, /video, /audio Generate media from a prompt. See Media.
/media Pick the default model for image, video or audio.
/system Show the system prompt. /system <text> sets it and /system clear removes it.
/clear Start a new conversation.
/save Save the conversation to ~/.config/gmi/sessions/<name>.json. /save <name> picks the name, otherwise it is a timestamp. Asks before replacing a saved session.
/load /load <name> loads a saved conversation. With no name it lists them so you can pick one.
/usage Token totals for this session, as reported by the API.
/login Verify and save an API key with hidden input.
/exit Quit. Ctrl+D works too.

A mistyped command helps you out: /modle answers "Unknown command /modle. Did you mean /model?".

Keys

Key Action
Enter Send the message.
Alt+Enter New line. Also Shift+Enter in terminals that report it. Ending a line with \ then Enter works anywhere.
Ctrl+C Stop the reply in progress. Text that already arrived stays on screen, but that turn is not added to the conversation, so just ask again.
Ctrl+D Quit.
Up/Down Input history, kept in ~/.config/gmi/history (mode 600).
Tab Complete a slash command.

In the model picker: type to filter (case-insensitive substring, best match first), arrows to move, Enter to pick, Esc to cancel. The active model is marked with *.

Scripting and automation

Everything below runs without a session. Add --json to any command for machine-readable output with no prompts. Expect a non-zero exit code plus a one-line message on stderr when something fails.

# Pipe anything in; it is appended to your prompt
gmi chat "Turn these notes into a short checklist" < notes.txt
# - [ ] Review docs
# - [ ] Tag the release
# - [ ] Announce it

# A commit message from a diff
git diff --staged \
  | gmi chat "Write a commit message for this diff" \
      --system "Reply with one line only."
# Update greeting to say "hello, world"

# The full API response, for jq
gmi chat "Name three HTTP status codes, comma separated, nothing else" --json \
  | jq -r '.choices[0].message.content, .usage.total_tokens'
# 200, 404, 500
# 40

# Find the cheap models: prompt price under $0.30 per million tokens
gmi models --json | jq -r '.data[] | select((.pricing.prompt|tonumber) < 0.0000003) | .id'

gmi chat with no prompt on a terminal opens the session. With no terminal and no prompt it tells you so instead of hanging.

Command reference

gmi chat [PROMPT]: send a prompt, with standard input appended when piped.

Option Meaning
--model TEXT Model id. Default: openai/gpt-6.1-sol, or GMI_MODEL, or your saved default.
--system TEXT System instruction.
--max-tokens N Maximum output tokens.
--no-stream Wait for the complete response instead of streaming.
--no-wrap Do not wrap streamed output to the terminal width.
--no-retry Do not retry HTTP 429 responses.
--json Print the full API response as JSON.
--api-key TEXT Use this key (prefer GMI_API_KEY, which stays out of shell history).

gmi models: list models with context length and USD price per million tokens. --search TEXT filters ids and names, --json prints the raw records. The current default is marked with *.

gmi auth

  • gmi auth login verifies a key before saving it. --stdin reads it from a pipe: printf %s "$KEY" | gmi auth login --stdin.
  • gmi auth status shows the masked key and checks that the API is reachable.
  • gmi auth logout removes the saved key. --yes skips the confirmation. A key in GMI_API_KEY stays active.

gmi config get|set KEY [VALUE]: read or save a default. Keys: default_model (chat), default_image_model, default_video_model, default_audio_model and sandbox_idc.

Global options (before any command): --version, --api-key TEXT, --json, --help.

Models

gmi reads the model list live from GMI (GET /v1/models), so new models appear without an update. A session fetches it once and reuses it.

The model for a request is chosen in this order, first match wins:

  1. --model (or /model inside a session)
  2. the GMI_MODEL environment variable
  3. your saved default: gmi config set default_model <id>
  4. the built-in default, openai/gpt-6.1-sol
gmi models --search sol
#   ID                  CONTEXT    PROMPT $/1M  COMPLETION $/1M
#   openai/gpt-5.6-sol  1,050,000  5.00         30.00
# * openai/gpt-6.1-sol  1,050,000  2.00         10.00
#   openai/gpt-6-sol    1,050,000  2.00         10.00

Media

Generate images, video and audio with any model GMI serves, from the session or from scripts. The catalogue is read live from GMI, so new models show up without an update.

A recorded gmi session: the slash command menu, then /image with the price shown first and the saved file, then /video with live polling until the file is saved

A real session. The waiting is shortened; the prices, model names and polling times are the real ones.

In the session:

Command What it does
/image <prompt> Generate an image. Add key=value pairs for model parameters.
/video <prompt> Generate a video, for example /video a paper boat on a pond duration=5.
/audio <prompt> Generate speech or music.
/media Pick the default model for image, video or audio from a searchable list.

From a shell:

gmi media models --type image          # what you can use right now, with prices
gmi image "a small red lighthouse on a cliff at dawn, flat illustration"
gmi video "a paper boat drifting on a calm pond, soft morning light" --param duration=5
gmi audio "gmi works"
gmi media list --limit 5               # your recent requests
gmi media get REQUEST_ID --out ./gmi-output   # fetch a result you stopped waiting for

What a run looks like (real output):

gmi> /image a small red lighthouse on a cliff at dawn, flat illustration
Price: $0.0350 per image
Model: seedream-5.0-lite
Saved gmi-output/20261021-005332-seedream-5.0-lite-1.jpg (178194 bytes)
gmi> /video a paper boat drifting on a calm pond, soft morning light duration=5
Price: $0.1100 for 5 seconds ($0.022 / second)
seedance-1-0-pro-fast-251015 dispatched (0s)
seedance-1-0-pro-fast-251015 processing (2s)
seedance-1-0-pro-fast-251015 success (27s)

The image gmi made from that prompt: a red lighthouse on a dark cliff at a pink and gold dawn
The image from that run: 2048 x 2048, made by seedream-5.0-lite for $0.035.

How models are chosen

  • Only usable models are listed. A model must be active, visible and have workers. A model with no workers would wait in GMI's queue forever, so gmi hides it.
  • Defaults. For each type the default is the cheapest listed model that needs only text input. Pin your own with /media or gmi config set default_image_model <id> (also default_video_model and default_audio_model). --model overrides it for one call.
  • Parameters. --param key=value (or key=value after the prompt in the session) sets any parameter in the model's own schema. Values are checked. An enum with a wrong value lists the valid options.

Prices and files

  • The price is shown before every call, in dollars with the billing unit. It becomes an estimate when the duration or text length is known.
  • A call estimated at $0.25 or more asks Continue? [y/N]. Scripts pass --yes.
  • Results are saved to ./gmi-output/ (or --out DIR) as timestamp-model-n.ext. Downloads need no key.
  • Press Ctrl+C while waiting and gmi prints the request id. Nothing is cancelled on GMI's side. gmi media get brings the file back later.

Limits

  • Inputs that are images, audio or video must be http(s) URLs. Local file paths are not supported yet.
  • Some models allow only a few requests per day. gmi tells you when the limit resets and does not retry.
  • A provider can be briefly unavailable. gmi retries twice, then says so and leaves the choice of another model to you.

Sandboxes

Run code in GMI AgentBox sandboxes: isolated Linux machines billed per second. Use a compute-scope key in GMI_COMPUTE_API_KEY or GMI_SANDBOX_API_KEY; the inference key cannot authorize sandbox operations.

Run one command in a fresh sandbox. gmi builds or reuses a template, runs the command and always removes the sandbox afterwards:

$ gmi sandbox run --image ubuntu:24.04 --yes -- sh -c "echo hello-from-sandbox; uname -sr; id -un"
hello-from-sandbox
Linux 6.1.158+
root

Or keep a sandbox and work with it:

gmi sandbox create TEMPLATE_ID --timeout 300 --wait --yes
gmi sandbox exec SANDBOX_ID -- sh -c 'apt-get update && apt-get install -y jq'
gmi sandbox put SANDBOX_ID ./input.txt /home/user/input.txt
gmi sandbox get-file SANDBOX_ID /home/user/input.txt --out ./output.txt
gmi sandbox timeout SANDBOX_ID 900 --yes
gmi sandbox kill SANDBOX_ID --yes

Save a configured sandbox and start new ones from it, or pause one without using its runtime:

gmi sandbox snapshots create SANDBOX_ID --name with-jq --wait --yes
gmi sandbox create --snapshot SNAPSHOT_ID --wait --yes
gmi sandbox pause SANDBOX_ID --wait --yes
gmi sandbox resume SANDBOX_ID --wait --yes
  • Billable actions show catalog prices when GMI provides them and ask for confirmation. Scripts pass --yes.
  • exec returns the remote command's exit code. Sandbox access tokens are masked in all output.
  • Choose a data centre with --idc-name, GMI_SANDBOX_IDC_NAME or gmi config set sandbox_idc NAME.
  • Templates: gmi sandbox templates create|list|get|logs|delete. Catalog: gmi sandbox products.

The AgentBox guide has every command with example output, credentials, billing behaviour and what has been verified live.

The GMI API

gmi api has a command for each operation in GMI's published OpenAPI specs: 108 operations across IAM, IDC, Sandbox and Cluster Engine. Path parameters become arguments and every request can be previewed without sending it.

gmi api list --service cluster                  # what is available
gmi api idc idcs list-idcs --json               # call an operation
gmi api sandbox get-sandbox SOME_ID --dry-run   # preview the request, secrets masked
gmi api check --markdown docs/API-COVERAGE.md   # probe safe reads with your keys
Service Credential
IAM and IDC The normal inference key from GMI_API_KEY or saved settings.
Sandbox and Cluster A compute key from GMI_COMPUTE_API_KEY or GMI_SANDBOX_API_KEY.

Every non-GET asks for confirmation and DELETE says This deletes data.. Use --yes for an intentional noninteractive call. --dry-run works without a key and sends nothing. Binary responses require --out FILE. Results for this account are in docs/API-COVERAGE.md.

Agents and MCP

gmi mcp serve gives any MCP-capable agent the GMI API, models, chat and sandboxes as tools over local stdio. It is read-only unless you allow more.

pip install "gmi[mcp] @ git+https://github.com/zkasuran/gmi"
gmi mcp tools                                # preview the tools, no key or SDK needed
gmi mcp config --client codex                # print the setup for your client
gmi mcp config --client claude-code
gmi mcp config --client cursor
Class Enabled by What an agent can do
Read Default Call generated GET tools, list models, chat and read small sandbox files. Chat costs tokens.
Write --allow-write Call generated POST, PUT and PATCH tools or run sandbox commands and write files. May create billable compute.
Destructive --allow-destructive Call generated DELETE tools. Also enables writes.

There are 39 tools by default, 89 with writes and 102 with destructive operations. Tools outside the selected class are not listed at all. Keys never appear in configuration snippets or tool results. The server tells agents that tool output is data, never instructions.

gmi serve: HTTP chat service

gmi serve runs a small HTTP service: GET /health and POST /chat with {"message":"Hello","model":"optional/model"}. Set GMI_SERVE_TOKEN to require a bearer token on every route except /health. Without it the service is open to anyone who can reach it, with calls billed to the configured account.

The container image is published at ghcr.io/zkasuran/gmi and runs locally with Docker. It is not on the AgentBox marketplace yet. See the service guide.

Configuration and privacy

Path Contents
~/.config/gmi/config.toml Your saved API key and defaults. Mode 600.
~/.config/gmi/history Session input history. Mode 600.
~/.config/gmi/sessions/*.json Conversations saved with /save.
Variable Meaning
GMI_API_KEY Inference key. Overrides the saved one.
GMI_COMPUTE_API_KEY or GMI_SANDBOX_API_KEY Compute-scope key for sandboxes and Cluster Engine.
GMI_MODEL Default chat model for this shell.
GMI_SANDBOX_IDC_NAME Default sandbox data centre.

The key is resolved as --api-key, then GMI_API_KEY, then the saved config.

  • Your key is never printed. Anywhere it appears it is masked to gmi_... plus four characters.
  • Login is checked first. A key the API rejects is never saved, so an existing saved key is not overwritten by a bad one.
  • GMI only. gmi talks to api.gmi-serving.com and console.gmicloud.ai, to your own sandboxes and to the media file links GMI returns. There is no telemetry, analytics or update check.
  • Sessions are plain JSON on your disk. Delete them whenever you like.
Troubleshooting
You see What it means
not logged in, run /login (banner) No key found. Run /login, gmi auth login, or set GMI_API_KEY.
API key rejected (401) The key is wrong or revoked. Run gmi auth login with a valid one.
Model <id> is overloaded on GMI right now. Wait a minute and retry. GMI answered 429 "overloaded". gmi already waited as GMI asked (its Retry-After, at most 30 seconds, up to twice). Retry shortly, or pass --no-retry in scripts.
Rate limit reached (429) You hit a quota. Wait, or check your account limits.
request stays queued gmi only lists models that have workers. Choose an active model with gmi media models.
Upstream provider temporarily unavailable The provider is temporarily unavailable. gmi retries twice, then try another model.
Daily limit reached This model has reached its UTC daily limit. Try another model or wait for the reset time.
Model <id> was not found on GMI. Check the id with gmi models --search <text>.
Sandbox access rejected Sandbox and Cluster need a compute-scope key, not the inference key.
A long pause after you send a message Reasoning models can think for a while before the first visible word. The spinner says "Waiting for reply". Ctrl+C stops it.
Interactive sessions require a terminal You ran gmi with no terminal attached. Give it a prompt or use --json.

More fixes, including sandbox and MCP errors: docs/TROUBLESHOOTING.md.

Status

gmi is at version 1.0.2. Documented commands follow semantic versioning; areas marked as not verified are excluded from that promise. Every pull request runs the offline test suite on Linux, macOS and Windows.

Area Verified live Not verified yet
Session, chat, models and login Yes, on Linux Interactive session on macOS and Windows
Image, video and audio Yes, with real generations
Generated API commands Safe read operations Cluster write operations
Sandboxes Run, create, exec, file transfer, get, timeout and kill Snapshots, pause and resume
MCP server One agent client calling GMI tools Tool calls from other clients
gmi serve Built and run locally, image published AgentBox marketplace deployment
Windows Install and the offline suite Interactive session and live calls

What's next

gmi is growing from a CLI into a full terminal agent. It will read files, edit code and run commands with your approval, on your machine or inside a GMI sandbox, using any GMI model. The full plan is in docs/ROADMAP.md.

Release Focus
1.1 Foundations: CI on three systems, PyPI, headless gmi -p, session resume, cost in dollars, gmi doctor
1.2 Project context: AGENTS.md memory, @file mentions, !shell, /compact, model capability probes
1.3 The agent: file and shell tools, permission modes, diffs, checkpoints and /rewind
1.4 Sandbox agent: gmi --sandbox runs tools in AgentBox, cloud tools behind gates
1.5 Extensibility: MCP client, custom slash commands, hooks, subagents, gmi mcp login
1.6 Polish and reach: status line, themes, Windows installer, Homebrew, binaries, docs site

Each item moves to the changelog when it ships.

Development

git clone https://github.com/zkasuran/gmi && cd gmi
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[test]"

pytest -m "not live and not live_media"  # offline tests, no key needed
GMI_API_KEY=... pytest    # everything, including live tests against the real API

Live tests make tiny real requests (a few tokens each) and drive the interactive app with pexpect and pyte. GMI_MEDIA_BASE_URL=... pytest points media tests at a fake server instead of the live media API.

src/gmi/
  cli.py            command line entry point and the scripting commands
  api.py            HTTP client: streaming, retries, error mapping
  config.py         key, model and config file handling
  media.py          media catalogue, requests, pricing and downloads
  sandbox.py        AgentBox sandboxes, templates and snapshots
  api_commands.py   commands generated from api_manifest.json
  mcp_server.py     the MCP server and its permission gates
  serve.py          the HTTP chat service
  app/
    session.py      the interactive loop, banner and key bindings
    commands.py     the slash command registry (new commands plug in here)
    picker.py       the searchable model picker
    renderer.py     Markdown rendering and the status line
    state.py        conversation state, usage totals, save and load
specs/              GMI's OpenAPI specs, the source of the generated commands
tests/              offline and live tests
docs/               guides and images

Contributing

Issues and pull requests are welcome. See CONTRIBUTING.md for setup, tests, generated API commands and the pull request checklist. Report a problem with the bug report form or propose an improvement with the feature request form. Keep keys and tokens out of reports. See CHANGELOG.md for release notes.

gmi began as a six-day public build with GMI Cloud in October 2026. The story, the official posts and what was verified each day are in docs/BUILT-IN-PUBLIC.md.

License

Apache-2.0. Built by @zkasuran.

GMI Clouder
The author is a GMI Cloud Clouder (community ambassador). gmi is a community project. It is not an official GMI Cloud product and is not affiliated with or endorsed by GMI Cloud. GMI Cloud is a trademark of its owner.

About

gmi: a community-built command line for GMI Cloud. Built in public during the @GMI_Cloud takeover, Oct 2026.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages