Repository: promptfoo/promptfoo
Issue: Is there a way to execute requests from my local laptop on a self-hosted promptfoo server?

**Context**
Hi!

I currently share my query results with other developers by running the following command:

  `promptfoo eval -c promptfooconfig.yaml --share --env-file .env`

In my .env file, I store API keys that I don’t want to expose publicly. However, if I execute the request without including the keys from the file, the request fails because it’s running locally.

I also noticed that there is an authentication option using the command:

  `promptfoo --auth -h <server host>`

but this feature is available only for paid cloud subscriptions, not for self-hosted setups.

**My main question**
Is there a way to execute requests from my local computer while saving the history and responses on a self-hosted promptfoo server—without sharing API credentials with other developers? In other words, can I use environment variables for the credentials in a self-hosted configuration so that the execution history is saved remotely without exposing these sensitive keys?

Let me know if further clarification is needed.

**Configs:**

**.env**
```
HTTP_API_KEY=<key>

PROMPTFOO_REMOTE_API_BASE_URL=https://promptfoo.com
PROMPTFOO_REMOTE_APP_BASE_URL=https://promptfoo.com

PROMPTFOO_SELF_HOSTED=true
PROMPTFOO_DISABLE_TEMPLATE_ENV_VARS=false
PROMPTFOO_DISABLE_SHARE_EMAIL_REQUEST=true
```

**promptfooconfig.yaml**

```defaultTest: {}
description: Simple translation tests
prompts:
  - raw: 'Translate this to {{language}}: {{input}}'
    label: Translate to {{language}}
providers:
  - id: http:gpt-4o
    config:
      url: >-
        https://........
        Content-Type: application/json
        Api-Key: '{{env.HTTP_API_KEY}}'
      method: POST
      body:
        model: gpt-4o-2024-08-06
        temperature: 0.7
        top_p: 1
        'n': 1
        stream: false
        messages:
          - role: user
            content: '{{prompt}}'
  - id: http:gpt-o3-mini
    config:
      url: >-
        https://........
      headers:
        Content-Type: application/json
        Api-Key: '{{env.HTTP_API_KEY}}'
      method: POST
      body:
        model: o3-mini-2025-01-31
        'n': 1
        stream: false
        messages:
          - role: user
            content: '{{prompt}}'
scenarios: []
tests:
  - vars:
      language: Spanish
      input: Music
    assert:
      - type: contains
        value: Música
writeLatestResults: true

Hi LukashevichVitali! Yes, you can execute requests locally while storing results on your self-hosted server without exposing API keys.

To configure your CLI to point to your self-hosted instance:

```bash
export PROMPTFOO_REMOTE_API_BASE_URL=http://your-server:3000/
export PROMPTFOO_REMOTE_APP_BASE_URL=http://your-server:3000/
```

Then run evaluations locally and share results:

```bash
promptfoo eval --share
```

Your API keys stay secure on your laptop since you're using environment variables (`{{env.HTTP_API_KEY}}`) in your config. Only the evaluation results are uploaded to your server - the credentials are not transferred to the self hosted instance.

For more details, see our [self-hosting guide](https://promptfoo.dev/docs/configuration/self-hosting/) and [environment variables documentation](https://promptfoo.dev/docs/configuration/environment-variables/).

Closing the issue for now but let me know if you have any other questions. Thanks for using Promptfoo!

Hi @ladyofcode
thanks for your clear explanation!