XianYuApis — Xianyu Messaging Backend for AI Agents
A Python SDK that reverse-engineers Xianyu's private-message protocol so your AI support agent can reply 24/7.
- Source repo
- cv-cat/XianYuApis
- Stars
- ★ 1.8k
- Last updated
- 3mo ago
- FARS reviewed
- Nov 26, 2026
- Primary language
- JavaScript
- FA score
- 29/100 · Major gaps
At a glance
- How it runs
- Works with
- Portable with changes
- Cost
- Free, no paid service needed
- Setup effort
- Medium · a few setup steps
- You'll need
- Typical use
- Xianyu sellers who want GPT, Claude or a local model to answer buyer DMs overnight and on holidays.
- Not a fit if
- Sellers who need officially authorized APIs and cannot accept ban risk
- Developers without a Xianyu seller account and login cookie
- Maintenance
- Commits in the last 6 monthslast commit 2026-08-18
- Source review
- 29/100 · Major gaps 3 safety controls not found
What does this agent do, and when should you use it?
XianYuApis is an unofficial Python integration library for Xianyu (goofish.com), built as the messaging substrate for AI customer-service agents. It reverse-engineers the platform's WebSocket direct-message protocol (sign signature, base64, Protobuf) and wraps HTTP endpoints for login, token refresh, item details and media upload, with the sign parameter already decrypted. The repo is organized around goofish_live.py (WebSocket listener and reply entry point), goofish_apis.py (HTTP wrappers), message/types.py (TextContent, ImageContent, AudioContent) and utils/goofish_utils.py (signing, cookie handling, decryption). You plug in your own model by replacing the reply logic inside handle_message — GPT, Claude, Qwen or a local model all work. Running it needs Python 3.9+ and Node.js 18+ (to execute the reverse-engineered JS signing code), plus a logged-in browser cookie. It is not an official API and carries platform-policy and legal risk.
The process reads the login cookie you paste at the bottom of goofish_live.py, keeps the session alive and auto-refreshes the token through helpers in goofish_apis.py, then opens a long-lived WebSocket to Xianyu's direct messages. Each incoming frame goes through sign verification, base64 decoding and Protobuf deserialization to extract sender ID, conversation ID (cid) and message body. The parsed payload is handed to handle_message in goofish_live.py, where you substitute an LLM, RAG pipeline or rule engine call; the result is wrapped via make_text into TextContent or ImageContent and pushed back with send_msg. The library also fetches full chat history with a given user, lists conversations, retrieves item details, uploads images before sending, and obtains a cookie through QR-code login.
- Xianyu sellers who want GPT, Claude or a local model to answer buyer DMs overnight and on holidays.
- Developers building a RAG-backed second-hand goods support bot on top of Xianyu messaging.
- Operations teams that need to pull and analyze historical chat logs for inquiry conversion.
- Indie developers automating follow-ups or delivery notices inside Xianyu conversations.
- Engineers studying a real-world WebSocket + Protobuf + JS-signature reversal pattern.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
pip install -r requirements.txt
- Runtime
- Python 3.9+ · Node.js 18+
How do you install or deploy this agent?
Requires Python 3.9+ and Node.js 18+ (the latter executes the signing algorithm). After cloning, install the Python dependencies:
pip install -r requirements.txtThe repo also ships a Dockerfile for building your own image; the README gives no explicit build or run command for it.
How do you use this agent?
Log in to goofish.com, copy the full cookie string from your browser developer tools (it must be a logged-in session) and set it at the bottom of goofish_live.py:
cookies_str = r'your_cookie_string_here'Then start the main entry point to connect the WebSocket and listen for DMs:
python goofish_live.pyTo attach an AI model, replace the sample echo reply inside handle_message:
async def handle_message(self, message, websocket):
# ... 解析 send_user_id, cid, send_message ...
# 原始 echo 回复(示例)
# reply = f'{send_user_name} 说了: {send_message}'
# 接入 AI 大模型(示例)
reply = await your_ai_agent(send_message) # GPT / Claude / Qwen / 本地模型
await self.send_msg(websocket, cid, send_user_id, make_text(reply))Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
FARS trust-control audit
- confirmation before acting — Turn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
- sensitive-data handling — Use dedicated, low-privilege, revocable API keys — never production credentials — and keep secrets out of logs.
- rollback or recovery path — Back up first, or work on a git branch or snapshot, so its changes can be undone.
What are this agent's strengths and limitations?
- Hides the three-layer sign/base64/Protobuf protocol so you only write reply logic.
- Message layer covers text and image send/receive, history retrieval, proactive messaging and automatic token refresh.
- handle_message is a single, clean integration point that does not lock you to any model vendor.
- Several downstream agent projects are listed as working examples to learn from.
- Built on reverse-engineered private endpoints; the protocol can change or break without notice and no compatibility guarantee is given.
- Requires manually pasting a login cookie — there is no OAuth flow, and an expired cookie or risk control silently stops message intake.
- The repository license is listed as unknown (README badge says MIT but no LICENSE file backs it), so commercial use rights are unclear.
- Setup docs stop at pip install; Docker build, process supervision and retry behavior are undocumented.
How does this agent compare with similar options?
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| XianYuApis — Xianyu Messaging Backend for AI Agents This agent | 29 · Major gaps | Library / SDKFree | ★ 1.8k | 3mo ago | JavaScript | — |
| Parlant Conversation Control | 66 · Some gaps | Library / SDKFree + model costs | ★ 18k | 1d ago | Python | OpenAI API · Claude API |
| REA: Reverse Engineer Anything with Agents | 84 · Good | CLIFree | ★ 478k | today | TypeScript | Codex · Claude Code · Claude.ai |
| PowerContext | 82 · Good | CLIFree | ★ 1.8k | today | Python | Codex · Claude Code |
How does FollowAgents rate this agent?
Why each dimension lost points
README instructs users to hardcode a full login Cookie into goofish_live.py with no encryption, scoping, or cleanup guidance, so sensitive_data_handling scores 0; there is no confirmation or human-review step before auto-replies, so user_confirmation scores 0; data flow is only a diagram with no statement of where Cookie/message data goes or whether it leaves the host, so data_flow_transparency scores 1; dependencies are only requests and loguru with no pinned versions, so dependency_security scores 1; external effects (auto-sending messages, media upload) have no rollback or undo mechanism, so rollback scores 0; the README mentions reverse-engineered protocols without citing protocol source or legal basis, so source_attribution scores 1.
The feature table and project structure are broadly self-consistent, but no error handling, retry, or failure messaging is described, so failure_messages scores 0; dependency availability rests on two unpinned packages in requirements.txt, so dependency_availability scores 1; self_consistency scores 1 because the feature table matches the structure but lacks code corroboration.
The README clearly targets Xianyu sellers and AI Agent developers, so audience_and_scenarios scores 2; capability boundaries (platform risk control, account bans, message rate limits) are not stated, so capability_boundaries scores 1; trigger conditions for auto-reply are left entirely to the user, so trigger_precision scores 1; Python 3.9+/Node 18+ are stated but the Node signing script invocation and platform compatibility are not explained, so environment_fit scores 1.
The README has a clear project structure and quick start, so information_architecture scores 2; install notes are a single pip install line missing Node dependency setup and signing-script configuration, so install_notes scores 1; naming is stable but there is no version number or changelog, so versioning_changelog scores 0; examples are one pseudocode snippet, so examples_and_faq scores 1; known limitations and risks are not listed, so known_limitations scores 0; the README badge claims MIT but license metadata is unknown, so license scores 1; maintenance responsibility points only to the author's homepage and chat groups, so maintenance_responsibility scores 1.
Output usability depends on the user wiring in their own AI; the repo only provides low-level send/receive, so output_usability scores 1; it has real marginal value for building a Xianyu AI customer-service bot but requires handling risk control and compliance yourself, so marginal_value scores 1; cost-benefit is uncertain because maintaining reverse-engineered signing and Cookies raises long-term stability concerns, so cost_benefit scores 1.
The README claims 'sign decrypted' and 'all HTTP interfaces' without corresponding code or tests, so claim_traceability scores 1; the list of downstream projects offers some cross-source corroboration but all are third-party, so cross_source_corroboration scores 1; facts and inferences are not clearly separated (e.g., 'stable' and 'reliable' are assertions), so fact_inference_separation scores 1.
- Not found in source: confirmation before actingTurn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
- Not found in source: sensitive-data handlingUse dedicated, low-privilege, revocable API keys — never production credentials — and keep secrets out of logs.
- Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
- The README requires hardcoding a full login Cookie in plaintext into source, risking credential leakage and account takeover; use environment variables or a secret manager instead.
- Auto-replies and proactive messaging have no human confirmation or rate limiting, which may trigger platform risk control, account bans, or user harassment.
- The project is built on reverse-engineered Xianyu protocols and may violate platform terms of service; assess legal and compliance risk before commercial use.
- Dependencies are unpinned and signing relies on a Node.js script, so environment changes may break functionality.
- License metadata is unknown; the README badge claims MIT but this is not confirmed in the package, so verify authorization before use.
FAQ
Is there a fee to use this library?
Why is Node.js required?
Will the cookie expire?
Can my Xianyu account get banned?
Can I use a local model instead of a cloud API?
Is XianYuApis — Xianyu Messaging Backend for AI Agents free?
Is XianYuApis — Xianyu Messaging Backend for AI Agents open source?
Is XianYuApis — Xianyu Messaging Backend for AI Agents safe to use?
Is XianYuApis — Xianyu Messaging Backend for AI Agents still maintained?
Who makes XianYuApis — Xianyu Messaging Backend for AI Agents?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.