melange-cli

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: Apache-2.0

README

melange-cli

melange — the public command-line interface for Melange, zetic.ai's on-device AI model deployment and benchmarking platform.

Designed agents-first: non-interactive safe, structured --json output, stable exit codes, and machine-actionable errors — with a pleasant TTY experience for humans.

Install

Installer script (macOS/Linux; requires cosign, verifies the release-workflow signature and checksum, then installs to /usr/local/bin or ~/.local/bin):

curl -fsSL https://raw.githubusercontent.com/zetic-ai/melange-cli/main/script/install.sh | sh

Go:

go install github.com/zetic-ai/melange-cli/cmd/melange@latest

Prebuilt binaries (darwin/linux/windows, amd64/arm64) with checksums and SBOMs are on the releases page.

Agent skills

An agent skill is available for driving melange from Claude Code, Codex, Cursor, and other compatible coding agents. Install it at user scope with the open Agent Skills installer:

# Install the skill (user scope recommended; select an agent when prompted)
npx skills add zetic-ai/melange-cli --skill melange-cli --global

# Or install non-interactively for Claude Code
npx skills add zetic-ai/melange-cli --skill melange-cli --agent claude-code --global --yes

# Update the installed skill after a melange-cli release
npx skills update melange-cli --global

Installing the melange binary does not install or update the agent skill. Restart your agent after installation so it can discover the skill.

Authentication

Create a Personal Access Token in Melange → Settings → Personal Access Tokens, then:

melange auth login            # paste token interactively
melange auth status           # verify who you are

Quick start

repo="$(melange repo create whisper-tiny --private --jq .full_name)"
melange model upload -R "$repo" model.onnx --input audio.bin --dry-run --json

upload_limit="$(melange usage quotas --jq '.model_uploads.limit // "unlimited"')" || exit $?
[ "$upload_limit" != "0" ] || { echo "Model uploads are unavailable for this account" >&2; exit 1; }
upload_json="$(melange model upload -R "$repo" model.onnx --input audio.bin --wait --json)" || exit $?
model_key="$(printf '%s\n' "$upload_json" | jq -er .model.key)" || exit $?

melange model status "$model_key" -R "$repo" --json
melange deploy guide "$model_key" -R "$repo" --language android-kotlin --mode auto
melange api /v1/me --jq .account.name    # any /v1 endpoint

Bucketed .pt2 uploads use repeatable --bucket INDEX:DIMxDIM... declarations. Inputs are grouped by bucket declaration order; preview the exact manifest with --dry-run --json before uploading.

For agents

  • Authenticate via env: export MELANGE_API_KEY=ztp_... (overrides stored credentials); verify with melange auth status --json.
  • Always use --json or --jq — never parse TTY tables. Plain --json preserves the API response bytes except for normalizing the terminator to exactly one trailing newline; waited upload/import commands instead compose {"model": ..., "status": ...}, and model download redacts signed artifact URLs. Data is on stdout; progress/diagnostics on stderr.
  • Billable model download commands keep a host/repository/model/target-bound authorization key in per-user application state and serialize concurrent processes. Output corrections, failed followers, and directory collisions retain the key; follow the reported directory/--force remediation without another charge.
  • Branch on stable exit codes: 0 ok, 1 failure (possibly transient), 2 usage error (fix the command), 4 auth, 130 interrupted (upload session preserved).
  • Load the Melange CLI skill at skills/melange-cli/SKILL.md, or the compact surface reference in llms.txt.
  • Built-in topics: melange help environment, melange help exit-codes, melange help formatting.
  • Get credential-safe SDK code with melange deploy options and melange deploy guide; guides use YOUR_PERSONAL_KEY and never interpolate the active PAT.

Documentation

Development

Requires Go (see go.mod) and make:

Target What it does
make build Build bin/melange with version ldflags
make test go test ./...
make lint golangci-lint run
make fmt gofmt -l -w .
make gen / make gen-check Regenerate / verify the OpenAPI client
make docs / make docs-check Regenerate / verify docs/reference
make snapshot Build a local unsigned GoReleaser snapshot

Releases are built and signed by GoReleaser via the release workflow on v* tags. make snapshot reproduces the build locally while skipping signing, which requires the tag-triggered GitHub Actions identity.

License

Apache-2.0

Directories

