← 返回
未分类 中文

API Benchmark

Benchmark token generation speed across multiple LLM API providers. Measures TTFT (Time To First Token), tokens-per-second throughput, and total generation t...
跨多个LLM API提供商的令牌生成速度基准测试,测量TTFT(首令牌时间)、每秒令牌吞吐量及总生成时间。
polarjunction polarjunction 来源
未分类 clawhub v1.0.2 1 版本 99666.7 Key: 无需
★ 2
Stars
📥 259
下载
💾 0
安装
1
版本
#latest

概述

API Token Speed Benchmark

This skill benchmarks token generation speed across multiple LLM API providers.

When to use this skill

Use this skill when you need to:

  • Compare token generation speed across different API providers
  • Measure latency and throughput of LLM models
  • Verify API connectivity and authentication
  • Test new API endpoints or models

How to run benchmarks

List available targets

python3 main.py --targets

Run benchmark on a specific target

python3 main.py run --label <target-label>

Run benchmark on all targets

python3 main.py run --all

Run preflight check (verify API connectivity)

python3 main.py check --label <target-label>
python3 main.py check --all

Options

  • -l, --label: Specific target label to benchmark
  • -a, --all: Run on all available targets
  • -r, --repeat: Number of runs per prompt level (default: 1)
  • -c, --category: Run specific prompt category (can repeat: -c short -c medium). Options: short, medium, long
  • -q, --quiet: Quiet mode - suppress progress output
  • --timeout N: Request timeout in seconds (default: 120)
  • --table: Output as formatted table (default: JSON)

Configuration

The tool reads configuration from ~/.openclaw/openclaw.json. Targets are defined in the models.providers section with:

  • baseUrl: API base URL
  • apiKey: Authentication key (or ${ENV_VAR} to read from environment variable)
  • api: API format (anthropic-messages, openai-completions, openai-responses)
  • models: List of model configurations

Security Note: Instead of hardcoding API keys in the config file, use environment variable placeholders:

  • "apiKey": "${ANTHROPIC_API_KEY}" will read from the ANTHROPIC_API_KEY environment variable

Example provider config:

{
  "models": {
    "providers": {
      "my-provider": {
        "baseUrl": "https://api.example.com",
        "apiKey": "sk-xxx",
        "api": "openai-completions",
        "models": [
          { "id": "model-name", "api": "openai-completions" }
        ]
      }
    }
  }
}

Output Metrics

  • TTFT (Time To First Token): Latency before first token arrives (seconds)
  • TPS (Tokens Per Second): Generation throughput
  • Total Time: Full generation duration (seconds)
  • Input/Output Tokens: Token counts from API usage data (or estimated at 4 chars/token if not provided by API)

Note: Token counts are reported by the API when available. If the API doesn't return token counts, they are estimated at 4 characters per token.

Example Usage

# Check if a specific target is reachable
python3 main.py check --label my-provider

# Benchmark a single target
python3 main.py run --label my-provider --repeat 3

# Compare all targets
python3 main.py run --all --table

版本历史

共 1 个版本

  • v1.0.2 当前
    2026-05-12 05:42 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,226 📥 267,814
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 676 📥 325,416
ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,378 📥 320,410