https://promptfoo.dev/ logo
How To Configure A Test For Custom Target/API
# ❓|questions
g
Any sample of the configuration for testing a custom API that needs Bearer token / API key?
i
have a look at https://www.promptfoo.dev/docs/providers/http/ you can add an Authorization header like so:
Copy code
yaml
providers:
  - id: https
    config:
      url: 'https://example.com/generate'
      method: 'POST'
      headers:
        'Content-Type': 'application/json'
        'Authorization': 'Bearer abc123'
      body:
        myPrompt: '{{prompt}}'
      transformResponse: 'json.output' # Extract the "output" field from the response