Path Synopsis
cmd
melange command
Command melange is the entry point for the melange CLI.
Command melange is the entry point for the melange CLI.
internal
api
Package api provides the HTTP client wrapper for the Melange public API: transport chain (auth, retry, debug), error-envelope decoding, and the hand-written calls that will later be replaced by a generated client.
Package api provides the HTTP client wrapper for the Melange public API: transport chain (auth, retry, debug), error-envelope decoding, and the hand-written calls that will later be replaced by a generated client.
api/gen
Package gen provides primitives to interact with the openapi HTTP API.
Package gen provides primitives to interact with the openapi HTTP API.
build
Package build provides version information set at build time via -ldflags.
Package build provides version information set at build time via -ldflags.
cmd/api
Package api implements `melange api`, the authenticated raw-request escape hatch: any /v1 endpoint is callable through the standard transport chain even when no dedicated command wraps it yet.
Package api implements `melange api`, the authenticated raw-request escape hatch: any /v1 endpoint is callable through the standard transport chain even when no dedicated command wraps it yet.
cmd/auth
Package auth implements the `melange auth` command family: login, logout, status, and token.
Package auth implements the `melange auth` command family: login, logout, status, and token.
cmd/deploy
Package deploy exposes deterministic SDK deployment guides from public-v1.
Package deploy exposes deterministic SDK deployment guides from public-v1.
cmd/library
Package library implements `melange library` — browsing the public model library: listing and filtering models, viewing a single model with its readme, and listing the providers.
Package library implements `melange library` — browsing the public model library: listing and filtering models, viewing a single model with its readme, and listing the providers.
cmd/model
Package model implements `melange model` — uploading models through the ingestion v2 protocol (manifest, resumable GCS uploads, verify/complete), tracking their conversion status, browsing models and their converted targets, and downloading target artifacts.
Package model implements `melange model` — uploading models through the ingestion v2 protocol (manifest, resumable GCS uploads, verify/complete), tracking their conversion status, browsing models and their converted targets, and downloading target artifacts.
cmd/repo
Package repo implements `melange repo` — commands for managing model repositories on the Melange platform.
Package repo implements `melange repo` — commands for managing model repositories on the Melange platform.
cmd/report
Package report implements `melange report` — reading a model's benchmark reports (general, LLM, package) as the dashboard-grade table on a terminal and as raw, one-record-per-line TSV for scripts.
Package report implements `melange report` — reading a model's benchmark reports (general, LLM, package) as the dashboard-grade table on a terminal and as raw, one-record-per-line TSV for scripts.
cmd/root
Package root wires the top-level `melange` cobra command.
Package root wires the top-level `melange` cobra command.
cmd/usage
Package usage implements `melange usage` — the current billing-period usage counters and, via `usage quotas`, those counters against the plan limits.
Package usage implements `melange usage` — the current billing-period usage counters and, via `usage quotas`, those counters against the plan limits.
cmd/version
Package version implements the `melange version` command.
Package version implements the `melange version` command.
cmdutil
Package cmdutil provides shared utilities for CLI commands: the Factory, error types, and exit-code mapping.
Package cmdutil provides shared utilities for CLI commands: the Factory, error types, and exit-code mapping.
config
Package config handles loading, saving, and resolving configuration values for the melange CLI.
Package config handles loading, saving, and resolving configuration values for the melange CLI.
downloadstate
Package downloadstate serializes and persists one logical, billable model download authorization.
Package downloadstate serializes and persists one logical, billable model download authorization.
httpmock
Package httpmock provides a minimal mock http.RoundTripper for tests, modeled on gh's pkg/httpmock (simplified).
Package httpmock provides a minimal mock http.RoundTripper for tests, modeled on gh's pkg/httpmock (simplified).
iostreams
Package iostreams provides the IOStreams abstraction used throughout the CLI.
Package iostreams provides the IOStreams abstraction used throughout the CLI.
keyring
Package keyring stores Melange credentials in the OS keychain via zalando/go-keyring.
Package keyring stores Melange credentials in the OS keychain via zalando/go-keyring.
tableprinter
Package tableprinter renders rows of fields either as a padded, truncated table for terminals or as stable tab-separated lines for machine consumers.
Package tableprinter renders rows of fields either as a padded, truncated table for terminals or as stable tab-separated lines for machine consumers.
text
Package text provides small formatting helpers shared by command output: rune-safe truncation, compact relative timestamps, and byte sizes.
Package text provides small formatting helpers shared by command output: rune-safe truncation, compact relative timestamps, and byte sizes.
upload
Package upload implements the client half of the Melange ingestion v2 protocol: manifest digesting, persisted upload-session state, and the GCS resumable upload protocol over v4 signed URLs.
Package upload implements the client half of the Melange ingestion v2 protocol: manifest digesting, persisted upload-session state, and the GCS resumable upload protocol over v4 signed URLs.
wait
Package wait provides a generic context-aware polling loop with exponential backoff, full jitter, and an overall timeout.
Package wait provides a generic context-aware polling loop with exponential backoff, full jitter, and an overall timeout.
tools
gendocs command
Command gendocs regenerates the Markdown CLI reference in docs/reference from the live cobra command tree.
Command gendocs regenerates the Markdown CLI reference in docs/reference from the live cobra command tree.
openapi30 command
Command openapi30 repairs and validates semantics that the pinned generic 3.1->3.0 converter does not preserve for oapi-codegen: nullable unions.
Command openapi30 repairs and validates semantics that the pinned generic 3.1->3.0 converter does not preserve for oapi-codegen: nullable unions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL