---
url: https://docs.mochiexec.io/reference/cli/mochi_ai_config_set_provider.md
description: Set up an AI provider and make it the active one
---

# mochi ai config set provider

Set up an AI provider and make it the active one

## Synopsis

Sets up an AI provider and makes it the active one. A provider that needs a key asks for it at a masked prompt unless you pass --api-key-file or --secret-key; the key is stored in a vault.

```shell
mochi ai config set provider <mochi-gateway|openai|anthropic|gemini|ollama|custom> [flags]
```

## Examples

```shell
mochi ai config set provider anthropic
mochi ai config set provider ollama --model llama3.1
mochi ai config set provider mochi-gateway
```

## Options

| Flag | Type | Description |
|------|------|-------------|
| `--api-key` | `string` | API key to store (prefer the prompt or --api-key-file) |
| `--api-key-file` | `string` | Read the API key from this file |
| `--base-url` | `string` | Base URL for the provider's API |
| `-h, --help` |  | help for provider |
| `--model` | `string` | Model to use |
| `-o, --output` | `string` | Output format: text or json (default "text") |
| `--secret-key` | `string` | Use a secret already in the vault as the API key |
| `--vault` | `string` | Vault that holds the API key (defaults to the current vault) |

## Options inherited from parent commands

| Flag | Type | Description |
|------|------|-------------|
| `-L, --log-level` | `string` | Log verbosity level (debug, info, fatal) (default "info") |
| `--sync` |  | Sync flow cache and workspaces |

## See also

* [mochi ai config set](mochi_ai_config_set.md) — Change AI settings
