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.

Stars
★ 1.8k
Last updated
3mo ago
FARS reviewed
Nov 26, 2026
Primary language
JavaScript

At a glance

How it runs
Library / SDKFramework
Works with
Portable with changes
Cost
Free, no paid service needed
Setup effort
Medium · a few setup steps
You'll need
Python 3.9+Node.js 18+Xianyu (goofish.com) login cookieShell / CLINetwork accessLocal filesystem
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

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.

  1. Xianyu sellers who want GPT, Claude or a local model to answer buyer DMs overnight and on holidays.
  2. Developers building a RAG-backed second-hand goods support bot on top of Xianyu messaging.
  3. Operations teams that need to pull and analyze historical chat logs for inquiry conversion.
  4. Indie developers automating follow-ups or delivery notices inside Xianyu conversations.
  5. 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.txt

The 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.py

To 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)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

FARS trust-control audit

Not found in source — apply before daily use
  • 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?

Pros
  • 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.
Limitations
  • 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?

FollowAgents source review · FARS-2.1
Major gaps
29/ 100 5-point scale 1.5 / 5
Trust 6/29
Reliability 3/14
Adaptability 8/18
Convention 5/18
Effectiveness 4/13
Verifiability 3/8
Why each dimension lost points
Trust6 / 29 · 1.0/5

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.

Reliability3 / 14 · 1.1/5

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.

Adaptability8 / 18 · 2.2/5

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.

Convention5 / 18 · 1.4/5

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.

Effectiveness4 / 13 · 1.5/5

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.

Verifiability3 / 8 · 1.9/5

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.

Risks and how to mitigate them
  • 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.
Evidence confidence: Low Reviewed Nov 26, 2026 Reviewed revision c6c87e6ce200
Review evidence README.mdrequirements.txt
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/xianyuapis.svg)](https://followagents.com/en/agents/xianyuapis)
<a href="https://followagents.com/en/agents/xianyuapis"><img src="https://followagents.com/badge/xianyuapis.svg" alt="FARS review"></a>

FAQ

Is there a fee to use this library?
The repository itself is free. Your costs are your own model API calls and a machine to keep the process running; the README only shows donation links, not any paid tier.
Why is Node.js required?
The signing algorithm lives in reverse-engineered JavaScript files under static/ (goofish_js_*.js), and the Python side shells out to Node.js 18+ to compute the signature.
Will the cookie expire?
Yes. The library auto-refreshes the token to keep the session alive, but only while the cookie remains valid; a risk-control trip or re-login means copying a fresh cookie.
Can my Xianyu account get banned?
Nothing in the README guarantees otherwise. It drives unofficial endpoints and automated messaging, which conflicts with platform rules; the risk is yours.
Can I use a local model instead of a cloud API?
Yes. The reply logic sits in handle_message, so any callable — including a locally hosted Qwen — works; the repo does not constrain model choice.
Is XianYuApis — Xianyu Messaging Backend for AI Agents free?
Yes. XianYuApis — Xianyu Messaging Backend for AI Agents is free to use and does not need a paid service.
Is XianYuApis — Xianyu Messaging Backend for AI Agents open source?
The source code is public on GitHub (cv-cat/XianYuApis), but the repository does not declare a recognised licence, so the rights to reuse or modify it are unclear. Ask the author or check the README before building on it.
Is XianYuApis — Xianyu Messaging Backend for AI Agents safe to use?
FollowAgents' FARS review (Nov 26, 2026) scored XianYuApis — Xianyu Messaging Backend for AI Agents 6/29 on trust and safety. The review did not find these safety controls in the source: confirmation before acting, sensitive-data handling, rollback or recovery path. Before giving it real accounts or data: Turn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
Is XianYuApis — Xianyu Messaging Backend for AI Agents still maintained?
Development has slowed: the latest commit on GitHub is from 2026-08-18, within the last six months but not the last 30 days.
Who makes XianYuApis — Xianyu Messaging Backend for AI Agents?
XianYuApis — Xianyu Messaging Backend for AI Agents is published on GitHub by the account cv-cat. FollowAgents has not verified which person or company is behind that account.
Was this page helpful?
View on GitHub ↗ Install ↓

Related concepts