muapi-cli 0.2.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. muapi_cli-0.2.5/.claude/settings.local.json +24 -0
  2. muapi_cli-0.2.5/.github/workflows/publish-langchain.yml +50 -0
  3. muapi_cli-0.2.5/.github/workflows/publish-npm.yml +32 -0
  4. muapi_cli-0.2.5/.github/workflows/publish-pypi.yml +37 -0
  5. muapi_cli-0.2.5/.github/workflows/release.yml +180 -0
  6. muapi_cli-0.2.5/.gitignore +15 -0
  7. muapi_cli-0.2.5/PKG-INFO +337 -0
  8. muapi_cli-0.2.5/README.md +319 -0
  9. muapi_cli-0.2.5/cli_entry.py +9 -0
  10. muapi_cli-0.2.5/integrations/langchain/README.md +122 -0
  11. muapi_cli-0.2.5/integrations/langchain/docs/providers-muapi.mdx +194 -0
  12. muapi_cli-0.2.5/integrations/langchain/examples/deep_agents_demo.py +117 -0
  13. muapi_cli-0.2.5/integrations/langchain/muapi_langchain/__init__.py +48 -0
  14. muapi_cli-0.2.5/integrations/langchain/muapi_langchain/_client.py +131 -0
  15. muapi_cli-0.2.5/integrations/langchain/muapi_langchain/_registry.py +174 -0
  16. muapi_cli-0.2.5/integrations/langchain/muapi_langchain/callbacks.py +134 -0
  17. muapi_cli-0.2.5/integrations/langchain/muapi_langchain/data/models.json +3138 -0
  18. muapi_cli-0.2.5/integrations/langchain/muapi_langchain/data/skills.json +1999 -0
  19. muapi_cli-0.2.5/integrations/langchain/muapi_langchain/loader.py +101 -0
  20. muapi_cli-0.2.5/integrations/langchain/muapi_langchain/tools.py +229 -0
  21. muapi_cli-0.2.5/integrations/langchain/pyproject.toml +35 -0
  22. muapi_cli-0.2.5/integrations/langchain/scripts/refresh_registry.py +176 -0
  23. muapi_cli-0.2.5/muapi/__init__.py +1 -0
  24. muapi_cli-0.2.5/muapi/client.py +121 -0
  25. muapi_cli-0.2.5/muapi/commands/__init__.py +0 -0
  26. muapi_cli-0.2.5/muapi/commands/account.py +89 -0
  27. muapi_cli-0.2.5/muapi/commands/audio.py +139 -0
  28. muapi_cli-0.2.5/muapi/commands/auth.py +193 -0
  29. muapi_cli-0.2.5/muapi/commands/config_cmd.py +80 -0
  30. muapi_cli-0.2.5/muapi/commands/docs.py +81 -0
  31. muapi_cli-0.2.5/muapi/commands/edit.py +134 -0
  32. muapi_cli-0.2.5/muapi/commands/enhance.py +157 -0
  33. muapi_cli-0.2.5/muapi/commands/image.py +297 -0
  34. muapi_cli-0.2.5/muapi/commands/keys.py +115 -0
  35. muapi_cli-0.2.5/muapi/commands/mcp_server.py +905 -0
  36. muapi_cli-0.2.5/muapi/commands/models.py +79 -0
  37. muapi_cli-0.2.5/muapi/commands/predict.py +43 -0
  38. muapi_cli-0.2.5/muapi/commands/run.py +173 -0
  39. muapi_cli-0.2.5/muapi/commands/upload.py +31 -0
  40. muapi_cli-0.2.5/muapi/commands/video.py +318 -0
  41. muapi_cli-0.2.5/muapi/commands/workflow.py +746 -0
  42. muapi_cli-0.2.5/muapi/config.py +110 -0
  43. muapi_cli-0.2.5/muapi/dynamic_help.py +144 -0
  44. muapi_cli-0.2.5/muapi/exitcodes.py +14 -0
  45. muapi_cli-0.2.5/muapi/main.py +98 -0
  46. muapi_cli-0.2.5/muapi/schema_introspect.py +175 -0
  47. muapi_cli-0.2.5/muapi/utils.py +202 -0
  48. muapi_cli-0.2.5/npm/README.md +246 -0
  49. muapi_cli-0.2.5/npm/bin/muapi +34 -0
  50. muapi_cli-0.2.5/npm/package.json +34 -0
  51. muapi_cli-0.2.5/npm/scripts/install.js +74 -0
  52. muapi_cli-0.2.5/pyproject.toml +27 -0
