Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add nongjun/feishu-cursor-claw --skill ai-servicegit clone --depth 1 https://github.com/nongjun/feishu-cursor-clawWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/nongjun/feishu-cursor-claw/ai-service)<a href="https://agentmods.dev/skills/nongjun/feishu-cursor-claw/ai-service"><img src="https://agentmods.dev/badge/skills/nongjun/feishu-cursor-claw/ai-service/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/nongjun/feishu-cursor-claw/ai-service"><img src="https://agentmods.dev/badge/skills/nongjun/feishu-cursor-claw/ai-service.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00067 | $0.00765 |
| Opus 5 | $0.00034 | $0.00382 |
| Sonnet 5 | $0.00013 | $0.00153 |
| Haiku 4.5 | $0.00007 | $0.00076 |
Grade A, and why
ai-service scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
AI Service
架构概览
调用方 → AIService → 门户模型注册表 → 4sapi(首选)/ sodao(次选)/ OpenRouter(备选),按 function_code 匹配绑定模型。
核心能力
| 方法 | 用途 |
|---|---|
chat() |
文本对话(支持智能降级) |
chat_stream() |
流式输出 |
chat_stream_thinking() |
Thinking 模型专用流式接口 |
vision() |
图片理解 |
analyze_pdf() |
PDF 分析 |
analyze_audio() |
音频分析 |
analyze_video() |
视频分析 |
generate_image() |
图像生成 |
SOP:接入 AI 功能
- 导入:
from shared_backend.services.ai_service import AIService - 实例化:
AIService(module_code="模块名", db_session=db) - 注册提示词(可选):用于日志追踪
- 调用对应方法,传入
prompt_name用于统计
重点关注
三服务商 + 降级链
- 首选 4sapi,次选 sodao(苏打API),备选 OpenRouter
- 降级链(三阶段):
- Phase 1(4sapi):Claude Opus 4.6 Thinking → Gemini 3.1 Pro → Gemini Flash
- Phase 2(sodao):Gemini 3.1 Pro → Gemini Flash(不重试 opus)
- Phase 3(OpenRouter):DeepSeek Chat V3 → Qwen 2.5 72B(国产模型兜底)
- 降级缓存机制:某模型连续失败后暂时跳过
门户模型注册表(v2)
- 管理员在门户「AI 配置 → 模型管理」注册可用模型(
ai_available_models表),每个模型自带base_url+api_key+model - 各模块在「AI 配置 → 模型绑定」通过
module_code+function_code绑定指定模型(ai_module_model_config表) - 运行时
AIService(module_code, function_code=, db_session=)自动查询绑定,优先使用绑定模型,未绑定时走全局降级链 - 门户后台可动态切换模型,无需改代码
JSON 解析工具
parse_ai_json_response(content)— 从 AI 回复中提取 JSONsafe_parse_ai_json(content, default)— 带默认值的安全解析- 自动处理
<thinking>标签、Markdown 代码块、混合文本
API Key 管理
- 统一从门户系统动态获取(
SAPI_API_KEY/SODAO_API_KEY/OPENROUTER_API_KEY),禁止硬编码 - 门户地址配置:
PORTAL_API_URL
参考文件
公共模块/shared_backend/services/ai_service.py(主实现)文档/核心信念/AI调用规范.md
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 10d ago First seen · 65 lines · 67 tokens per session scan A 8ebff8a22423
ai-service is a skill published in the GitHub repository nongjun/feishu-cursor-claw (14 stars, last pushed 1mo ago), licensed MIT. It adds 67 tokens to every session and 765 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
firebase-ai
Use when setting up firebaseai, generating text/chat with Gemini, streaming AI output, building multimodal prompts, or handling AI errors.
audit-langfuse-llm
Run a PDCA quality audit on LLM/AI features: traces, prompts, costs, evals, grounding, hallucination. Use for "audit LLM quality", "check Langfuse", "audit prompts", "check AI quality", "audit AI costs", "check traces". Jailbreak/OWASP LLM → audit-llm-security. Token caps → plan-llm-cost-guardrails.
data-pipeline
Wire ETL, ingestion, cron, edge-function, and queue jobs correctly. Use for "build a pipeline", "sync X into Y", "nightly aggregation", "cron double-counts", "dedupe", "backfill", "the numbers are wrong after a retry". Bakes in idempotency, atomic writes, data contracts, dead-letter, and observability.
plan-llm-cost-guardrails
Audit an LLM-powered app for runaway-cost and quota-abuse exposure, then produce a phased guardrail plan. Use when the user says "cap my AI costs", "my LLM bill could blow up", "rate limit my AI", "token budget", "runaway agent loop", or is hardening LLM features before launch.
audit-llm-security
Read-only OWASP LLM Top 10 audit of app-facing AI: prompt injection, data leakage, unsafe output/agency, RAG risks, misinformation, and unbounded spend. Use when "audit LLM security", "prompt injection", "jailbreak my chatbot", or "is my AI safe?". General app security → audit-security.
embedding-pipeline-builder
Builds document embedding pipelines with text chunking, embedding generation, indexing, and retrieval optimization. Use when users request "embedding pipeline", "document indexing", "text chunking", "RAG preprocessing", or "semantic indexing".