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

# Manage Model Gateway

The `model-gateway` command group activates AgentKit Model Gateway and manages model providers and consumers that access models through a unified gateway. The top-level alias is `mgw`.

<Warning>
  Model Gateway creates or uses cloud gateway resources and stores model provider API keys. Confirm the account, region, gateway mode, and key source before running these commands. Do not save real API keys in repositories, scripts, or shell history.
</Warning>

## model-gateway activate

Activate Model Gateway. If a Model Gateway already exists in the current region, the command returns the existing resource. If the resource is in a failed state, the command reports an error. After creating a gateway, the CLI waits until it becomes available.

| Flag / Argument | Description | Default |
| - | - | - |
| `--apig-gateway-id <id>` | Use a specific API Gateway instance; omit it for shared mode. | — |
| `-r, --region <region>` | Cloud region. | Resolved from provider or environment |
| `--json` | Output raw JSON. | `false` |

```bash lines theme={null}
agentkit model-gateway activate --region cn-beijing

agentkit mgw activate --apig-gateway-id <apig-gateway-id> --json
```

## model-gateway provider create

Create a model provider. A provider contains the upstream base URL, protocol, one or more API keys, and the model names exposed through the gateway.

| Flag / Argument | Description | Default |
| - | - | - |
| `<name>` | Provider name (required). | — |
| `--base-url <url>` | Upstream model service base URL (required). | — |
| `--api-key <key>` | Upstream model service API key; repeatable. | — |
| `--model <name>` | Upstream model name; repeatable. | — |
| `--protocol <protocol>` | Upstream protocol: `openai` or `anthropic`. | `openai` |
| `-r, --region <region>` | Cloud region. | Auto-sense |

```bash lines theme={null}
agentkit model-gateway provider create ark \
  --base-url https://ark.cn-beijing.volces.com/api/v3 \
  --api-key ${MODEL_PROVIDER_API_KEY} \
  --model deepseek-v4-flash-ga-260731
```

## model-gateway provider list

List model providers under the current Model Gateway.

| Flag / Argument | Description | Default |
| - | - | - |
| `-r, --region <region>` | Cloud region. | Auto-sense |
| `--json` | Output raw JSON. | `false` |

```bash lines theme={null}
agentkit model-gateway provider list
```

## model-gateway provider show

Show details for a model provider.

| Flag / Argument | Description | Default |
| - | - | - |
| `<name>` | Provider name (required). | — |
| `-r, --region <region>` | Cloud region. | Auto-sense |
| `--json` | Output raw JSON. | `false` |

```bash lines theme={null}
agentkit model-gateway provider show ark
```

## model-gateway provider update

Update a model provider. Pass at least one of `--base-url`, `--api-key`, `--model`, or `--protocol`. `--api-key` replaces the provider API key list; `--model` replaces the model list.

| Flag / Argument | Description | Default |
| - | - | - |
| `<name>` | Provider name (required). | — |
| `--base-url <url>` | New upstream model service base URL. | — |
| `--api-key <key>` | Replacement upstream API key; repeatable. | — |
| `--model <name>` | Replacement model name; repeatable. | — |
| `--protocol <protocol>` | New protocol: `openai` or `anthropic`. | — |
| `-r, --region <region>` | Cloud region. | Auto-sense |

```bash lines theme={null}
agentkit model-gateway provider update ark \
  --model deepseek-v4-flash-ga-260731 \
  --model doubao-seed-2-0-pro-260215
```

## model-gateway provider delete

Delete a model provider.

<Warning>
  Deleting a provider affects consumers that depend on that provider or its model authorizations. Confirm the name and authorization scope first; use `--yes` to skip confirmation only in automation.
</Warning>

| Flag / Argument | Description | Default |
| - | - | - |
| `<name>` | Provider name (required). | — |
| `-r, --region <region>` | Cloud region. | Auto-sense |
| `-y, --yes` | Skip the confirmation prompt. | `false` |

