---
url: https://docs.mochiexec.io/reference/ai-providers.md
description: >-
  Every AI provider Mochi supports, including the Mochi gateway, OpenAI,
  Anthropic, Gemini, Ollama, and custom endpoints, and the options to configure
  each.
---

# AI Providers

Set the active provider with:

```sh
mochi ai config set provider <provider> [flags]
```

| Provider | Where requests go | Needs |
|---|---|---|
| `mochi-gateway` (alias `managed`) | Mochi's managed gateway, metered against your license | A license |
| `openai` | OpenAI | Your API key |
| `anthropic` | Anthropic | Your API key |
| `gemini` | Google Gemini | Your API key |
| `ollama` | A local Ollama server. Nothing leaves your machine. | Ollama running locally |
| `custom` | Any compatible endpoint you point it at | `--base-url` |

## Options

| Flag | Effect |
|---|---|
| `--api-key` | Store this API key in the provider's vault |
| `--api-key-file` | Store the API key read from this file. Unlike `--api-key`, the key never appears in the process list or your shell history |
| `--secret-key` | Use a secret already in the vault instead of storing a new one |
| `--vault` | Vault to store or read the key from (defaults to the current vault) |
| `--model` | Model name to request |
| `--base-url` | Base URL for the provider's API |
| `--output` | `text` or `json` |

Keys live in a [vault](https://flowexec.io/guides/secrets), never in plain config.

## Checking and viewing

```sh
mochi ai config view   # what's configured
mochi ai config test   # a real round trip to the provider
```

## Models

With `mochi-gateway`, Mochi picks the model for each request, so there's nothing to set.

Every other provider needs `--model` the first time you set it up, using the model name
that provider expects (for Ollama, a model you've pulled). Run the same command with a new
`--model` to switch. `mochi ai config view` shows the model in use.
