> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenlab.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Promptfoo

> 針對 TokenLab 模型執行 Promptfoo 評估

## 概覽

Promptfoo 可以透過其相容 OpenAI 的 chat 和 Responses 提供者來評估 TokenLab。

<Note>
  **類型**: 評估框架

  **主要路徑**: 相容 OpenAI 的 chat completions 和 Responses

  **支援信心**: 支援的路徑
</Note>

## 環境

```bash theme={null}
export TOKENLAB_API_KEY="sk-your-tokenlab-key"
```

## 設定範例

```yaml theme={null}
description: TokenLab 提供者範例

prompts:
  - 'Answer in one concise paragraph: {{question}}'

providers:
  - id: openai:chat:gpt-5.4-mini
    label: tokenlab-chat-gpt-5.4-mini
    config:
      apiBaseUrl: https://api.tokenlab.sh/v1
      apiKey: '{{env.TOKENLAB_API_KEY}}'
  - id: openai:responses:gpt-5.5
    label: tokenlab-responses-gpt-5.5
    config:
      apiBaseUrl: https://api.tokenlab.sh/v1
      apiKey: '{{env.TOKENLAB_API_KEY}}'

tests:
  - vars:
      question: What are two practical ways to evaluate an LLM gateway?
    assert:
      - type: contains-any
        value:
          - latency
          - reliability
          - cost
          - quality
```

## 執行

```bash theme={null}
promptfoo eval
```

若需廣泛的相容性，請使用 chat 提供者。若評估特別依賴 Responses 行為，請使用 Responses 提供者。