```bash lines theme={null}
agentkit model-gateway provider delete ark --yes
```

## model-gateway consumer create

Create a consumer. A consumer receives an API key for accessing Model Gateway, and can have model authorization scope and token rate limits.

| Flag / Argument | Description | Default |
| - | - | - |
| `<name>` | Consumer name (required). | — |
| `--allow-model <provider[/model]>` | Provider or provider/model that the consumer may access; repeatable. | — |
| `--tpm <tokens>` | Tokens per minute; must be a positive integer. | — |
| `--tpd <tokens>` | Tokens per day; must be a positive integer. | — |
| `-r, --region <region>` | Cloud region. | Auto-sense |

```bash lines theme={null}
agentkit model-gateway consumer create app-server \
  --allow-model ark/deepseek-v4-flash-ga-260731 \
  --tpm 60000 \
  --tpd 1000000
```

`--allow-model` can be only a provider name, which allows all models under that provider, or `<provider>/<model>`, which allows only the named model.

## model-gateway consumer list

List consumers under the current Model Gateway.

| Flag / Argument | Description | Default |
| - | - | - |
| `-r, --region <region>` | Cloud region. | Auto-sense |
| `--json` | Output raw JSON. | `false` |

```bash lines theme={null}
agentkit model-gateway consumer list
```

## model-gateway consumer show

Show consumer details, including API keys, authorization scope, and rate limits.

| Flag / Argument | Description | Default |
| - | - | - |
| `<name>` | Consumer name (required). | — |
| `-r, --region <region>` | Cloud region. | Auto-sense |
| `--json` | Output raw JSON. | `false` |

```bash lines theme={null}
agentkit model-gateway consumer show app-server
```

## model-gateway consumer update

Update a consumer's model authorization scope or token rate limits. Pass at least one of `--allow-model`, `--tpm`, or `--tpd`. `--allow-model` replaces the existing authorization scope.

| Flag / Argument | Description | Default |
| - | - | - |
| `<name>` | Consumer name (required). | — |
| `--allow-model <provider[/model]>` | Replacement access scope; repeatable. | — |
| `--tpm <tokens>` | Replacement tokens-per-minute limit; must be a positive integer. | — |
| `--tpd <tokens>` | Replacement tokens-per-day limit; must be a positive integer. | — |
| `-r, --region <region>` | Cloud region. | Auto-sense |

```bash lines theme={null}
agentkit model-gateway consumer update app-server \
  --allow-model ark \
  --tpm 120000
```

## model-gateway consumer delete

Delete a consumer.

<Warning>
  Deleting a consumer invalidates its API keys. Confirm that the application has already switched away from this consumer or stopped using it.
</Warning>

| Flag / Argument | Description | Default |
| - | - | - |
| `<name>` | Consumer name (required). | — |
| `-r, --region <region>` | Cloud region. | Auto-sense |
| `-y, --yes` | Skip the confirmation prompt. | `false` |

```bash lines theme={null}
agentkit model-gateway consumer delete app-server --yes
```

## model-gateway show-example

Generate a calling example from a provider and consumer. The command reads the provider access URL, protocol, accessible model, and consumer API key, then prints the selected example type.

| Flag / Argument | Description | Default |
| - | - | - |
| `--model-provider <name>` | Model provider name (required). | — |
| `--consumer <name>` | Consumer name (required). | — |
| `--example <type>` | Example type: `curl`, `openai`, `anthropic`, or `agentkit`. | `curl` |
| `-r, --region <region>` | Cloud region. | Auto-sense |

```bash lines theme={null}
agentkit model-gateway show-example \
  --model-provider ark \
  --consumer app-server \
  --example openai

agentkit mgw show-example \
  --model-provider ark \
  --consumer app-server \
  --example agentkit
```

The `agentkit` example prints model environment variables that can be applied to the current project, such as `MODEL_AGENT_NAME`, `MODEL_AGENT_API_BASE`, and `MODEL_AGENT_API_KEY`.
