Configure AI Coding Tools with ModelGo CLI
ModelGo provides two official command-line tools. Choose the task you want to complete and run the corresponding command.
Connect AI coding clients
Configure Claude Code, Codex, and other common clients with one command.
npx @model-go/config -r globalUse the official CLI
Pair it with official ModelGo Skills so an AI agent can operate ModelGo directly.
npx @model-go/cli@latest installConnect AI coding clients @model-go/config
Guided setup
Follow the terminal prompts to enter your API key, select clients and models, review the configuration, and verify connectivity after the changes are written.
npx @model-go/config -r globalOne-command setup (non-interactive, suitable for automation)
npx @model-go/config -k mgk_your_api_key -r global --only claude,codexPass a comma-separated list of client IDs to --only. Passing -k switches the tool to non-interactive mode: it no longer prompts for the key, clients, or models, and skips the confirmation. Without --only it configures Claude Code and Codex, without --models it writes every available chat model, and without -r it uses the international site (global), so always include -r global. Every selected client must already be installed; otherwise the tool lists the missing clients and exits without writing any configuration.
Supported clients
Client IDs for --only: claude, codex, openclaw, hermes, factory, cc-switch, copilot, nanobot, crush, opencode, oh-my-pi, codebuddy, dsh.
What happens next
| Step | Prompt |
|---|---|
01 | Enter your ModelGo API key. |
02 | Select one or more clients, or choose “Configure all.” The tool checks that the selected clients are installed. |
03 | Select the models to write into the clients (multiple allowed). |
04 | Review the site, Base URL, masked API key, and selected clients. |
05 | Confirm the changes, write the client configuration, and verify connectivity with GET /v1/models. A failed check only prints a warning; the configuration is still written. |
Common options:
| Option | Description |
|---|---|
-k, --api-key | ModelGo API key; omit it to enter the key at the prompt. |
-r, --region | Site: domestic (China site) or global (international site). |
--only | Comma-separated client IDs, or all. |
--models | Comma-separated model names, or all. Interactive runs show a picker when omitted; non-interactive runs write every available model. |
--skip-verify | Skip the connectivity check after writing. |
Common usage
# Configure several clients at once
npx @model-go/config -k mgk_your_api_key -r global --only claude,codex,crush
# Configure all 13 clients (enter the key and pick models at the prompts)
npx @model-go/config -r global --only all
# Write only specific models
npx @model-go/config -k mgk_your_api_key -r global --only claude,codex --models your-model-1,your-model-2--only allis the same as choosing “Configure all” in the picker. If any installation check fails, the tool exits without writing anything: Claude Code, Codex, and OpenClaw are checked for their commands, DeepSeek Harness for~/.dsh/settings.yaml, and the other clients are not checked, so make sure they are installed. Listing only the clients installed on your machine is usually safer.- Models are selected once with
--modelsand shared by every client in the run. Model names not in the catalog are reported and skipped; if none match, the tool falls back to writing all models. Each client's default model is picked automatically from the selected models, preferring the newest GPT-5 models. - Claude Code, Copilot CLI, and Crush write environment variables to your shell profile. When the run finishes, the terminal prints a
sourcecommand to apply them to the current terminal. - For the exact files each client writes, see the “One-command setup” note in its setup guide.
Setup succeeded: the terminal reports that configuration is complete and the connectivity check passes, then shows how to start the selected client.
Let an AI agent operate ModelGo @model-go/cli
Install the official CLI and ModelGo Skills when you want an agent such as Claude Code or Codex to use ModelGo directly. The installer sets up the CLI, distributes Skills, selects the site, and optionally signs you in.
npx @model-go/cli@latest installWhat happens next
| Step | Prompt |
|---|---|
01 | Confirm installation of @model-go/cli when npm asks. |
02 | Choose Simplified Chinese or English. The rest of the installation prompts will use your selected language. |
03 | Install or upgrade the ModelGo CLI and install ModelGo Skills. |
04 | Select the environment for this site (https://api.modelgo.ai). |
05 | Choose whether to sign in through the browser now, or skip and run modelgo auth login later. |
Using the CLI after installation
After installation, restart your AI agent or open a new session. ModelGo Skills lets the agent call the ModelGo CLI directly to perform queries and operations, so you can ask in natural language, for example:
- “Which models does ModelGo currently support?”
- “What is my current ModelGo account balance?”
To use the CLI yourself, run modelgo in your terminal to see every available command and option:
modelgoThe most common commands are grouped by task:
| Task | Common commands | What they do |
|---|---|---|
| Authentication | modelgo auth login, modelgo auth status, modelgo auth logout | Sign in to ModelGo, inspect the current authentication state, or clear local credentials. |
| Environments | modelgo env list, modelgo env current, modelgo env use <name> | List environments, show the active environment, or switch sites. Use env add and env remove to manage custom environments. |
| Workspaces | modelgo tenant list, modelgo tenant use <slug> | List the workspaces available to your account and use a workspace slug or ID to select the workspace for subsequent CLI commands. |
| Account and usage | modelgo balance, modelgo permissions, modelgo logs | View balances and transactions, account permissions, call logs, and usage statistics. |
| Model calls | modelgo models, modelgo chat, modelgo embeddings, modelgo call | List available models, make chat or embedding requests, or call any /v1/* model endpoint directly. |
| Keys and payments | modelgo key, modelgo pay | Manage the model API key stored for the active environment or configure x402 pay-per-call payments. |
| CLI maintenance | modelgo update, modelgo --version, modelgo --help | Update the CLI, print its version, or reopen the complete help output. |
Run modelgo <command> --help to inspect the options for a specific command. For balance, permissions, and logs, you can also use the global --tenant <slug\|id> option to target a workspace for that command only.
Continue exploring
- First API Call: make your first model call.
- Authentication: learn how to use and protect your API key.