360 Secure SkillHub
360 安全技能中心

AI/ML API LLM + Reasoning for OpenClaw

封装 run_chat.py 脚本调用 AIMLAPI 聊天补全接口,从 AIMLAPI_API_KEY 读取密钥,携带 User-Agent 发送请求并支持重试;通过参数传入模型、system/user 提示与 extra-json(如 reasoning、response_format)获取文本或 JSON 结果,也可写入输出文件。

aimlapihello
aimlapihello
热度 89.95
最近更新 2026-05-17 11:50:58
分类:开发依赖:代码执行 / 第三方 API / 内部调用大模型 / 读写文件应用场景:API 集成 / 自动化脚本 / 摘要总结 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add aiml-llm-reasoning
Metadata
name
aimlapi-llm-reasoning
description
Run AIMLAPI LLM and reasoning workflows through chat completions with retries, structured outputs, and explicit User-Agent headers. Use when Codex needs scripted prompting/reasoning calls against AIMLAPI models.
env
["AIMLAPI_API_KEY"]
primaryEnv
AIMLAPI_API_KEY

AIMLAPI LLM + Reasoning

Overview

Use run_chat.py to call AIMLAPI chat completions with retries, optional API key file fallback, and a User-Agent header on every request.

Quick start

export AIMLAPI_API_KEY="sk-aimlapi-..."
python3 {baseDir}/scripts/run_chat.py --model aimlapi/openai/gpt-5-nano-2025-08-07 --user "Summarize this in 3 bullets."

Tasks

Run a basic chat completion

python3 {baseDir}/scripts/run_chat.py \
  --model aimlapi/openai/gpt-5-nano-2025-08-07 \
  --system "You are a concise assistant." \
  --user "Draft a project kickoff checklist." \
  --user-agent "openclaw-custom/1.0"

Add reasoning parameters

python3 {baseDir}/scripts/run_chat.py \
  --model aimlapi/openai/gpt-5-nano-2025-08-07 \
  --user "Plan a 5-step rollout for a new chatbot feature." \
  --extra-json '{"reasoning": {"effort": "medium"}, "temperature": 0.3}'

Structured JSON output

python3 {baseDir}/scripts/run_chat.py \
  --model aimlapi/openai/gpt-5-nano-2025-08-07 \
  --user "Return a JSON array of 3 project risks with mitigation." \
  --extra-json '{"response_format": {"type": "json_object"}}' \
  --output ./out/risks.json

References

  • references/aimlapi-llm.md: payload and troubleshooting notes.
  • README.md: changelog-style summary of new instructions.