数牛-nex-pro: agriculture vertical preset
A pre-tuned bundle of nex-pro + an agriculture-expert system prompt for
Chinese-language farming, supply-chain, and rural-economy questions. Holders of the
DNIU holder token get automatic discounts of up to 20% on every
request that names this preset.
/v1/holder/transactions.
1. Why a preset?
A preset is a curated (model, system prompt, tool chain, RAG corpus, discount rule)
bundle that ships with a single slug. Customers pass the slug as the model field
in /v1/chat/completions — everything else is server-side:
- The model name on the wire stays the same as a regular call, so OpenAI SDK clients work without modification.
- The preset's system prompt is injected automatically — the customer's own system message (if any) is preserved and prepended inside, so calling intent stays intact.
- If a RAG corpus is bound, the relevant chunks are retrieved and inserted as additional context before your user message.
- If you hold the required holder token at the required threshold, the bill is automatically discounted.
2. Call the preset
Use the OpenAI Python SDK pointed at NexToken — no other changes:
from openai import OpenAI
client = OpenAI(
api_key="sk-nex-...", # your NexToken API key
base_url="https://api.nextoken.biz/v1",
)
resp = client.chat.completions.create(
model="数牛-nex-pro", # ← preset slug
messages=[
{"role": "user", "content": "海南三月种水稻合适吗?要注意什么?"},
],
)
print(resp.choices[0].message.content)
The reply will be grounded by the agriculture-expert framing and will reference
public 农业农村部 data where applicable. The customer-facing model name in resp.model
is the resolved upstream model (currently nex-pro) — the preset id is recorded
in your usage record + audit log for auditing, but isn't echoed in the OpenAI response.
3. Auto-applied discount
The 数牛-nex-pro preset's discount config:
| DNIU you hold | Discount |
|---|---|
| < 100 | 0% (full price) |
| ≥ 100 | 10% off |
| ≥ 1000 | 20% off |
The discount engine runs at billing time, reads your user_holder_balances row,
walks the tiered config, and applies the highest qualifying rate. No flag to set, no
field to pass in the request — it just works if you qualify.
4. Check your eligibility
The /v1/holder endpoints surface what you have and what you qualify for:
import requests
BASE = "https://api.nextoken.biz/v1"
HEADERS = {"Authorization": f"Bearer sk-nex-..."}
# Tokens you hold
balances = requests.get(f"{BASE}/holder/balances", headers=HEADERS).json()
print(balances["balances"])
# [{"holder_token_code": "DNIU", "balance": "500", "granted_via": "admin", ...}]
# Presets you qualify for + the pct you'd receive
eligible = requests.get(f"{BASE}/holder/eligible-presets", headers=HEADERS).json()
print(eligible["presets"])
# [{"preset": {"id": "数牛-nex-pro", ...},
# "required_holder_token": "DNIU",
# "your_balance": "500",
# "effective_discount_pct": "0.10"}]
5. Audit the savings
Every time the discount engine takes effect, a PRESET_DISCOUNT_APPLIED audit
row is written. Read your savings history through:
tx = requests.get(f"{BASE}/holder/transactions?limit=20", headers=HEADERS).json()
for row in tx["data"]:
saved = float(row["base_amount_usd"]) - float(row["discounted_amount_usd"])
print(f"{row['applied_at']} preset={row['preset_id']} "
f"−{row['discount_pct']} saved=${saved:.6f}")
Or open the Holder Portal in the dashboard — the Savings History tab paginates the same data with running totals.
6. Browse other presets
数牛-nex-pro is one of an expanding set of vertical presets. Browse the
Preset Store for the full catalogue, or list programmatically:
r = requests.get(f"{BASE}/presets", headers=HEADERS).json()
for p in r["presets"]:
print(p["id"], "—", p["display_name"], "—", p["vertical"])
# 数椰-nex-pro — 数椰 / Tropical Crop (nex-pro) — 热带农业
# 数牛-nex-pro — 数牛 / Agriculture (nex-pro) — 农业
7. Putting it together
Full minimal example, suitable for an agriculture support bot:
from openai import OpenAI
import requests
API_KEY = "sk-nex-..."
BASE = "https://api.nextoken.biz/v1"
client = OpenAI(api_key=API_KEY, base_url=BASE)
def ask_agri_expert(question: str) -> dict:
"""Ask the 数牛-nex-pro vertical preset, return answer + cost."""
resp = client.chat.completions.create(
model="数牛-nex-pro",
messages=[{"role": "user", "content": question}],
)
return {
"answer": resp.choices[0].message.content,
"usage": resp.usage.model_dump() if resp.usage else None,
}
result = ask_agri_expert("海南春季芒果裂果的常见原因?")
print(result["answer"])
print("Tokens used:", result["usage"])
# Look up the actual price paid after discount (asynchronously
# arrives in the audit log a few seconds after the call):
tx = requests.get(
f"{BASE}/holder/transactions?limit=1",
headers={"Authorization": f"Bearer {API_KEY}"},
).json()
if tx["data"]:
last = tx["data"][0]
print(f"Discount applied: {last['discount_pct']} paid ${last['discounted_amount_usd']}")
FAQ
Will my own system prompt still be used?
Yes — if you pass a system message in messages, your content is
prepended inside the preset's system message rather than being replaced. Order:
preset framing first (broad context), your specifics after (specific intent). One system
role total.
What if I pass my own tools?
Explicit caller intent always wins — if you pass tools (non-empty), the
preset's tool chain is skipped entirely. Pass tools=[] or omit to use the
preset's tools (if any).
How is the discount calculated for combined rules?
The discount engine is capped at 0.95 defensively — even a config typo
that says "1.5 fixed_pct" can't make calls free. The "Reference" docstring on
app/services/discount.py documents the cap and gating logic.
Can I see the system prompt before I call?
Yes — the public catalog endpoint returns it. GET /v1/presets/数牛-nex-pro
surfaces system_prompt, tool_chain, and discount_config.
Presets are intentionally transparent — there's no proprietary moat in the prompt itself.