跳轉到主要內容

概覽

Promptfoo 可以透過其相容 OpenAI 的 chat 和 Responses 提供者來評估 TokenLab。
類型: 評估框架主要路徑: 相容 OpenAI 的 chat completions 和 Responses支援信心: 支援的路徑

環境

export TOKENLAB_API_KEY="sk-your-tokenlab-key"

設定範例

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

執行

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