Environment Variables
Testy Claw reads configuration from environment variables. Use them to set API keys, override config values at runtime, and pass secrets to custom tools.
API keys
| Variable | Provider | Required |
|---|---|---|
| OPENAI_API_KEY | OpenAI | If using OpenAI models |
| ANTHROPIC_API_KEY | Anthropic | If using Claude models |
| MISTRAL_API_KEY | Mistral | If using Mistral models |
| GROQ_API_KEY | Groq | If using Groq models |
Config overrides
Any config option can be overridden with a CLAW_ prefixed env var. Underscores separate nested keys; camelCase is converted automatically.
| Variable | Config key | Example |
|---|---|---|
| CLAW_MODEL | model | CLAW_MODEL=claude-3-5-sonnet |
| CLAW_MAX_STEPS | maxSteps | CLAW_MAX_STEPS=5 |
| CLAW_TIMEOUT | timeout | CLAW_TIMEOUT=60000 |
| CLAW_VERBOSE | verbose | CLAW_VERBOSE=true |
| CLAW_LOG_DIR | logDir | CLAW_LOG_DIR=/tmp/claw |
Using a .env file
Testy Claw automatically loads a .env file in the current directory if one exists.
.env
OPENAI_API_KEY=sk-...
CLAW_MODEL=gpt-4o
CLAW_MAX_STEPS=15WarningAdd
.env to your .gitignore. Never commit API keys to source control.Passing secrets to custom tools
Access environment variables inside custom tool execute functions via process.env.
tools/my-tool.ts
execute: async ({ input }) => {
const token = process.env.MY_SERVICE_TOKEN;
if (!token) throw new Error("MY_SERVICE_TOKEN is not set");
// ...
}