API Quality Check
Use the bundled script to run headless API-quality checks. Treat this skill as script-first: do not recreate LT-lite/B3IT-lite logic inline unless the script is clearly insufficient.
Provider names such as Ark/Volcengine, GLM, DeepSeek, Kimi, SiliconFlow, and similar services are examples only. The primary decision is the endpoint protocol type: OpenAI, OpenAI-Compatible, or Anthropic.
Quick start
Set the path once:
CODEBLOCK0
Run a capability smoke test first:
CODEBLOCK1
For many OpenAI-compatible endpoints, the same command also works if the user pastes the full .../chat/completions URL. The script will normalize it back to the API root automatically.
If you want a ready-to-run provider.json first, generate it with:
CODEBLOCK2
If an endpoint requires client-specific headers, put them in the config JSON as a headers object or pass them with --headers-json. For Kimi coding endpoints, use {"User-Agent":"KimiCLI/2.0.0"} only when the address is under https://api.kimi.com/coding; for the OpenAI-compatible Kimi path, use https://api.kimi.com/coding/v1.
If you already have multiple raw endpoint entries, normalize them into providers.json with:
CODEBLOCK3
Or run the full batch pipeline:
CODEBLOCK4
That command also creates ./api-quality-out/index.html as the landing page for all generated reports.
For one endpoint that you want to check every day and archive by date:
CODEBLOCK5
Workflow
- 1. Run
smoke before any baseline or detect run. - If you have many endpoints, run
batch-smoke with a config list before choosing which ones deserve deeper LT/B3IT work. - Read the result:
-
b3it_supported=true: the endpoint can return normal first-token text at
max_tokens=1
-
lt_supported=true: the endpoint also returns
logprobs, so LT-lite can run
-
recommended_detector: the script's direct recommendation for the next step
- 4. If
lt_supported=false, do not force LT-lite; pivot to B3IT-lite or report that LT is unavailable. - Save baselines to explicit JSON files and reuse them for later detection.
- Keep outputs file-based for coding CLIs and OpenClaw. Do not depend on GUI state.
- For noisy endpoints, prefer the built-in B3IT defaults before tightening or loosening thresholds manually.
Endpoint Types
- -
OpenAI: use this for official OpenAI-style endpoints. - INLINECODE21 : use this for third-party endpoints that follow OpenAI request and response shapes; vendor-specific headers may be required.
- INLINECODE22 : use this for
/v1/messages style endpoints; in this skill it is B3IT-only.
Commands
Capability smoke
CODEBLOCK6
Generate a provider config template
CODEBLOCK7
Generate a batch providers.json template
CODEBLOCK8
Batch capability smoke
CODEBLOCK9
Batch LT-lite baselines
CODEBLOCK10
Batch LT-lite detect
CODEBLOCK11
Batch B3IT-lite baselines
CODEBLOCK12
Batch B3IT-lite detect
CODEBLOCK13
LT-lite baseline
CODEBLOCK14
LT-lite detect
CODEBLOCK15
B3IT-lite baseline
CODEBLOCK16
B3IT-lite detect
CODEBLOCK17
Daily single-endpoint drift run
CODEBLOCK18
Defaults and guardrails
- - Default to non-streaming,
timeout=60, and temperature values matched to the detector. - Every command can additionally write a human-readable report with
--html-output. - OpenAI/OpenAI-compatible requests may include custom JSON
headers, either from the config file or --headers-json. - The Kimi-specific
{"User-Agent":"KimiCLI/2.0.0"} header is not a general default. Use it only for https://api.kimi.com/coding endpoints; for the OpenAI-compatible Kimi path, use https://api.kimi.com/coding/v1. - The script auto-disables thinking for common reasoning-first providers such as Ark, Doubao, GLM, and Zhipu unless
extra_body is explicitly provided in the config JSON. - For OpenAI/OpenAI-compatible endpoints that still return
reasoning_content without normal text, the script will retry once with {"thinking":{"type":"disabled"}} before failing. - OpenAI/OpenAI-compatible configs may use either the API root or a full
.../chat/completions URL; the script normalizes the base URL internally. - INLINECODE36 writes the normalized config explicitly, including any auto-selected
extra_body, so the saved file is portable across Codex, Claude Code, Gemini CLI, and OpenClaw runs. - INLINECODE38 does the same normalization for a whole config list and writes a ready-to-run
providers.json. - Anthropic mode is treated as B3IT-only in this skill.
- If the endpoint returns reasoning/thinking blocks but no normal text, report that as a capability mismatch instead of fabricating a token result.
- If the endpoint does not return
logprobs, report that LT-lite is unavailable instead of guessing. - B3IT baseline discovery on OpenAI/OpenAI-compatible endpoints will automatically retry with a stronger candidate-search profile if an initial low-cost run finds no border inputs.
- B3IT detection defaults are tuned for lower false positives:
detection-repeats=5, min-stable-count=2, min-stable-ratio=0.35, confirm-passes=1. - Daily runs auto-refresh older B3IT baselines when they predate the stable-support filtering fields.
Resources
Open only what you need:
- - Workflow examples and CLI usage: INLINECODE45
- Protocol-first playbook for
OpenAI, OpenAI-Compatible, and Anthropic: INLINECODE49 - Kimi coding endpoint quickstart: INLINECODE50
- Kimi Anthropic endpoint quickstart: INLINECODE51
- JSON config format: INLINECODE52
- Example provider list: INLINECODE53
- Main executable: INLINECODE54
- One-shot batch wrapper: INLINECODE55
- Daily single-endpoint wrapper: INLINECODE56
API 质量检查
使用捆绑脚本运行无头API质量检查。将此技能视为脚本优先:除非脚本明显不足,否则不要内联重新创建LT-lite/B3IT-lite逻辑。
供应商名称如Ark/火山引擎、GLM、DeepSeek、Kimi、SiliconFlow及类似服务仅为示例。主要决策在于端点协议类型:OpenAI、OpenAI兼容或Anthropic。
快速开始
一次性设置路径:
bash
export CODEXHOME=${CODEXHOME:-$HOME/.codex}
export APIQ=$CODEXHOME/skills/api-quality-check/scripts/apiquality_check.py
export APIQBATCH=$CODEXHOME/skills/api-quality-check/scripts/runbatchchecks.sh
export APIQDAILY=$CODEXHOME/skills/api-quality-check/scripts/rundailycheck.sh
首先运行能力冒烟测试:
bash
python $APIQ smoke \
--provider OpenAI兼容 \
--base-url https://ark.cn-beijing.volces.com/api/coding/v3 \
--api-key $API_KEY \
--model-id ark-code-latest \
--html-output ./smoke.html
对于许多OpenAI兼容的端点,如果用户粘贴完整的.../chat/completions URL,同样的命令也适用。脚本会自动将其规范化为API根路径。
如果您想要一个立即可用的provider.json,请使用以下命令生成:
bash
python $APIQ init-config \
--provider OpenAI兼容 \
--base-url https://api.siliconflow.cn/v1/chat/completions \
--api-key $API_KEY \
--model-id deepseek-ai/DeepSeek-V3.2 \
--name siliconflow-v3-2 \
--config-output ./provider.json
如果端点需要特定客户端的标头,请将其作为headers对象放入配置JSON中,或使用--headers-json传递。对于Kimi编码端点,仅在地址位于https://api.kimi.com/coding下时使用{User-Agent:KimiCLI/2.0.0};对于OpenAI兼容的Kimi路径,请使用https://api.kimi.com/coding/v1。
如果您已有多个原始端点条目,请使用以下命令将其规范化为providers.json:
bash
python $APIQ init-batch-config \
--configs ./raw-providers.json \
--config-output ./providers.json
或者运行完整的批处理流水线:
bash
$APIQ_BATCH ./providers.json ./api-quality-out
该命令还会创建./api-quality-out/index.html作为所有生成报告的登录页面。
对于需要每天检查并按日期归档的单个端点:
bash
bash $APIQ_DAILY ./provider.json ./daily-out my-endpoint
工作流程
- 1. 在任何基线或检测运行之前先运行smoke。
- 如果您有多个端点,在选择哪些端点值得进行更深入的LT/B3IT工作之前,先使用配置列表运行batch-smoke。
- 读取结果:
- b3it
supported=true:端点在maxtokens=1时可以返回正常的首个token文本
- lt_supported=true:端点还返回logprobs,因此可以运行LT-lite
- recommended_detector:脚本直接推荐的下一步操作
- 4. 如果lt_supported=false,不要强制使用LT-lite;转而使用B3IT-lite或报告LT不可用。
- 将基线保存到显式的JSON文件中,并在后续检测中重复使用。
- 保持输出基于文件,适用于编码CLI和OpenClaw。不要依赖GUI状态。
- 对于噪声较大的端点,在手动收紧或放宽阈值之前,优先使用内置的B3IT默认值。
端点类型
- - OpenAI:用于官方OpenAI风格的端点。
- OpenAI兼容:用于遵循OpenAI请求和响应形状的第三方端点;可能需要特定供应商的标头。
- Anthropic:用于/v1/messages风格的端点;在此技能中为仅B3IT。
命令
能力冒烟测试
bash
python $APIQ smoke --config ./provider.json --output ./smoke.json
生成供应商配置模板
bash
python $APIQ init-config \
--provider OpenAI兼容 \
--base-url https://api.siliconflow.cn/v1/chat/completions \
--api-key $API_KEY \
--model-id deepseek-ai/DeepSeek-V3.2 \
--config-output ./provider.json
生成批处理providers.json模板
bash
python $APIQ init-batch-config \
--configs ./raw-providers.json \
--config-output ./providers.json
批处理能力冒烟测试
bash
python $APIQ batch-smoke --configs ./providers.json --output ./batch-smoke.json --html-output ./batch-smoke.html
批处理LT-lite基线
bash
python $APIQ batch-lt-baseline \
--configs ./providers.json \
--output-dir ./lt-baselines \
--output ./batch-lt-baselines.json \
--html-output ./batch-lt-baselines.html
批处理LT-lite检测
bash
python $APIQ batch-lt-detect \
--configs ./providers.json \
--baseline-manifest ./batch-lt-baselines.json \
--output ./batch-lt-report.json \
--html-output ./batch-lt-report.html
批处理B3IT-lite基线
bash
python $APIQ batch-b3it-baseline \
--configs ./providers.json \
--output-dir ./b3it-baselines \
--output ./batch-b3it-baselines.json \
--html-output ./batch-b3it-baselines.html
批处理B3IT-lite检测
bash
python $APIQ batch-b3it-detect \
--configs ./providers.json \
--baseline-manifest ./batch-b3it-baselines.json \
--output ./batch-b3it-report.json \
--html-output ./batch-b3it-report.html \
--detection-repeats 5 \
--min-stable-count 2 \
--min-stable-ratio 0.35 \
--confirm-passes 1
LT-lite基线
bash
python $APIQ lt-baseline --config ./provider.json --output ./lt-baseline.json
LT-lite检测
bash
python $APIQ lt-detect \
--config ./provider.json \
--baseline ./lt-baseline.json \
--output ./lt-report.json
B3IT-lite基线
bash
python $APIQ b3it-baseline --config ./provider.json --output ./b3it-baseline.json
B3IT-lite检测
bash
python $APIQ b3it-detect \
--config ./provider.json \
--baseline ./b3it-baseline.json \
--output ./b3it-report.json \
--detection-repeats 5 \
--min-stable-count 2 \
--min-stable-ratio 0.35 \
--confirm-passes 1
每日单端点漂移运行
bash
bash $APIQ_DAILY ./provider.json ./daily-out my-endpoint
默认值和防护措施
- - 默认为非流式、timeout=60,温度值与检测器匹配。
- 每个命令都可以额外使用--html-output写入人类可读的报告。
- OpenAI/OpenAI兼容的请求可能包含自定义JSON headers,来自配置文件或--headers-json。
- Kimi特定的{User-Agent:KimiCLI/2.0.0}标头不是通用默认值。仅用于https://api.kimi.com/coding端点;对于OpenAI兼容的Kimi路径,请使用https://api.kimi.com/coding/v1。
- 脚本会自动禁用常见推理优先供应商(如Ark、豆包、GLM和智谱)的思考功能,除非在配置JSON中显式提供了extrabody。
- 对于仍返回reasoningcontent但没有正常文本的OpenAI/OpenAI兼容端点,脚本将在失败前使用{thinking:{type:disabled}}重试一次。
- OpenAI/OpenAI兼容的配置可以使用API根路径或完整的.../chat/completions URL;脚本会在内部规范化base URL。
- init-config会显式写入规范化后的配置,包括任何自动选择的extra_body,因此保存的文件