> ## Documentation Index
> Fetch the complete documentation index at: https://aimp.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Publish

> Scaffold, validate, configure, and push a model project with the AIMP CLI.

# CLI publish

Use the CLI when you are a model provider. It keeps the publish workflow
repeatable and validates model project files before the platform build starts.

## Install and authenticate

```bash theme={null}
uv tool install ./packages/python/cli
ai login --gateway http://localhost:8080 --api-key "$AIMP_API_KEY"
ai auth --json
```

## Create a model project

```bash theme={null}
ai init demo-model --yes
cd demo-model
uv sync
```

The scaffold includes `main.py`, `schemas.py`, `playground.py`, `runtime/`,
`tests/`, `studio/article.mdx`, and `.aimp/` publish metadata.

## Validate and publish

```bash theme={null}
ai contract validate --json
ai publish --configure --json
ai push
```

`ai push` packages the source bundle and starts the platform publish flow. The
platform builds the runtime image and resolves immutable build outputs from the
succeeded job.

## Rules to keep

* Do not edit hidden publish state unless the CLI asks for it.
* Keep `runtime/Dockerfile` and `runtime/pyproject.toml` present.
* Use explicit flags and `--json` for automation.
* Keep the installed `ai` CLI and runtime package pins on the same release line.
* Reinstall the local CLI after changing CLI, SDK, or framework packages.
