Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Populating Secrets

PyRIT loads API credentials from environment variables or .env files. This page shows how to set up your .env file with credentials for your AI provider.

Creating Your .env File

  1. Create the PyRIT config directory and copy the example file:

mkdir -p ~/.pyrit
cp .env_example ~/.pyrit/.env
  1. Edit ~/.pyrit/.env and fill in the credentials for your provider:

OpenAI
Azure OpenAI
Ollama (Local)
Groq
OpenRouter
OPENAI_CHAT_ENDPOINT="https://api.openai.com/v1"
OPENAI_CHAT_KEY="sk-your-key-here"
OPENAI_CHAT_MODEL="gpt-4o"

Get your API key from platform.openai.com/api-keys.

What’s in .env_example?

The .env_example file in the repository root contains entries for all supported targets — OpenAI chat, responses, realtime, image, TTS, video, Azure ML, embeddings, content safety, and more. Most users only need the three OPENAI_CHAT_* variables above. Fill in additional sections only as you need them.

What’s Next?