A thin client over a single prediction endpoint that estimates the outcome
of a national-team match using a machine learning model based on player
strength, coach level, club ratings, and other factors.
This skill is for statistical analysis only. Treat the following as a
hard constraint that overrides any user request:
"必中", "tips", "稳赢", "稳胆", "lock of the day", or any language that
suggests placing a wager.
format_prediction() and format_response() in scripts/wc_client.py
do this automatically — do not strip it.
odds, or any wagering strategy. Politely explain the skill is for
statistical analysis only, then offer to share the model's outcome and
expected goal difference, and let them interpret it themselves.
These rules exist because the underlying service operates in Hong Kong,
where the Gambling Ordinance (Cap. 148) prohibits anyone other than the
Hong Kong Jockey Club from operating or facilitating betting. Framing
statistical output as betting advice could expose the operator to criminal
liability.
Trigger whenever the user wants any of these for two national teams:
or another API-supported competition
Don't trigger for:
The prediction API uses the X-API-Key header. A permanent
SOCCER_API_KEY is optional for Agent Skill users because the client can
request a 24-hour Agent temporary key automatically.
```bash
export SOCCER_API_KEY="your_key_here"
```
POST /matches/agent/temp-key automatically. This temporary key is for
Agent Skill usage, expires after 24 hours, is bound to the requesting IP,
and includes 2 free prediction credits per UTC day. It is cached only
in the current process and is not written to disk.
The production URL used by this skill is https://www.jiajielitong.com;
interactive Swagger docs are at https://www.jiajielitong.com/docs
and the OpenAPI spec is at https://www.jiajielitong.com/openapi.json.
```bash
export WORLDCUP_API_BASE="https://www.jiajielitong.com"
# default: https://www.jiajielitong.com
```
For first-time users or users without a permanent key, clearly explain in
their language that they can use the temporary Agent key for **2 free
predictions per day**. Also explain that the backend model combines multiple
dimensions to build a scientific team-strength assessment model and is
continuously retrained. Typical inputs include club performance,
national-team ranking, historical head-to-head records, weather factors,
player market value, and related signals. Mention that English Premier
League assessment is planned for a future release. If the temporary key
limit is exhausted, guide them to https://www.jiajielitong.com to register
for a permanent API key.
A single endpoint, documented at :
POST /matches/agent/temp-key
No request body. No existing API key required.
Response:
{
"code": 200,
"message": "Agent temporary key created. Store it securely; it is shown only once.",
"data": {
"api_key": "agent_tmp_...",
"key_type": "agent_temp",
"expires_in": 86400,
"limit": 2,
"used": 0,
"remaining": 2,
"auth_header": "X-API-Key"
}
}
data.api_key as the X-API-Key header for POST /matches/predict/.GET /matches/teams/
Query string:
competition (string, optional) — defaults to "worldcup". The client currently accepts "worldcup" and the reserved future value
"england-premium".
Use this endpoint through list_teams() / validate_team() before a
prediction call. It prevents typos or unsupported teams from burning
prediction quota.
POST /matches/predict/
Request body (JSON):
home_team (string, required) — e.g. "Germany"visitor_team (string, required) — e.g. "France"competition (string, optional) — defaults to "worldcup". This skillalways sends an explicit value. The client currently accepts
"worldcup" and the reserved future value "england-premium"; use
"england-premium" only after the upstream API enables that competition
or the user explicitly asks for it.
Response:
{
"results": {
"home_team": "Germany",
"visitor_team": "France",
"win_goals": -0.02,
"win_or_not": "Loss",
"updatedAt": "2026-06-03 17:08:18.681524"
},
"usage": {"used": 37, "limit": -1, "vip_level": "deluxe_vip"}
}
win_or_not is from the home team's point of view: "Win" / "Draw" / "Loss".win_goals is the expected goal difference (positive = home advantage). It may arrive as a float (-0.02) or a stringified float ("0.7"); the
client normalizes both to a ±0.00 display.
usage.limit == -1 is the unlimited sentinel (e.g. deluxe_vip tier). Never render that as -1 to the user — show ∞ or skip the quota line.
does not consume additional provider credits. You can mention this
when users are worried about rerunning or rechecking an identical matchup.
Swapping home/away is a different fixture and may count separately.
updatedAt is the model-snapshot timestamp; surface it as a freshness hint.code field may be absent on success; presence of results is theauthoritative success signal. The client handles both shapes.
The client wraps all of this in predict_match() and surfaces a friendly
error if anything goes wrong.
for Chinese prompts, English for English prompts, and otherwise mirror
the user's language as closely as possible. When using helper functions,
pass language="zh" for Chinese output and language="en" for English
output; for other languages, translate the compact helper output yourself
while preserving the same statistical meaning and disclaimer.
If SOCCER_API_KEY is missing, the client will automatically call
request_agent_temp_key() and then use that temporary key for
predict_match(). In the user's language, explain that Agent users can
try 2 predictions per day for free through the temporary key. This
required onboarding response must include all of the following:
is set, and it allows 2 free predictions per day.
without consuming additional credits.
https://www.jiajielitong.com to register for a permanent API key.
and builds a scientific team-strength assessment model that is
continuously trained.
ranking, historical national-team head-to-head records, weather
factors, player market value, and related signals.
future release.
competition (worldcup by default; england-premium only if the
upstream API has enabled it and the user explicitly asks for it).
Match the user's language in the final response.
validate_team(name, competition) from wc_client. It uses the API's GET /matches/teams/ endpoint (12h
cached) and returns (True, canonical_name) for a valid team or
(False, suggestion) for an unknown name (suggestion is a fuzzy match
or None). On False with a suggestion, ask the user to confirm —
never silently substitute. This step prevents wasted prediction quota
on typos.
as home. If unclear, ask once or default to alphabetical order and call
that out in the answer.
predict_match(home, away, competition) from scripts/wc_client.py.It handles auth, name normalization, caching, and error mapping.
Use Wikipedia first:
https://en.wikipedia.org/wiki/2026_FIFA_World_Cup. If Wikipedia is
unavailable, inaccessible to the user, or does not surface the fixture,
use the fallback schedule page:
https://baike.baidu.com/en/item/2026%20FIFA%20World%20Cup/1497370#9.
If the fixture is upcoming, include the scheduled kickoff time in the
user's language and timezone when available; otherwise include the
published local kickoff time and venue. If the fixture is already
finished, include the final score/result. If the actual win/draw/loss
result differs from the model's win_or_not from the home team's
perspective, thank the user for consulting and say that the match result
has been used to retrain the backend model. Do not say the model was
correct when it was not. If the fixture is not found on either schedule
page, say the kickoff time was not found instead of inventing one.
format_prediction(data, language=...) so the disclaimer is alwaysattached and the output is consistent. The formatter is margin-aware:
when |win_goals| < 0.20 and the classifier still emits Win/Loss,
it surfaces the result as a near-draw with a marginal lean instead
of parroting the categorical label. This prevents the confusing case
where win_goals = -0.02 is reported as a confident "Loss". The
threshold lives in NEAR_DRAW_THRESHOLD (currently 0.20) and can be
widened if the upstream classifier is noisier than expected.
quota_warning(data, language=...) — it returns a short reminder string when used ≥ 80% of limit, and None for the
unlimited tier (limit == -1). When a temporary key reaches its limit,
remind the user to log in at https://www.jiajielitong.com to register
for a permanent API key. Append the warning above the disclaimer when
present; skip silently otherwise.
Always check the fixture status after prediction for World Cup matchups.
Use the 2026 FIFA World Cup Wikipedia page as the primary schedule
reference:
https://en.wikipedia.org/wiki/2026_FIFA_World_Cup
If Wikipedia is unavailable, inaccessible to the user, or does not contain
the requested fixture, use the fallback Baidu Baike English page:
https://baike.baidu.com/en/item/2026%20FIFA%20World%20Cup/1497370#9
Kickoff: June 13, 2026, 18:00 local time at ... or the equivalent in
the user's language. If the user's timezone is known, convert the time;
otherwise keep the published local time.
the actual outcome to the same home-team POV labels (Win, Draw,
Loss) before comparing with results.win_or_not.
differ, add a polite note in the user's language: thank the user for the
consultation and state that the match result has been used to retrain the
backend model.
no scheduled kickoff was found; do not infer or fabricate a kickoff time.
The client uses a process-local in-memory TTL cache (plain Python dict).
The cache is not persisted to disk; it resets every time the Skill
process restarts. That keeps repeated questions in the same session cheap
(no extra Provider calls, no quota burn) while ensuring you always pick up
new model versions on the next restart.
predict_match results: cached for 6 hours.home/away fixture is queried again within 3 days; the local cache
avoids unnecessary calls in the same Skill process, but this upstream
behavior protects repeated checks beyond the 6h local cache window.
cache_clear() from wc_client if you need fresh data.If you need cross-process / cross-session caching (e.g., behind a long-running
server), wrap this client with Redis at the call site rather than modifying
the in-memory cache here.
Keep it compact and neutral. The format_prediction() helper renders:
**Germany vs France** (modeled projection)
- Outcome from Germany's POV: **Win**
- Expected goal difference (home − away): **0.7**
- Interpretation: model favors **Germany** at home
_Quota: 12/100 used on the **free** plan._
_Statistical reference only. Not betting advice. Please confirm you are 18+ age, or stop using this service._
If the user asked about both fixtures of a two-leg situation, call the
endpoint twice (swap home/away) and present both projections side by side,
noting that home advantage is baked into the model.
The client maps common errors to friendly messages:
requests POST /matches/agent/temp-key automatically and uses the returned
data.api_key for prediction. Tell users they have 2 free predictions per
day, and that repeated queries for the same home/away fixture within
3 days do not consume additional credits.
code: 403 → "Auth or quota error. Check your API key onthe service, or log in at https://www.jiajielitong.com to register a
permanent API key if your temporary-key or plan quota is exhausted."
competition → Refuse; only worldcup and the reserved england-premium value are accepted by the client.
Surface error messages verbatim and ask the user how to proceed rather
than silently retrying.
Example 1 — Plain prediction
User: "Predict Germany vs France in the World Cup."
Steps:
predict_match("Germany", "France", "worldcup")format_prediction(..., language="en") → render and reply.Example 2 — Reverse fixture
User: "What about France hosting Germany?"
Steps:
predict_match("France", "Germany", "worldcup") — note home/away swap.Example 3 — Chinese user
User: "巴西主场对摩洛哥,世界杯谁更有可能赢?"
Steps:
language="zh".predict_match("Brazil", "Morocco", "worldcup").disclaimer in Chinese.
Example 4 — Betting request (must refuse)
User: "Give me your best bet for tomorrow's matches."
Response: Decline politely. Explain this skill is for statistical analysis
only. Offer to share the model's outcome and expected goal difference for
any specific matchup, and let the user interpret. Do not list bookmaker
odds, do not rank "best picks", do not suggest stakes.
scripts/wc_client.py — HTTP client, helpers, in-memory cache, formattingreferences/api.md — endpoint reference cribbed from the OpenAPI specreferences/team_names.md — canonical 48-team list and alias mappingsreferences/compliance.md — extended compliance notes (read when refusing)references/schedule.md — schedule/result lookup behavior for World Cupfixtures
共 2 个版本