haveles
10/24/2025, 2:39 PMmichaelmichaelmichael
10/26/2025, 4:44 PM${OPENROUTER_API_KEY} in your config, but Promptfoo uses Nunjucks templating, not shell syntax. That means it's literally sending the string "${OPENROUTER_API_KEY}" as your API key instead of the actual value.
Just remove the apiKey line entirely from your config. OpenRouter automatically picks up the OPENROUTER_API_KEY environment variable, so you don't need to specify it:
yaml
providers:
- id: openrouter:anthropic/claude-3.5-sonnet
config:
temperature: 0.0
max_tokens: 2000
# That's it - no apiKey needed!
If you really want to specify it explicitly, use Nunjucks syntax instead:
yaml
apiKey: "{{ env.OPENROUTER_API_KEY }}"
This is probably why your A/B testing config worked - it likely wasn't specifying the apiKey at all and just letting it auto-detect from the environment.
Give that a try and let me know if it works!haveles
10/28/2025, 7:51 PM