Borrowing it
Nothing to install: this file belongs to AXERA-TECH/Magnetar. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/AXERA-TECH/Magnetar/main/.codex/skills/magnetar/hidden/sdk-gen/SKILL.mdgit clone --depth 1 https://github.com/AXERA-TECH/MagnetarWrote 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/axera-tech/magnetar/sdk-gen)<a href="https://agentmods.dev/skills/axera-tech/magnetar/sdk-gen"><img src="https://agentmods.dev/badge/skills/axera-tech/magnetar/sdk-gen.svg" alt="Measured on agentmods" height="20"></a>- NVIDIA SkillSpector pass
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.00028 | $0.01219 |
| Opus 5 | $0.00014 | $0.00609 |
| Sonnet 5 | $0.00006 | $0.00244 |
| Haiku 4.5 | $0.00003 | $0.00122 |
Grade A, and why
sdk-gen 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 8d 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.
How it starts
The opening of the file, as written. The whole thing — 73 lines — stays where its author put it; the contents beside it link to each section on GitHub.
SDK-GEN
执行
MobileNet 直接调用:
magnetar.stages.sdk_gen.run_mobilenet_python(task_dir, labels)magnetar.stages.sdk_gen.run_mobilenet_cpp(task_dir, target_hw)
其他模型 Agent 自行实现。关键要求:
- Python:
pyaxengine.AxEngineExecutionProvider为默认 provider,import <sdk>通过 - C++:CMake 直接链接
ax_engine/ax_sys(不用 FetchContent),cmake configure 通过 - YOLO 系列:集成 libdet.axera,
requirements.txt注明git clone获取方式 - pyaxengine 等 GitHub 直链依赖默认经
GH_PROXY(gh_proxy_url())写入 requirements.txt
通用 SDK 生成(非 MobileNet)
优先调用:
magnetar.stages.sdk_gen.run_generic_python(task_dir)→sdk/python/<model>_sdk/magnetar.stages.sdk_gen.run_generic_cpp(task_dir, target_hw)→sdk/cpp/
一致性保障(自动):
- 模型接口(输入输出名/shape/dtype)以
export/model_meta.json为权威 - 预处理/后处理与示例输入以
origin/model_flow.json(ACQUIRE 阶段记录)为准 - 前后处理对齐原版:preprocess/postprocess 必须来自原版模型管线(ACQUIRE 验证过),
调用方式尽量对齐原版(
model_flow.sdk_interface记录入口/入参顺序/输入格式/输出结构, example.py 镜像原版调用方式);禁止为省事改成直通/自定义 example_input缺失、preprocess_code/postprocess_code语法错误时抛错, 避免生成与真实运行流程不一致的 SDK- 生成后务必用
example.py --model ... --input <真实样本>验证一次(板端或 ORT 回退)
需要自定义预处理/后处理时,在 model_flow.json 提供代码后重新调用生成函数。
发布版(NPU 专用,无 CPU 回退)
端到端 NPU 跑通后(RUNONBOARD 报告存在),发布包内 SDK 不再保留 onnxruntime 回退:
package.assemble()会自动把package/python下的通用 SDK 替换为 NPU-only 版 (inference.py只 import axengine,非 AX 环境直接报错并提示在板端运行)- 交付 SDK 的依赖仅为
numpy + pyaxengine,不包含 onnxruntime/torch/transformers - 依赖最小化:交付包 Python/C++ 尽量减少依赖(C++ 只链 ax_engine/ax_sys; Python 只 numpy+pyaxengine),opencv/pillow 等仅当原版前处理确实需要时才进 requirements.txt
- CPU fallback 尽量不做:能端到端 NPU 就端到端;仅 RUNONBOARD 未跑通时才允许保留开发版回退, 且交付说明中必须标注“未做端到端 NPU 验证”
- 源目录
sdk/python/保留开发版(含 ORT 回退)供本机逻辑验证,不进交付包 - 需要严格版时也可直接调用
run_generic_python(task_dir, strict_npu=True)
LLM 分支(model_route=llm)
模型是自回归/类 LLM 时,SDK 不再基于 pyaxengine,改为:
- Python SDK:OpenAI 兼容 HTTP 客户端——类
LLMClient(api_url, model_name),chat(messages, **kwargs)/stream()调/v1/chat/completions;依赖仅 requests (requirements.txt 只写requests,不含 pyaxengine/onnxruntime/torch/transformers); 调用约定对齐原模型 chat 模板(model_flow.json的 sdk_interface);example.py启动/复用板端axllm serve后调用客户端打印回复; - C++ SDK:可选,OpenAI 兼容 HTTP 客户端(libcurl),cmake configure 通过即可, 不强求上板链接 AX runtime;
- 板端运行前置:
axllm serve <model_dir>(RUNONBOARD 负责安装与启动)。
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.
- 8d ago First seen · 73 lines · 28 tokens per session scan A ba5f10deceed
sdk-gen is a skill published in the GitHub repository AXERA-TECH/Magnetar (22 stars, last pushed 5d ago), licensed MIT. It adds 28 tokens to every session and 1,219 once invoked, about $0.0001 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
accelerated-computing-cudf
Official NVIDIA-authored guidance for NVIDIA cuDF GPU DataFrames, pandas acceleration, dask-cuDF, ETL, joins, groupby, CSV/Parquet I/O, nullable semantics, and multi-GPU DataFrame workloads.
cuopt-numerical-optimization-api
LP, MILP, and QP (beta) with cuOpt — Python, C, and CLI. Use when the user is solving LP, MILP, or QP with any cuOpt interface.
tilelang-cuda-examples-torch
A collection of runnable examples showing how to write CUDA kernels in TileLang, a Python-like language for GPU code, and use them with PyTorch, a machine-learning library.
torchtalk-analyzer
Analyze PyTorch internals across Python, C++, and CUDA layers using the TorchTalk MCP server. Use when asked about how PyTorch operators work internally, where functions are implemented, what would break if code is modified, or finding tests for PyTorch operators.
torchtalk-trace
Trace a PyTorch function's cross-language binding chain (Python -> C++ -> CUDA).
code_interpreter
A tool for running Python code in an isolated environment. Python is a programming language often used for calculations, data processing, file-format conversion, and preparing chart data.