Integrate decision models through your AI tool's extension mechanism: using automated comment moderation as the example, one request judges multiple comments in parallel and returns choice, probabilities, and confidence for confidence-based auto-approve, auto-hide, or human review.
Background: why a decision model
Comment moderation, ticket triage, and request routing are judgment tasks. The common approach is to have a chat model output JSON: the rules live in a prompt and can be steered off course by suggestive content; the output often arrives wrapped in code fences that parse unreliably; and the model generates a paragraph of analysis first, which adds token cost.
Send state (the content to judge) and questions (typed questions) to the /compatible-mode/v1/systemone endpoint and get structured answers back: choice (the verdict), probabilities (the distribution), and confidence (how sure). No natural-language text is generated. Questions come in three types: Choice (pick from options), Score (rate against ordered levels), and Noul (return a 0-to-1 probability), and a single call can mix several questions evaluated in parallel.
Compared with asking a chat model to "quickly classify this":
- Judgment criteria are passed structurally in the
criteriafield, not depending on the wording of a long prompt - The response is JSON, with no fences and no extra prose, ready for agents and code to consume
- Answers are short structures rather than long text, keeping output token cost low for high-frequency calls
Request and response
Endpoint: https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/systemone
Authentication: Authorization: Bearer $ANTHROPIC_AUTH_TOKEN, set to the Token Plan subscription API key (prefixed with sk-sp-).
Calls consume Credits. For billing rules, see Usage and quota. Examples in this topic use decision-model.
Request body fields:
| Field | Type | Required | Description |
|---|---|---|---|
model | String | Yes | decision-model |
state | String / Object / Array | Yes | Content to judge, as text, an object, or an array |
image | Object | No | Single image input. url takes a public image URL or a Base64 data URL |
images | Array | No | Multiple image input. Up to 4 images per question and 16 per request |
questions | Object | Yes | Question map. Keys are custom; values are question objects |
type field of a question supports choice (pick from options), noul (return a 0-to-1 probability), and score (rate against ordered levels). Use instructions for the judgment requirement and criteria for option or level definitions.
Response fields:
answers: Answers keyed by question ID.choice: The selected option forchoicequestions.noul: P(yes) fornoulquestions, from 0 to 1.score: The probability-weighted expected level index forscorequestions; it can fall between levels.probabilities: Probability of each option or level, summing to 1.confidence: Confidence forchoiceandscoreanswers.legend: Forscorequestions, a map from level index to level description.usage.input_tokens: Number of input tokens.request_id: Request ID for troubleshooting.latency_ms: Server-side latency in milliseconds.
Example: integrate comment moderation in Claude Code
Claude Code is used here as the example, integrating the decision model through a Slash Command. Other tools follow the same pattern; only the extension mechanism and config file path differ.
Step 1: Create a Slash Command
Configure the subscription API Key (prefixed with sk-sp-) as the environment variable $ANTHROPIC_AUTH_TOKEN for later curl authentication.
Create .claude/commands/review-comments.md in the project root with the following content:
Step 2: Moderate comments
Prepare a comments file comments.txt with one comment per line:
Enter /review-comments comments.txt in Claude Code. Example output:
Two things in the output are worth noting:
- #5 and #9 are criticism and an error report, both judged pass. The verdict reflects the nature of the content, not its tone. Criticism, questions, and error reports count as normal discussion, a rule written into
criteria. - #8 is a technical share with a link, confidence 0.93, auto-hidden at the 0.9 threshold. The content sits between sharing and solicitation, with spam probability 0.96 and pass probability 0.04. Confidence is above the threshold, so it is handled automatically. The threshold lives in step 4 of the Command: set it to 0.95 and this comment goes to human review; lower it to automate more. Clear boundary descriptions in
criteriahelp reduce such samples reaching human review.
Read the three response fields
Answers come back under the same keys used in questions. Each Choice answer contains:
| Field | Meaning | How to use it |
|---|---|---|
choice | The selected option | Branch basis: approve or hide |
probabilities | Probability of each option, summing to 1 | Display, sorting, weighting |
confidence | How sure, 0 to 1 | Threshold routing: high acts automatically, low goes to humans |
questions are custom and take no part in inference. For degree-style judgments, switch to Noul (returns a 0-to-1 probability) or Score (rates against levels); a single call can mix them.
Example: image judgment
decision-model supports image input. Pass an image URL in image and use it together with state for the judgment:
data:image/png;base64,...) before passing it. Use the images array for multiple images. Each question supports up to 4 images, and each request supports up to 16 images.
Other tools
The table below lists the extension mechanism and config file path for each tool, covering mainstream AI coding tools that support extension mechanisms. Save the Claude Code configuration above to the corresponding path.
| Tool | Extension mechanism | Config file path |
|---|---|---|
| Claude Code | Slash Command | .claude/commands/review-comments.md |
| Codex | Skill | ~/.codex/skills/token-plan-review/SKILL.md |
| Qwen Code | Skill | ~/.qwen/skills/review-comments/SKILL.md |
| OpenCode | Agent | .opencode/agents/review-comments.md |
| OpenClaw | Skill | ~/.openclaw/workspace/skills/token-plan-review/SKILL.md |
| Hermes Agent | Skill | ~/.hermes/skills/moderation/review-comments/SKILL.md |
| Qoder | Skill | ~/.qoder/skills/review-comments/SKILL.md |
Skill-based tools (Codex, Qwen Code, OpenClaw, Hermes Agent, Qoder) need YAML front matter at the top of the config file. The complete config file:
Notes
- Judgment boundaries live in
criteria. Describe borderline cases (such as technical shares with links) as explicit option descriptions; that works better than repeatedly rewording the question. - Split complex judgments: ask one specific question at a time, judge each dimension separately, and combine the results in the Command's routing rules.
- A low
confidenceis the model explicitly signaling uncertainty; routing to humans beats retrying. The 0.9 threshold is an example value, adjust it to your cost of misjudgment. - Handle failures by status code:
401check the API Key,422means request body validation failed (the response body names the offending field),429and529retry after backoff. - The model outputs a verdict and its certainty, not a guarantee of fact. Keep a human review step for high-risk actions such as account bans or fund handling.