Agent Skills › xiaoY233/Chat2API

xiaoY233/Chat2API

GitHub

将OpenAI兼容客户端的HAR文件转换为可重放的Chat2API工具调用测试夹具。自动移除敏感信息和易变头部,确保生成的Fixture安全且不含Authorization值,支持命令行参数或环境变量配置输入输出路径。

5 skills 1,252

Install All Skills

npx skills add xiaoY233/Chat2API --all -g -y
More Options

List skills in collection

npx skills add xiaoY233/Chat2API --list

Skills in Collection (5)

将OpenAI兼容客户端的HAR文件转换为可重放的Chat2API工具调用测试夹具。自动移除敏感信息和易变头部,确保生成的Fixture安全且不含Authorization值,支持命令行参数或环境变量配置输入输出路径。
需要将HAR录制文件转换为可复用测试数据 需要清理HAR中的敏感信息以生成安全的回放夹具
skills/chat2api-har-tool-fixture/SKILL.md
npx skills add xiaoY233/Chat2API --skill chat2api-har-tool-fixture -g -y
SKILL.md
Frontmatter
{
    "name": "chat2api-har-tool-fixture",
    "description": "Use when converting OpenAI-compatible client HAR files into sanitized replayable Chat2API tool-calling fixtures."
}

Chat2API HAR Tool Fixture

Use this skill when a recorded client HAR should become reusable test input.

Rules

  • Treat HAR parsing as generic.
  • Put client-specific expectations in replay profiles, not in HAR extraction.
  • Remove secrets and volatile headers from generated fixtures.
  • Output fixtures are safe to replay and must not contain Authorization values.

Commands

node skills/chat2api-har-tool-fixture/scripts/extract-har-fixtures.mjs \
  --har backup/har/Cherry-Studio.har \
  --client cherry-studio \
  --out backup/har/cherry-studio-fixture.json

Use --har for the source HAR, --client for the fixture client profile, and --out for the output fixture path. If omitted, --har can come from CHAT2API_HAR, --client can come from CHAT2API_CLIENT_PROFILE, and output defaults to backup/har/<client>-tool-fixtures-<timestamp>.json.

用于Chat2API管理API的测试与操作,涵盖健康检查、配置快照、临时密钥生成、模型映射及日志清理。通过脚本实现安全隔离的测试流程,确保敏感信息不泄露并支持配置回滚。
需要进行Chat2API管理接口的集成测试 需要创建或销毁临时API密钥 需要备份或恢复系统配置快照 执行代理测试前的环境准备
skills/chat2api-management-api/SKILL.md
npx skills add xiaoY233/Chat2API --skill chat2api-management-api -g -y
SKILL.md
Frontmatter
{
    "name": "chat2api-management-api",
    "description": "Use when operating Chat2API Manager's management API for testing, including health checks, config snapshots, temporary API keys, model mappings, sessions, logs, and cleanup verification."
}

Chat2API Management API

