Skip to main content
speak-mintlify uses environment variables for sensitive configuration like API keys and S3 credentials. This keeps secrets out of your config files and git history.

Setup

Create a .env file in your documentation directory:
touch .env
Add .env to your .gitignore to prevent committing secrets to version control.

Required Variables

Fish Audio API Key

.env
FISH_API_KEY=your_api_key
Required for: TTS audio generation Get your key: Sign up at Fish Audio and generate an API key from your dashboard.
The Fish API key is only required when running the generate command. The cleanup command doesn’t need it.

S3 Configuration

speak-mintlify uploads generated audio files to S3-compatible storage (AWS S3, Cloudflare R2, MinIO, etc.).
.env
# S3 Credentials (required)
S3_ACCESS_KEY_ID=your_access_key_id
S3_SECRET_ACCESS_KEY=your_secret_key

# S3 Config (required)
S3_BUCKET=your-bucket
S3_PUBLIC_URL=https://s3.example.com
S3_REGION=us-east-1
Required variables:
  • S3_ACCESS_KEY_ID - S3 access key for authentication
  • S3_SECRET_ACCESS_KEY - S3 secret key for authentication
  • S3_BUCKET - Name of your S3 bucket
  • S3_PUBLIC_URL - Public CDN URL for accessing uploaded files
  • S3_REGION - AWS region (default: us-east-1)

Custom S3 Endpoint (Optional)

For S3-compatible services like Cloudflare R2 or MinIO:
.env
S3_ENDPOINT=https://s3-endpoint.example.com
Use cases:
  • Cloudflare R2
  • MinIO
  • DigitalOcean Spaces
  • Any S3-compatible storage

Complete Example

.env
# Environment Variables for speak-mintlify

# Secrets (required)
FISH_API_KEY=your_api_key
S3_ACCESS_KEY_ID=your_access_key_id
S3_SECRET_ACCESS_KEY=your_secret_key

# S3 Config (required)
S3_BUCKET=your-bucket
S3_PUBLIC_URL=https://s3.example.com
S3_REGION=us-east-1
S3_ENDPOINT=https://s3-endpoint.example.com

# Configure voices in speaker-config.yaml

CLI Overrides

All environment variables can be overridden with CLI flags:
speak-mintlify generate \
  --api-key "your_key" \
  --s3-bucket "your-bucket" \
  --s3-access-key-id "your_access_key" \
  --s3-secret-access-key "your_secret" \
  --s3-public-url "https://cdn.example.com" \
  --s3-region "us-west-2" \
  --s3-endpoint "https://endpoint.example.com"
Use CLI flags for temporary overrides or CI/CD environments. Use .env for local development.

Configuration Priority

speak-mintlify resolves configuration in this order:
  1. CLI flags (highest priority)
  2. Environment variables
  3. speaker-config.yaml
  4. Defaults (lowest priority)

Advanced Options

S3 Path Prefix

Customize where audio files are stored in your S3 bucket:
# Default: audio/
speak-mintlify generate --s3-path-prefix "tts/"
This creates paths like: s3://your-bucket/tts/filename.mp3

Validation

speak-mintlify validates required configuration on startup. If any required variables are missing, you’ll see:
Error: Missing required configuration:
  - S3_BUCKET (--s3-bucket or env var)
  - S3_ACCESS_KEY_ID (--s3-access-key-id or env var)
  - S3_SECRET_ACCESS_KEY (--s3-secret-access-key or env var)
  - S3_PUBLIC_URL (--s3-public-url or env var)

Set these via CLI flags or environment variables.

Security Best Practices

1

Use .gitignore

Always add .env to your .gitignore file
2

Rotate keys regularly

Periodically rotate your API keys and S3 credentials
3

Use IAM policies

Limit S3 credentials to only the permissions needed (PutObject, GetObject, DeleteObject)
4

Use environment-specific configs

Keep separate .env.production and .env.staging files

Next Steps

Speaker Config

Configure voices and components

Getting Started

Start generating audio

Build docs developers (and LLMs) love