> ## 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 provider example

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 提供程序。