Use this skill before live proxy testing that needs /v0/management/*.

Rules

  • Never print full management secrets, API keys, or account credentials.
  • Create disposable API keys for tests and delete only keys created by the current run.
  • Snapshot config before mutation and restore it in cleanup.
  • Do not clear sessions unless the user explicitly asks for cleanup.

Script

Use scripts/management-api.mjs for repeatable management API setup, observation, and cleanup commands.

Commands

CHAT2API_MGMT_SECRET=mgmt_xxx node skills/chat2api-management-api/scripts/management-api.mjs snapshot
CHAT2API_MGMT_SECRET=mgmt_xxx node skills/chat2api-management-api/scripts/management-api.mjs create-api-key --name codex-live-test
CHAT2API_MGMT_SECRET=mgmt_xxx node skills/chat2api-management-api/scripts/management-api.mjs delete-api-key --id key-id
CHAT2API_MGMT_SECRET=mgmt_xxx node skills/chat2api-management-api/scripts/management-api.mjs restore-tool-config --file /private/tmp/toolCallingConfig.json

Use --dry-run to verify command shape without network calls.

create-api-key prints a one-time API key to stdout. Do not write this output to durable logs, transcripts, or shared artifacts.

snapshot omits request logs by default. Use snapshot --include-logs only when logs are intentionally needed; included snapshot data is locally redacted before printing.

用于Chat2API提供者的模型矩阵测试,通过GET /v1/models接口发现和管理模型。支持使用管理API进行归属和清理,遵循快速失败策略,可通过参数指定特定提供商或模型以缩小测试范围。
需要验证Chat2API提供者模型覆盖范围时 执行基于实时/v1/models接口的模型发现与管理测试时
skills/chat2api-provider-model-matrix/SKILL.md
npx skills add xiaoY233/Chat2API --skill chat2api-provider-model-matrix -g -y
SKILL.md
Frontmatter
{
    "name": "chat2api-provider-model-matrix",
    "description": "Use when running Chat2API provider and model matrix tests using live \/v1\/models discovery and management API attribution."
}

Chat2API Provider Model Matrix

Use this skill when model coverage must follow the live /v1/models surface.

Rules

  • Use GET /v1/models as the primary model source.
  • Use management API data for attribution and cleanup.
  • Keep provider fail-fast opt-in.

Commands

CHAT2API_BASE_URL=http://127.0.0.1:8080 \
CHAT2API_MGMT_SECRET=mgmt_xxx \
CHAT2API_API_KEY=sk_xxx \
node skills/chat2api-provider-model-matrix/scripts/run-model-matrix.mjs \
  --fixture backup/har/cherry-studio-fixture.json \
  --profile cherry-studio

The default model source is GET /v1/models. Use --provider, --model, and --fail-fast-provider N to narrow live runs.

Chat2API代理测试的编排入口,用于验证对话、工具调用及路由等行为。通过管理API、HAR提取、模型矩阵和客户端重放等子技能,执行回归测试、健康检查与日志审查。
需要验证Chat2API代理功能时 执行代理回归测试或配置快照时
skills/chat2api-proxy-testing/SKILL.md
npx skills add xiaoY233/Chat2API --skill chat2api-proxy-testing -g -y
SKILL.md
Frontmatter
{
    "name": "chat2api-proxy-testing",
    "description": "Use when validating Chat2API Manager proxy behavior across dialogue, tool calling, context, provider routing, request logs, and live client replay workflows."
}

Chat2API Proxy Testing

Use this as the orchestration entry point.

Focused Skills

  • Use chat2api-management-api for management API setup, observation, and cleanup.
  • Use chat2api-har-tool-fixture to extract reusable fixtures from HAR files.
  • Use chat2api-tool-client-replay to replay one client fixture against one or more models.
  • Use chat2api-provider-model-matrix to discover /v1/models and run matrix coverage.

Default Order

  1. Run source regressions when code changed.
  2. Snapshot health and config through management API.
  3. Extract or select a fixture.
  4. Discover models through /v1/models.
  5. Replay scenarios.
  6. Inspect logs and sessions.
  7. Restore config and delete temporary test assets.

Source Of Truth

The versioned source of truth is this skills/chat2api-proxy-testing directory plus the focused sibling skills. ignored .codex copies are local working copies only and must not be the only place where testing behavior is documented.

用于重放经过清洗的客户端工具调用测试用例,支持Cherry Studio等特定客户端。通过配置文件和命令行参数验证流式/非流式行为及协议期望,提供干跑模式以检查配置而不发送实际请求。
需要针对特定客户端(如Cherry Studio)重放工具调用测试场景 验证不同客户端在Chat2API上的工具调用兼容性与协议一致性
skills/chat2api-tool-client-replay/SKILL.md
npx skills add xiaoY233/Chat2API --skill chat2api-tool-client-replay -g -y
SKILL.md
Frontmatter
{
    "name": "chat2api-tool-client-replay",
    "description": "Use when replaying sanitized client tool-calling fixtures against Chat2API with client-specific pass\/fail rules."
}

Chat2API Tool Client Replay

Use this skill to replay fixture scenarios for clients such as Cherry Studio, generic OpenAI tools, or unknown HAR-derived clients.

Rules

  • Preserve exact tool names.
  • Validate stream and non-stream behavior separately.
  • Use profiles for client-specific prompt-protocol expectations.

Commands

CHAT2API_API_KEY=sk_xxx \
node skills/chat2api-tool-client-replay/scripts/replay-client-fixture.mjs \
  --fixture backup/har/cherry-studio-fixture.json \
  --profile cherry-studio \
  --model deepseek-v4-flash

Use --dry-run to check profile, model, and fixture selection without live requests. If the fixture file exists, dry-run parses the fixture schema and reports fixtureExists plus scenarioCount; if it is missing, dry-run still exits successfully with fixtureExists: false.

Profiles

  • cherry-studio: Cherry Studio headers and visible prompt-tool-use expectations.
  • openai-tools: generic OpenAI-compatible tool-calling expectations.
  • custom-har: empty client headers for replaying sanitized HAR-derived fixtures.

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-13 09:54
浙ICP备14020137号-1 $Гость$