@@ -0,0 +1,24 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(gh issue *)",
5
+ "Bash(curl -sI \"https://github.com/Anil-matcha/muapiapp/releases/download/v0.2.3/muapi-linux-x86_64\")",
6
+ "Bash(curl -sI \"https://github.com/SamurAIGPT/muapi-cli/releases/download/v0.2.3/muapi-linux-x86_64\")",
7
+ "Bash(gh release *)",
8
+ "Bash(npm view *)",
9
+ "Bash(git -C /Users/anilchandranaidumatcha/Downloads/mu_workflow/muapi-cli status)",
10
+ "Bash(git -C /Users/anilchandranaidumatcha/Downloads/mu_workflow/muapi-cli remote -v)",
11
+ "Bash(gh auth *)",
12
+ "Bash(npm whoami *)",
13
+ "Bash(git *)",
14
+ "Bash(tar -xzf muapi-cli-0.2.5.tgz)",
15
+ "Bash(tar -xzf muapi-cli-0.2.3.tgz)",
16
+ "Bash(tar -xzf muapi-cli-0.2.4.tgz)",
17
+ "Bash(rm -rf /tmp/muapi-022-check)",
18
+ "Bash(mkdir /tmp/muapi-022-check)",
19
+ "Read(//tmp/**)",
20
+ "Bash(npm pack *)",
21
+ "Bash(tar -xzf muapi-cli-0.2.2.tgz)"
22
+ ]
23
+ }
24
+ }
@@ -0,0 +1,50 @@
1
+ name: Publish muapi-langchain to PyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: "Version to publish (e.g. 0.1.0)"
8
+ required: true
9
+
10
+ jobs:
11
+ publish-langchain:
12
+ name: Publish muapi-langchain
13
+ runs-on: ubuntu-latest
14
+ defaults:
15
+ run:
16
+ working-directory: integrations/langchain
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.11"
24
+
25
+ - name: Set version
26
+ run: |
27
+ sed -i "s/^version = .*/version = \"${{ github.event.inputs.version }}\"/" pyproject.toml
28
+ echo "Publishing muapi-langchain ${{ github.event.inputs.version }}"
29
+
30
+ - name: Refresh registry data from schema_data.json
31
+ run: |
32
+ pip install hatch
33
+ # schema_data.json is checked in under server/data in this same repo snapshot
34
+ # fall back to fetching from the live OpenAPI if not present
35
+ SCHEMA="../../server/data/schema_data.json"
36
+ SKILLS="../../skills/library"
37
+ if [ -f "$SCHEMA" ]; then
38
+ python3 scripts/refresh_registry.py --schema "$SCHEMA" --skills "$SKILLS" 2>/dev/null || true
39
+ fi
40
+
41
+ - name: Build
42
+ run: hatch build
43
+
44
+ - name: Publish
45
+ run: |
46
+ pip install twine
47
+ twine upload dist/* --non-interactive
48
+ env:
49
+ TWINE_USERNAME: __token__
50
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
@@ -0,0 +1,32 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: "Version to publish (e.g. 0.2.4)"
8
+ required: true
9
+
10
+ jobs:
11
+ publish-npm:
12
+ name: Publish to npm
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: actions/setup-node@v4
18
+ with:
19
+ node-version: "20"
20
+ registry-url: "https://registry.npmjs.org"
21
+
22
+ - name: Set version
23
+ run: |
24
+ jq --arg v "${{ github.event.inputs.version }}" '.version = $v' npm/package.json > /tmp/pkg.json
25
+ mv /tmp/pkg.json npm/package.json
26
+ echo "Publishing npm version ${{ github.event.inputs.version }}"
27
+
28
+ - name: Publish
29
+ run: npm publish --access public
30
+ working-directory: npm
31
+ env:
32
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,37 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: "Version to publish (e.g. 0.2.5)"
8
+ required: true
9
+
10
+ jobs:
11
+ publish-pypi:
12
+ name: Publish to PyPI
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.11"
20
+
21
+ - name: Set version
22
+ run: |
23
+ sed -i "s/^version = .*/version = \"${{ github.event.inputs.version }}\"/" pyproject.toml
24
+ echo "Publishing PyPI version ${{ github.event.inputs.version }}"
25
+
26
+ - name: Build
27
+ run: |
28
+ pip install hatch
29
+ hatch build
30
+
31
+ - name: Publish
32
+ run: |
33
+ pip install twine
34
+ twine upload dist/* --non-interactive
35
+ env:
36
+ TWINE_USERNAME: __token__
37
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
@@ -0,0 +1,180 @@
1
+ name: Release CLI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ jobs:
12
+ build:
13
+ name: Build ${{ matrix.artifact }}
14
+ runs-on: ${{ matrix.os }}
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ include:
19
+ - os: macos-latest # Apple Silicon (arm64)
20
+ artifact: muapi-darwin-arm64
21
+
22
+ - os: ubuntu-22.04 # Linux x86_64
23
+ artifact: muapi-linux-x86_64
24
+
25
+ - os: ubuntu-24.04-arm # Linux arm64
26
+ artifact: muapi-linux-arm64
27
+
28
+ - os: windows-latest # Windows x86_64
29
+ artifact: muapi-windows-x86_64.exe
30
+
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+
34
+ - uses: actions/setup-python@v5
35
+ with:
36
+ python-version: "3.11"
37
+
38
+ - name: Install CLI + PyInstaller
39
+ run: |
40
+ pip install --upgrade pip
41
+ pip install .
42
+ pip install pyinstaller
43
+
44
+ - name: Build binary (Unix)
45
+ if: runner.os != 'Windows'
46
+ run: |
47
+ pyinstaller \
48
+ --onefile \
49
+ --name muapi \
50
+ --distpath ./dist \
51
+ cli_entry.py
52
+
53
+ - name: Build binary (Windows)
54
+ if: runner.os == 'Windows'
55
+ shell: pwsh
56
+ run: |
57
+ pyinstaller `
58
+ --onefile `
59
+ --name muapi `
60
+ --distpath ./dist `
61
+ cli_entry.py
62
+
63
+ - name: Rename artifact (Unix)
64
+ if: runner.os != 'Windows'
65
+ run: mv dist/muapi dist/${{ matrix.artifact }}
66
+
67
+ - name: Rename artifact (Windows)
68
+ if: runner.os == 'Windows'
69
+ shell: pwsh
70
+ run: Move-Item dist\muapi.exe dist\${{ matrix.artifact }}
71
+
72
+ - name: Upload artifact
73
+ uses: actions/upload-artifact@v4
74
+ with:
75
+ name: ${{ matrix.artifact }}
76
+ path: dist/${{ matrix.artifact }}
77
+ retention-days: 1
78
+
79
+ release:
80
+ name: Create GitHub Release
81
+ needs: build
82
+ runs-on: ubuntu-latest
83
+ steps:
84
+ - uses: actions/checkout@v4
85
+
86
+ - name: Download all artifacts
87
+ uses: actions/download-artifact@v4
88
+ with:
89
+ path: artifacts
90
+
91
+ - name: Flatten artifact directories
92
+ run: |
93
+ mkdir -p release_assets
94
+ find artifacts -type f -exec cp {} release_assets/ \;
95
+ chmod +x release_assets/muapi-darwin-* release_assets/muapi-linux-* 2>/dev/null || true
96
+ ls -lh release_assets/
97
+
98
+ - name: Create Release
99
+ uses: softprops/action-gh-release@v2
100
+ with:
101
+ tag_name: ${{ github.ref_name }}
102
+ name: muapi-cli ${{ github.ref_name }}
103
+ body: |
104
+ ## muapi-cli ${{ github.ref_name }}
105
+
106
+ ### Install via npm
107
+ ```bash
108
+ npm install -g muapi-cli
109
+ ```
110
+
111
+ ### Install via pip
112
+ ```bash
113
+ pip install muapi-cli
114
+ ```
115
+
116
+ ### Manual binary download
117
+ | Platform | Binary |
118
+ |---|---|
119
+ | macOS Apple Silicon | `muapi-darwin-arm64` |
120
+ | Linux x86_64 | `muapi-linux-x86_64` |
121
+ | Linux ARM64 | `muapi-linux-arm64` |
122
+ | Windows x86_64 | `muapi-windows-x86_64.exe` |
123
+ draft: false
124
+ prerelease: false
125
+ files: release_assets/*
126
+
127
+ publish-npm:
128
+ name: Publish to npm
129
+ needs: build
130
+ runs-on: ubuntu-latest
131
+ steps:
132
+ - uses: actions/checkout@v4
133
+
134
+ - uses: actions/setup-node@v4
135
+ with:
136
+ node-version: "20"
137
+ registry-url: "https://registry.npmjs.org"
138
+
139
+ - name: Set version from tag
140
+ run: |
141
+ VERSION="${GITHUB_REF_NAME#v}"
142
+ jq --arg v "$VERSION" '.version = $v' npm/package.json > /tmp/pkg.json
143
+ mv /tmp/pkg.json npm/package.json
144
+ echo "Publishing npm version $VERSION"
145
+
146
+ - name: Publish
147
+ run: npm publish --access public
148
+ working-directory: npm
149
+ env:
150
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
151
+
152
+ publish-pypi:
153
+ name: Publish to PyPI
154
+ needs: build
155
+ runs-on: ubuntu-latest
156
+ steps:
157
+ - uses: actions/checkout@v4
158
+
159
+ - uses: actions/setup-python@v5
160
+ with:
161
+ python-version: "3.11"
162
+
163
+ - name: Set version from tag
164
+ run: |
165
+ VERSION="${GITHUB_REF_NAME#v}"
166
+ sed -i "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
167
+ echo "Publishing PyPI version $VERSION"
168
+
169
+ - name: Build
170
+ run: |
171
+ pip install hatch
172
+ hatch build
173
+
174
+ - name: Publish
175
+ run: |
176
+ pip install twine
177
+ twine upload dist/* --non-interactive
178
+ env:
179
+ TWINE_USERNAME: __token__
180
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
@@ -0,0 +1,15 @@
1
+ dist/
2
+ build/
3
+ __pycache__/
4
+ *.spec
5
+ *.pyc
6
+ *.pyo
7
+ *.egg-info/
8
+ .eggs/
9
+ *.tgz
10
+ npm/bin/muapi-darwin-arm64
11
+ npm/bin/muapi-darwin-x86_64
12
+ npm/bin/muapi-linux-x86_64
13
+ npm/bin/muapi-linux-arm64
14
+ npm/bin/muapi-windows-x86_64.exe
15
+ .DS_Store
@@ -0,0 +1,337 @@
1
+ Metadata-Version: 2.4
2
+ Name: muapi-cli
3
+ Version: 0.2.5
4
+ Summary: Official CLI for muapi.ai — generative media at your fingertips
5
+ License: MIT
6
+ Requires-Python: >=3.9
7
+ Requires-Dist: httpx>=0.27.0
8
+ Requires-Dist: keyring>=24.0.0
9
+ Requires-Dist: rich>=13.0.0
10
+ Requires-Dist: typer>=0.12.0
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest; extra == 'dev'
13
+ Requires-Dist: pytest-asyncio; extra == 'dev'
14
+ Requires-Dist: respx; extra == 'dev'
15
+ Provides-Extra: release
16
+ Requires-Dist: pyinstaller>=6.0; extra == 'release'
17
+ Description-Content-Type: text/markdown
18
+
19
+ # muapi CLI
20
+
21
+ Official command-line interface for [muapi.ai](https://muapi.ai) — generate images, videos, and audio directly from your terminal.
22
+
23
+ **Agent-first design** — every command works for both humans (colored output, tables) and AI agents (`--output-json`, `--jq` filtering, semantic exit codes, MCP server mode).
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ # npm (recommended — no Python required)
29
+ npm install -g muapi-cli
30
+
31
+ # pip
32
+ pip install muapi-cli
33
+
34
+ # or run without installing
35
+ npx muapi-cli --help
36
+ ```
37
+
38
+ ## Quick Start
39
+
40
+ ```bash
41
+ # New user? Create an account
42
+ muapi auth register --email you@example.com --password "..."
43
+ muapi auth verify --email you@example.com --otp 123456
44
+ muapi auth login --email you@example.com --password "..."
45
+
46
+ # Or paste an existing API key
47
+ muapi auth configure --api-key "YOUR_KEY"
48
+
49
+ # Generate — pick a curated verb…
50
+ muapi image generate "a cyberpunk city at night" --model flux-dev
51
+ muapi video generate "a dog running on a beach" --model kling-master
52
+ muapi audio create "upbeat lo-fi hip hop for studying"
53
+
54
+ # …or run any model by endpoint name (schema-driven, covers the whole catalog)
55
+ muapi run flux-dev-image -p "a cyberpunk city at night"
56
+ muapi run seedance-2-text-to-video -p "drone shot over snowy peaks" -i duration=5
57
+ muapi run <model> -h # introspects the live OpenAPI schema
58
+
59
+ # Check balance
60
+ muapi account balance
61
+
62
+ # Wait for an existing job
63
+ muapi predict wait <request_id>
64
+ ```
65
+
66
+ ## Commands
67
+
68
+ ### `muapi auth`
69
+ | Command | Description |
70
+ |---------|-------------|
71
+ | `muapi auth register --email x --password y` | Create a new account (sends OTP) |
72
+ | `muapi auth verify --email x --otp 123456` | Verify email after registration |
73
+ | `muapi auth login --email x --password y` | Log in and save API key automatically |
74
+ | `muapi auth forgot-password --email x` | Send password reset OTP |
75
+ | `muapi auth reset-password --email x --otp y --password z` | Reset password |
76
+ | `muapi auth configure` | Manually save an API key |
77
+ | `muapi auth whoami` | Show current API key (masked) |
78
+ | `muapi auth logout` | Remove stored API key |
79
+
80
+ ### `muapi account`
81
+ | Command | Description |
82
+ |---------|-------------|
83
+ | `muapi account balance` | Show current credit balance |
84
+ | `muapi account topup --amount 20` | Add credits via Stripe checkout |
85
+
86
+ ### `muapi keys`
87
+ | Command | Description |
88
+ |---------|-------------|
89
+ | `muapi keys list` | List all API keys on your account |
90
+ | `muapi keys create --name label` | Create a new API key (shown once) |
91
+ | `muapi keys delete <id>` | Delete an API key by ID |
92
+
93
+ ### `muapi image`
94
+ | Command | Description |
95
+ |---------|-------------|
96
+ | `muapi image generate <prompt>` | Text-to-image generation |
97
+ | `muapi image edit <prompt> --image <url>` | Image-to-image editing |
98
+ | `muapi image models` | List available models |
99
+
100
+ **Models:** `flux-dev`, `flux-schnell`, `flux-kontext-dev/pro/max`, `hidream-fast/dev/full`, `wan2.1`, `reve`, `gpt4o`, `midjourney`, `seedream`, `qwen`
101
+
102
+ ### `muapi video`
103
+ | Command | Description |
104
+ |---------|-------------|
105
+ | `muapi video generate <prompt>` | Text-to-video generation |
106
+ | `muapi video from-image <prompt> --image <url>` | Image-to-video animation |
107
+ | `muapi video models` | List available models |
108
+
109
+ **Models:** `veo3`, `veo3-fast`, `kling-master`, `kling-std`, `kling-pro`, `wan2.1/2.2`, `seedance-pro/lite`, `hunyuan`, `runway`, `pixverse`, `vidu`, `minimax-std/pro`
110
+
111
+ ### `muapi audio`
112
+ | Command | Description |
113
+ |---------|-------------|
114
+ | `muapi audio create <prompt>` | Create music with Suno |
115
+ | `muapi audio remix <song-id>` | Remix an existing Suno song |
116
+ | `muapi audio extend <song-id>` | Extend a Suno song |
117
+ | `muapi audio from-text <prompt>` | Generate audio with MMAudio |
118
+ | `muapi audio from-video <video-url>` | Add AI audio to a video |
119
+
120
+ ### `muapi enhance`
121
+ | Command | Description |
122
+ |---------|-------------|
123
+ | `muapi enhance upscale <url>` | AI image upscaling |
124
+ | `muapi enhance bg-remove <url>` | Remove background |
125
+ | `muapi enhance face-swap --source <url> --target <url>` | Face swap image/video |
126
+ | `muapi enhance skin <url>` | Skin enhancement |
127
+ | `muapi enhance colorize <url>` | Colorize B&W photo |
128
+ | `muapi enhance ghibli <url>` | Ghibli anime style |
129
+ | `muapi enhance anime <url>` | Anime style conversion |
130
+ | `muapi enhance extend <url>` | Outpaint/extend image |
131
+ | `muapi enhance product-shot <url>` | Professional product photo |
132
+ | `muapi enhance erase <url> --mask <url>` | Object removal |
133
+
134
+ ### `muapi edit`
135
+ | Command | Description |
136
+ |---------|-------------|
137
+ | `muapi edit effects --video <url> --effect <name>` | AI video/image effects |
138
+ | `muapi edit lipsync --video <url> --audio <url>` | Lip sync to audio |
139
+ | `muapi edit dance --image <url> --video <url>` | Make person dance |
140
+ | `muapi edit dress --image <url>` | Change clothing |
141
+ | `muapi edit clipping <video-url>` | AI highlight extraction |
142
+
143
+ ### `muapi run` — generic, schema-driven runner
144
+
145
+ Reaches **any** model in the muapi.ai catalog by endpoint name, even ones not covered by the curated `image / video / audio / enhance / edit` verbs. The input schema is fetched from the live OpenAPI spec, so `muapi run <model> -h` always reflects the real, current parameters.
146
+
147
+ | Command | Description |
148
+ |---------|-------------|
149
+ | `muapi run <model> -h` | Print model-specific inputs from the live OpenAPI schema |
150
+ | `muapi run <model> -p "..."` | Run with a prompt |
151
+ | `muapi run <model> -p "..." -i k=v -i k=v` | Pass arbitrary inputs (JSON-parsed when valid) |
152
+ | `muapi run <model> --input-file inputs.json` | Inputs from a JSON file |
153
+ | `muapi run <model> ... --dry-run` | Show the request body without sending |
154
+
155
+ `<model>` accepts either a real endpoint slug (`flux-dev-image`, `nano-banana-2`, `seedance-2-text-to-video`) or a short alias from the curated tables (`flux-dev`, `seedream`, `kling-master`).
156
+
157
+ **Merge order for inputs** (later wins): `--input-file` → `-i k=v` → `-p prompt`.
158
+
159
+ ```bash
160
+ # Discover a model's real inputs
161
+ muapi run nano-banana-2 -h
162
+
163
+ # Run it
164
+ muapi run nano-banana-2 -p "a logo for a coffee shop" -i num_images=2 --download ./out
165
+
166
+ # Pipe-safe JSON
167
+ muapi run flux-dev-image -p "..." --output-json --jq '.outputs[0]'
168
+ ```
169
+
170
+ ### `muapi predict`
171
+ | Command | Description |
172
+ |---------|-------------|
173
+ | `muapi predict result <id>` | Fetch current status (no polling) |
174
+ | `muapi predict wait <id>` | Wait until complete |
175
+
176
+ ### `muapi upload`
177
+ | Command | Description |
178
+ |---------|-------------|
179
+ | `muapi upload file <path>` | Upload a local file → get hosted URL |
180
+
181
+ ### `muapi models`
182
+ | Command | Description |
183
+ |---------|-------------|
184
+ | `muapi models list` | List all models |
185
+ | `muapi models list --category video` | Filter by category |
186
+
187
+ ### `muapi config`
188
+ | Command | Description |
189
+ |---------|-------------|
190
+ | `muapi config set <key> <value>` | Set a persistent default |
191
+ | `muapi config get <key>` | Read a config value |
192
+ | `muapi config list` | Show all config |
193
+
194
+ **Useful keys:** `output` (json/human), `model.image`, `model.video`, `no_color` (true/false)
195
+
196
+ ### `muapi docs`
197
+ | Command | Description |
198
+ |---------|-------------|
199
+ | `muapi docs openapi` | Fetch the full OpenAPI spec |
200
+ | `muapi docs open` | Open Swagger UI in browser |
201
+
202
+ ### `muapi mcp`
203
+ | Command | Description |
204
+ |---------|-------------|
205
+ | `muapi mcp serve` | Start MCP server (stdio) for AI agents |
206
+
207
+ ## Global Options
208
+
209
+ | Flag | Description |
210
+ |------|-------------|
211
+ | `--wait / --no-wait` | Poll until done (default: `--wait`) |
212
+ | `--output-json` / `-j` | Print raw JSON response |
213
+ | `--jq <expr>` | Filter JSON output (e.g. `'.outputs[0]'`) |
214
+ | `--download <dir>` / `-d` | Auto-download outputs to directory |
215
+ | `--no-color` | Disable colored output |
216
+
217
+ ## Environment Variables
218
+
219
+ | Variable | Description |
220
+ |----------|-------------|
221
+ | `MUAPI_API_KEY` | API key (overrides keychain/config) |
222
+ | `MUAPI_BASE_URL` | Override API base URL |
223
+ | `NO_COLOR` | Disable colored output |
224
+
225
+ ## Exit Codes
226
+
227
+ | Code | Meaning |
228
+ |------|---------|
229
+ | `0` | Success |
230
+ | `1` | General error |
231
+ | `3` | Authentication error |
232
+ | `4` | Rate limited |
233
+ | `5` | Not found |
234
+ | `6` | Billing error |
235
+ | `7` | Timeout |
236
+ | `8` | Validation error |
237
+
238
+ ## MCP Server
239
+
240
+ muapi supports two MCP transport modes. Both expose the same **19 tools**: image generate/edit, video generate/from-image, audio create/from-text, enhance (upscale/bg-remove/face-swap/ghibli), edit lipsync/clipping, predict result, upload file, keys list/create/delete, account balance/topup.
241
+
242
+ ### Option 1 — Hosted (Recommended, no CLI required)
243
+
244
+ The hosted MCP server at `https://api.muapi.ai/mcp` uses the standard Streamable HTTP transport. Any MCP client can connect with just your API key — no CLI install needed.
245
+
246
+ **Claude Code:**
247
+ ```bash
248
+ claude mcp add --transport http muapi \
249
+ https://api.muapi.ai/mcp \
250
+ --header "Authorization: Bearer YOUR_MUAPI_KEY"
251
+ ```
252
+
253
+ **Cursor** — add to `mcp.json` (`Cmd+Shift+P` → Open MCP settings):
254
+ ```json
255
+ {
256
+ "mcpServers": {
257
+ "muapi": {
258
+ "url": "https://api.muapi.ai/mcp",
259
+ "headers": { "Authorization": "Bearer YOUR_MUAPI_KEY" }
260
+ }
261
+ }
262
+ }
263
+ ```
264
+
265
+ **Windsurf** — open **Settings → MCP**:
266
+ ```json
267
+ {
268
+ "mcpServers": {
269
+ "muapi": {
270
+ "serverUrl": "https://api.muapi.ai/mcp",
271
+ "headers": { "Authorization": "Bearer YOUR_MUAPI_KEY" }
272
+ }
273
+ }
274
+ }
275
+ ```
276
+
277
+ ### Option 2 — stdio via CLI (Claude Desktop)
278
+
279
+ Run the CLI as a local stdio MCP server. Requires the CLI to be installed.
280
+
281
+ ```bash
282
+ muapi mcp serve
283
+ ```
284
+
285
+ **Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
286
+ ```json
287
+ {
288
+ "mcpServers": {
289
+ "muapi": {
290
+ "command": "muapi",
291
+ "args": ["mcp", "serve"],
292
+ "env": { "MUAPI_API_KEY": "your-key-here" }
293
+ }
294
+ }
295
+ }
296
+ ```
297
+
298
+ **Any stdio-compatible client** — use the `command` + `args` pattern above, substituting your client's config format.
299
+
300
+ > For more details on the self-hosted MCP server see [muapi-mcp-server](https://github.com/SamurAIGPT/muapi-mcp-server).
301
+
302
+ ## Agentic Pipeline Examples
303
+
304
+ ```bash
305
+ # Full onboarding without human intervention
306
+ muapi auth register --email agent@example.com --password "secret"
307
+ muapi auth verify --email agent@example.com --otp 123456
308
+ muapi auth login --email agent@example.com --password "secret"
309
+ muapi account balance --output-json
310
+ muapi account topup --amount 10 --output-json --no-open
311
+
312
+ # Submit async, capture request_id, poll when ready
313
+ REQUEST_ID=$(muapi video generate "a dog on a beach" \
314
+ --model kling-master --no-wait --output-json --jq '.request_id' | tr -d '"')
315
+ muapi predict wait "$REQUEST_ID" --download ./outputs
316
+
317
+ # Chain: upload → edit → download
318
+ URL=$(muapi upload file ./photo.jpg --output-json --jq '.url' | tr -d '"')
319
+ muapi image edit "make it look like a painting" --image "$URL" \
320
+ --model flux-kontext-pro --download ./outputs
321
+
322
+ # Rotate API keys programmatically
323
+ NEW_KEY=$(muapi keys create --name "ci-$(date +%Y%m%d)" --output-json --jq '.api_key' | tr -d '"')
324
+ OLD_ID=$(muapi keys list --output-json --jq '.[0].id')
325
+ muapi keys delete "$OLD_ID" --yes
326
+
327
+ # Discover available endpoints
328
+ muapi docs openapi --jq '.paths | keys[]'
329
+ ```
330
+
331
+ ## Shell Completions
332
+
333
+ ```bash
334
+ muapi --install-completion bash
335
+ muapi --install-completion zsh
336
+ muapi --install-completion fish
337
+ ```