# llmspeedtest **Repository Path**: startvibecoding/llmspeedtest ## Basic Information - **Project Name**: llmspeedtest - **Description**: 测试 OpenAI Chat 和 Anthropic 格式模型的速度,测量首次响应延迟和每秒 Token 数。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-23 - **Last Updated**: 2026-05-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # LLMSpeed - LLM Token 速度测试工具 测试 OpenAI Chat 和 Anthropic 格式模型的速度,测量首次响应延迟和每秒 Token 数。 ## 功能 - 支持 OpenAI Chat 和 Anthropic 流式 API - 测量首次响应延迟(ms)和每秒 Token 数 - 通过 content-type 检查提前检测无效模型 - 支持推理模型的 `reasoning_content` 字段 - 结果导出为 CSV ## 配置文件格式 (config.yaml) ```yaml test_prompt: "你好,请介绍一下你自己" models: - base_url: "https://api.openai.com/v1" type: "openai-chat" models: - "gpt-4o" - "gpt-4o-mini" api_key: "sk-xxx" - base_url: "https://api.anthropic.com" type: "anthropic" models: - "claude-3-5-sonnet-20241022" api_key: "sk-ant-xxx" ``` ## 运行 ```bash pip install openai anthropic pyyaml python llmspeed.py ``` 使用自定义配置文件: ```bash python llmspeed.py my_config.yaml ``` ## 输出 结果保存到 `results.csv`,包含以下列: | 列名 | 说明 | |------|------| | `base_url` | API 端点 | | `type` | API 类型(`openai-chat` 或 `anthropic`) | | `model` | 模型名称 | | `first_token_latency` | 首次响应延迟(ms),失败为 -1 | | `tokens_per_second` | 每秒 Token 数,失败为 -1 |