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

VariableProviderRequired
OPENAI_API_KEYOpenAIIf using OpenAI models
ANTHROPIC_API_KEYAnthropicIf using Claude models
MISTRAL_API_KEYMistralIf using Mistral models
GROQ_API_KEYGroqIf 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.

VariableConfig keyExample
CLAW_MODELmodelCLAW_MODEL=claude-3-5-sonnet
CLAW_MAX_STEPSmaxStepsCLAW_MAX_STEPS=5
CLAW_TIMEOUTtimeoutCLAW_TIMEOUT=60000
CLAW_VERBOSEverboseCLAW_VERBOSE=true
CLAW_LOG_DIRlogDirCLAW_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=15
WarningAdd .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");
  // ...
}