---
title: "Configuration"
description: "Environment variables and defaults."
canonical_url: "https://ai-cli.dev/docs/configuration"
---
# Configuration

ai-cli uses environment variables for defaults and flags for each request. Image
and video commands also accept JSON files for SDK provider options, headers,
and structured media inputs. There is no global config file.

## Environment variables

#### `AI_GATEWAY_API_KEY`

Type: `string`

Vercel AI Gateway API key. Provides access to all supported models.

#### `AI_GATEWAY_BASE_URL`

Type: `string`

Gateway baseURL for image/video generation and model discovery. Override with `--base-url`.

#### `AI_GATEWAY_TEAM_ID_OR_SLUG`

Type: `string`

Gateway teamIdOrSlug for image/video and models. Override with `--team-id-or-slug`.

#### `OPENAI_API_KEY`

Type: `string`

Provider-specific key (or other provider keys like `ANTHROPIC_API_KEY`).

#### `AI_CLI_TEXT_MODEL`

Type: `string`

Default text model. Overrides `openai/gpt-5.5`.

#### `AI_CLI_IMAGE_MODEL`

Type: `string`

Default image model. Overrides `openai/gpt-image-2`.

#### `AI_CLI_VIDEO_MODEL`

Type: `string`

Default video model. Overrides `bytedance/seedance-2.0`.

#### `AI_CLI_SPEECH_MODEL`

Type: `string`

Default speech model. Overrides `openai/tts-1`.

#### `AI_CLI_TRANSCRIPTION_MODEL`

Type: `string`

Default transcription model. Overrides `openai/whisper-1`.

#### `AI_CLI_EVALUATION_MODEL`

Type: `string`

Default evaluation model for `decide`. Overrides `typesafe-ai/jev`.

#### `AI_CLI_OUTPUT_DIR`

Type: `path`

Default output directory for generated files.

#### `AI_CLI_PREVIEW`

Type: `0 | 1`

`1` forces inline preview on, `0` disables it.

#### `NO_COLOR`

Type: `any`

Disable ANSI color output.

#### `FORCE_COLOR`

Type: `any`

Force color output even when not a TTY.

## Precedence

- `-m` flag always takes priority over `AI_CLI_*_MODEL` env vars.
- `-o` flag always takes priority over `AI_CLI_OUTPUT_DIR`.
- `--no-preview` takes priority over `AI_CLI_PREVIEW`.

## Example shell profile

```bash
export AI_GATEWAY_API_KEY="gw_..."
export AI_CLI_TEXT_MODEL="anthropic/claude-sonnet-4"
export AI_CLI_IMAGE_MODEL="bfl/flux-2-pro"
export AI_CLI_SPEECH_MODEL="openai/tts-1"
export AI_CLI_OUTPUT_DIR="$HOME/ai-output"
```
