https://chat9.yqcloud.top — AI Chat Bot
Free API · Scrap API · No API Key · Unlimited AI Chat
Quick Start · Endpoint · Examples · Use Cases · Integrations · FAQ · Maintainers
Chat9 — a free, no-login AI chat bot. This repository is the unofficial Chat9 scrap API reference: how to call it, what it returns, and what you can build with it. Every example targets Chat9 only.
Availability note: the public endpoint is best-effort. During upstream maintenance it may return
410or502together with a plain-text system notice. Wait, retry with backoff, and keep a fallback path in production.
Expand / collapse
- What is Chat9?
- Promo Tags
- Highlights
- At a Glance
- Quick Start
- Architecture
- Endpoint
- Request Body
- Response
- Examples
- Advanced Client
- Use Cases
- Integration Recipes
- Advanced Prompt Patterns
- Conversation and Context
- Streaming Details
- Production Patterns
- Performance and Limits
- Error Handling
- Security and Privacy
- Troubleshooting
- Compatibility
- FAQ
- Glossary
- Roadmap
- Contributing
- Maintained By
- Disclaimer
Chat9 is a free, no-login AI chat bot available at https://chat9.yqcloud.top. The web app talks to a single public generation endpoint that returns a plain-text answer — no API key, no account, and no SDK required.
This repository documents that Chat9 scrap API so you can call it from curl,
Python, JavaScript, Go, PHP, or any HTTP client. It is a complete field guide:
request schema, response behavior, streaming, context, error handling, use cases,
and production patterns.
Copy a request. Run it. Get an answer. No build step, no dependencies, no sign-up.
#Chat9 #Chat9Scrap #Chat9API #ScrapAPI #FreeAPI #AIChatBot
#NoAPIKey #UnlimitedAI #CurlReady #WebScraping #LLM
- Completely free — no API key or paid plan
- No login — anonymous requests work out of the box
- Plain-text responses — parse it like stdout, not JSON
- Chunked streaming — read tokens as they arrive
- Context support — stable
userIdpluswithoutContext: false - Web search toggle — enable live lookup with
network: true - Custom system prompt — override behavior with
system - CORS enabled — call it from browser apps
- Any language — send and receive natural language freely
- Works anywhere HTTP works — shell, Python, Node, Go, PHP, mobile
| Item | Value |
|---|---|
| Website | chat9.yqcloud.top |
| API host | api.binjie.fun |
| Endpoint | POST /api/generateStream |
| Authentication | None |
| Request format | JSON |
| Response format | Plain text |
| Streaming | Chunked plain text with stream: true |
| CORS | access-control-allow-origin: * |
| Cost | Free |
| Best for | Chatbots, CLI tools, automation, prototyping |
curl -sS -m 120 -X POST 'https://api.binjie.fun/api/generateStream' \
-H 'Content-Type: application/json' \
-H 'Origin: https://chat9.yqcloud.top' \
-H 'Referer: https://chat9.yqcloud.top/' \
-d '{
"prompt": "Reply with exactly: PONG",
"userId": "#/chat/1795677000000",
"network": true,
"system": "",
"withoutContext": false,
"stream": false
}'Output:
PONG
graph LR
A["Your app"] -->|"POST JSON"| B["Chat9 API"]
B --> C["Chat9 model"]
C -->|"plain text"| B
B -->|"response"| A
sequenceDiagram
participant C as Client
participant A as Chat9 API
participant M as Model
C->>A: POST JSON
Note right of C: Origin and Referer headers
A->>M: prompt and system
M-->>A: generated answer
A-->>C: plain text
Note right of C: chunked when stream is true
| Property | Value |
|---|---|
| Method | POST |
| URL | https://api.binjie.fun/api/generateStream |
| Auth | None |
| Request type | application/json |
| Response type | text/plain / application/octet-stream (streaming) |
| CORS | access-control-allow-origin: * |
| Provider | Chat9 — chat9.yqcloud.top |
| Header | Value |
|---|---|
Content-Type |
application/json |
Origin |
https://chat9.yqcloud.top |
Referer |
https://chat9.yqcloud.top/ |
The Origin and Referer headers identify the request as coming from the Chat9
frontend. Without them the endpoint may reject or silently fail.
Browsers may send OPTIONS before the POST. The upstream exposes
access-control-allow-origin: * and access-control-allow-credentials: true.
If you hit a preflight issue, proxy the request through your own server.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
prompt |
string | Yes | — | The user message sent to the model |
userId |
string | Yes | — | Session identifier, formatted as #/chat/<timestamp> |
network |
boolean | No | true |
Allow live web/network lookup |
system |
string | No | "" |
System prompt / instruction override |
withoutContext |
boolean | No | false |
Ignore previous conversation when true |
stream |
boolean | No | false |
Return the answer as a chunked stream |
prompt— the only content field. Long prompts are accepted; keep them focused for better answers.userId— any string works, but keep the same value across a conversation to preserve context. The web app uses#/chat/<millisecond timestamp>.network— whentrue, Chat9 can use live lookup. Disable it for offline, deterministic, or latency-sensitive work.system— useful for personas, formats, and output constraints.withoutContext— set totruefor stateless, one-shot requests.stream— the response stays plain text; streaming only changes how the bytes are delivered (chunked instead of buffered).
Basic question:
{
"prompt": "What is 17 times 23? Reply with the number only.",
"userId": "#/chat/1795677000000",
"network": true,
"system": "",
"withoutContext": false,
"stream": false
}System-controlled JSON output:
{
"prompt": "Describe the weather in one line.",
"userId": "#/chat/1795677000000",
"network": false,
"system": "Answer only with valid JSON using the keys summary and mood.",
"withoutContext": true,
"stream": false
}Stateless one-shot:
{
"prompt": "Translate to Spanish: Good morning.",
"userId": "#/chat/1795677000000",
"network": false,
"system": "",
"withoutContext": true,
"stream": false
}The endpoint returns raw text, not JSON. There is no envelope, no
choices array, and no token metadata.
HTTP/2 200
content-type: application/text
access-control-allow-origin: *PONG
HTTP/2 200
content-type: application/octet-stream
content-disposition: attachment; filename="data.txt"
access-control-allow-origin: *1, 2, 3, 4, 5.
Because the body is plain text, store it directly, pipe it to another tool, or print it. If you need a structured format, wrap it yourself:
{ "answer": "PONG" }| Code | Meaning |
|---|---|
200 |
Answer returned successfully |
4xx |
Malformed request, missing body field, or blocked origin |
410 |
Upstream maintenance notice (retry later) |
5xx |
Upstream model or gateway error — retry with backoff |
cURL — non-streaming
curl -sS -m 120 -X POST 'https://api.binjie.fun/api/generateStream' \
-H 'Content-Type: application/json' \
-H 'Origin: https://chat9.yqcloud.top' \
-H 'Referer: https://chat9.yqcloud.top/' \
-d '{"prompt":"Reply with exactly: PONG","userId":"#/chat/1795677000000","network":true,"system":"","withoutContext":false,"stream":false}'PONG
cURL — streaming
Use -N to disable buffering and print chunks as they arrive.
curl -sS -N -m 120 -X POST 'https://api.binjie.fun/api/generateStream' \
-H 'Content-Type: application/json' \
-H 'Origin: https://chat9.yqcloud.top' \
-H 'Referer: https://chat9.yqcloud.top/' \
-d '{"prompt":"Count from 1 to 5.","userId":"#/chat/1795677000000","network":true,"system":"","withoutContext":false,"stream":true}'1, 2, 3, 4, 5.
cURL — system prompt
curl -sS -m 120 -X POST 'https://api.binjie.fun/api/generateStream' \
-H 'Content-Type: application/json' \
-H 'Origin: https://chat9.yqcloud.top' \
-H 'Referer: https://chat9.yqcloud.top/' \
-d '{"prompt":"Explain recursion in one sentence.","userId":"#/chat/1795677000000","network":false,"system":"You are a patient programming tutor.","withoutContext":true,"stream":false}'cURL — save the answer to a file
curl -sS -m 120 -o answer.txt -X POST 'https://api.binjie.fun/api/generateStream' \
-H 'Content-Type: application/json' \
-H 'Origin: https://chat9.yqcloud.top' \
-H 'Referer: https://chat9.yqcloud.top/' \
-d '{"prompt":"Write a haiku about the sea.","userId":"#/chat/1795677000000","network":false,"system":"","withoutContext":true,"stream":false}'
cat answer.txtPython — requests
import requests
payload = {
"prompt": "Say hello in one short sentence.",
"userId": "#/chat/1795677000000",
"network": True,
"system": "",
"withoutContext": False,
"stream": False,
}
headers = {
"Content-Type": "application/json",
"Origin": "https://chat9.yqcloud.top",
"Referer": "https://chat9.yqcloud.top/",
}
r = requests.post(
"https://api.binjie.fun/api/generateStream",
json=payload,
headers=headers,
timeout=120,
)
r.raise_for_status()
print(r.text)Python — streaming
import requests
payload = {
"prompt": "Write one short sentence about the sea.",
"userId": "#/chat/1795677000000",
"network": True,
"system": "",
"withoutContext": False,
"stream": True,
}
headers = {
"Content-Type": "application/json",
"Origin": "https://chat9.yqcloud.top",
"Referer": "https://chat9.yqcloud.top/",
}
with requests.post(
"https://api.binjie.fun/api/generateStream",
json=payload,
headers=headers,
stream=True,
timeout=120,
) as r:
r.raise_for_status()
for chunk in r.iter_content(chunk_size=None, decode_unicode=True):
if chunk:
print(chunk, end="", flush=True)Python — reusable client
import time
import requests
class Chat9:
URL = "https://api.binjie.fun/api/generateStream"
HEADERS = {
"Content-Type": "application/json",
"Origin": "https://chat9.yqcloud.top",
"Referer": "https://chat9.yqcloud.top/",
}
def __init__(self, system="", network=True, without_context=False, user_id=None):
self.system = system
self.network = network
self.without_context = without_context
self.user_id = user_id or f"#/chat/{int(time.time() * 1000)}"
def ask(self, prompt):
payload = {
"prompt": prompt,
"userId": self.user_id,
"network": self.network,
"system": self.system,
"withoutContext": self.without_context,
"stream": False,
}
r = requests.post(self.URL, json=payload, headers=self.HEADERS, timeout=120)
r.raise_for_status()
return r.text
def stream(self, prompt):
payload = {
"prompt": prompt,
"userId": self.user_id,
"network": self.network,
"system": self.system,
"withoutContext": self.without_context,
"stream": True,
}
with requests.post(
self.URL,
json=payload,
headers=self.HEADERS,
stream=True,
timeout=120,
) as r:
r.raise_for_status()
for chunk in r.iter_content(chunk_size=None, decode_unicode=True):
if chunk:
yield chunk
bot = Chat9(system="Be concise.")
print(bot.ask("What is a REST API?"))JavaScript — fetch
const res = await fetch("https://api.binjie.fun/api/generateStream", {
method: "POST",
headers: {
"Content-Type": "application/json",
Origin: "https://chat9.yqcloud.top",
Referer: "https://chat9.yqcloud.top/",
},
body: JSON.stringify({
prompt: "Say hello in one short sentence.",
userId: "#/chat/1795677000000",
network: true,
system: "",
withoutContext: false,
stream: false,
}),
});
console.log(await res.text());JavaScript — read a stream
const res = await fetch("https://api.binjie.fun/api/generateStream", {
method: "POST",
headers: {
"Content-Type": "application/json",
Origin: "https://chat9.yqcloud.top",
Referer: "https://chat9.yqcloud.top/",
},
body: JSON.stringify({
prompt: "Count from 1 to 5.",
userId: "#/chat/1795677000000",
network: true,
system: "",
withoutContext: false,
stream: true,
}),
});
const reader = res.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
process.stdout.write(decoder.decode(value, { stream: true }));
}Node.js — CLI
chat9.mjs:
const prompt = process.argv.slice(2).join(" ") || "Hello!";
const res = await fetch("https://api.binjie.fun/api/generateStream", {
method: "POST",
headers: {
"Content-Type": "application/json",
Origin: "https://chat9.yqcloud.top",
Referer: "https://chat9.yqcloud.top/",
},
body: JSON.stringify({
prompt,
userId: "#/chat/" + Date.now(),
network: true,
system: "",
withoutContext: true,
stream: false,
}),
});
console.log(await res.text());node chat9.mjs "Explain DNS in one sentence"Bash — reusable function
Add to ~/.bashrc:
chat9() {
curl -sS -m 120 -X POST 'https://api.binjie.fun/api/generateStream' \
-H 'Content-Type: application/json' \
-H 'Origin: https://chat9.yqcloud.top' \
-H 'Referer: https://chat9.yqcloud.top/' \
-d "{\"prompt\":\"$1\",\"userId\":\"#/chat/$(date +%s%3N)\",\"network\":true,\"system\":\"\",\"withoutContext\":true,\"stream\":false}"
}chat9 "Give me three names for a coffee shop"Go — minimal client
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
body := []byte(`{
"prompt": "Say hello in one short sentence.",
"userId": "#/chat/1795677000000",
"network": true,
"system": "",
"withoutContext": false,
"stream": false
}`)
req, _ := http.NewRequest("POST", "https://api.binjie.fun/api/generateStream", bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Origin", "https://chat9.yqcloud.top")
req.Header.Set("Referer", "https://chat9.yqcloud.top/")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}PHP — minimal client
<?php
$payload = json_encode([
"prompt" => "Say hello in one short sentence.",
"userId" => "#/chat/1795677000000",
"network" => true,
"system" => "",
"withoutContext" => false,
"stream" => false,
]);
$ch = curl_init("https://api.binjie.fun/api/generateStream");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Origin: https://chat9.yqcloud.top",
"Referer: https://chat9.yqcloud.top/",
],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
]);
$answer = curl_exec($ch);
curl_close($ch);
echo $answer;A robust TypeScript client with timeouts, retries, and streaming support:
Show the TypeScript client
type Chat9Options = {
system?: string;
network?: boolean;
withoutContext?: boolean;
userId?: string;
timeoutMs?: number;
retries?: number;
};
export class Chat9 {
private url = "https://api.binjie.fun/api/generateStream";
private headers = {
"Content-Type": "application/json",
Origin: "https://chat9.yqcloud.top",
Referer: "https://chat9.yqcloud.top/",
};
private system: string;
private network: boolean;
private withoutContext: boolean;
userId: string;
private timeoutMs: number;
private retries: number;
constructor(options: Chat9Options = {}) {
this.system = options.system ?? "";
this.network = options.network ?? true;
this.withoutContext = options.withoutContext ?? false;
this.userId = options.userId ?? `#/chat/${Date.now()}`;
this.timeoutMs = options.timeoutMs ?? 120_000;
this.retries = options.retries ?? 2;
}
private body(prompt: string, stream: boolean) {
return JSON.stringify({
prompt,
userId: this.userId,
network: this.network,
system: this.system,
withoutContext: this.withoutContext,
stream,
});
}
async ask(prompt: string): Promise<string> {
let lastError: unknown;
for (let attempt = 0; attempt <= this.retries; attempt++) {
try {
const res = await fetch(this.url, {
method: "POST",
headers: this.headers,
body: this.body(prompt, false),
signal: AbortSignal.timeout(this.timeoutMs),
});
if (!res.ok) throw new Error(`Chat9 HTTP ${res.status}`);
const text = (await res.text()).trim();
if (!text) throw new Error("Chat9 returned an empty body");
return text;
} catch (error) {
lastError = error;
await new Promise((r) => setTimeout(r, 2 ** attempt * 500));
}
}
throw lastError;
}
async *stream(prompt: string): AsyncGenerator<string> {
const res = await fetch(this.url, {
method: "POST",
headers: this.headers,
body: this.body(prompt, true),
signal: AbortSignal.timeout(this.timeoutMs),
});
if (!res.ok || !res.body) throw new Error(`Chat9 HTTP ${res.status}`);
const reader = res.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value, { stream: true });
if (chunk) yield chunk;
}
}
}const bot = new Chat9({ system: "Be concise.", network: false });
console.log(await bot.ask("What is a REST API?"));
for await (const chunk of bot.stream("Count from 1 to 5.")) {
process.stdout.write(chunk);
}Chat9's plain-text API fits any workflow where you need a quick answer without managing keys, billing, or SDKs. Below are practical places to use it.
Build a small assistant that answers questions, drafts messages, and explains concepts from the terminal, a menu bar app, or a mobile shortcut.
- Combine
systemwith a persona such as "concise technical assistant". - Keep one
userIdper user or session for multi-turn context. - Great for quick lookups where opening a browser is too slow.
Pipe shell output, error logs, or file contents into Chat9 and get a plain-text explanation in return.
tail -n 50 app.log | xargs -0 -I{} chat9 "Explain this log: {}"Use it for command suggestions, regex writing, git commit messages, and quick script generation.
Wrap the endpoint in a bot handler: receive a message, call Chat9, send the text back. No API key means no billing surprises while prototyping.
- Store one
userIdper chat to keep conversational memory. - Truncate long messages before sending.
- Add a cooldown per user to stay within sane traffic limits.
Add a lightweight "Ask AI" box to a landing page, docs site, or internal tool. The endpoint allows cross-origin requests, and responses are plain text you can render directly.
- Use your server as a proxy if you want to hide the origin headers.
- Cache frequent answers to reduce upstream calls.
- Stream into the UI with
stream: truefor a typing effect.
Draft blog intros, product descriptions, social posts, bios, and ad copy.
- Ask for specific tone, length, and audience in
system. - Ask for bullet lists or tables in the prompt.
- Regenerate with a new
userIdwhen you want a fresh angle.
Translate strings, UI copy, and support replies between languages.
chat9 "Translate to Hindi, answer only with the translation: Welcome back"Condense articles, meeting notes, and long emails into key points.
- Request a fixed number of bullets.
- Use
withoutContext: trueto avoid leaking prior conversation. - Split very long text into chunks and summarize recursively.
Explain topics at different levels, generate practice questions, and check
answers. The system field makes it easy to act as a tutor for a specific
subject.
Paste a stack trace or a function and ask for a fix, a refactor, or a line-by-line
walkthrough. Works well with network: false for private snippets.
Test prompt variants quickly before wiring them into a paid provider. Because there is no key and no SDK, experiments cost nothing and take seconds.
Call Chat9 from n8n, Make, Zapier (via webhook), GitHub Actions, cron jobs, or any script runner.
- Generate daily digests from RSS feeds.
- Triage support emails into categories.
- Enrich spreadsheets with summaries or tags.
- Write release notes from commit messages.
Classify text into categories, extract entities, or normalize messy input. Ask
for strict output formats such as CSV or JSON in system, then parse the text.
Draft replies, shorten long messages, adjust tone, and translate customer support responses.
Generate page titles, meta descriptions, alt text, and keyword ideas from a short brief.
Simplify dense text, expand abbreviations, and rewrite content at a lower reading level for broader audiences.
Add an "explain this" button to documentation, a quiz generator for classrooms, or an onboarding assistant for new team members.
Generate hypotheses, outlines, interview questions, and pros/cons lists. Keep
network: true when you want current context.
Pair Chat9 with speech-to-text and text-to-speech to build voice assistants, kiosks, and accessibility tools.
Telegram bot (Python)
import requests
BOT_TOKEN = "YOUR_TELEGRAM_BOT_TOKEN"
CHAT9_URL = "https://api.binjie.fun/api/generateStream"
def ask_chat9(prompt, user_id):
headers = {
"Content-Type": "application/json",
"Origin": "https://chat9.yqcloud.top",
"Referer": "https://chat9.yqcloud.top/",
}
payload = {
"prompt": prompt,
"userId": user_id,
"network": True,
"system": "",
"withoutContext": False,
"stream": False,
}
r = requests.post(CHAT9_URL, json=payload, headers=headers, timeout=120)
r.raise_for_status()
return r.text
def send(chat_id, text):
requests.post(
f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage",
json={"chat_id": chat_id, "text": text[:4000]},
timeout=30,
)
def poll():
offset = None
while True:
params = {"timeout": 30}
if offset:
params["offset"] = offset
res = requests.get(
f"https://api.telegram.org/bot{BOT_TOKEN}/getUpdates",
params=params,
timeout=40,
).json()
for update in res.get("result", []):
offset = update["update_id"] + 1
msg = update.get("message", {})
text = msg.get("text")
chat_id = msg.get("chat", {}).get("id")
if not text or not chat_id:
continue
answer = ask_chat9(text, f"#/chat/{chat_id}")
send(chat_id, answer)
if __name__ == "__main__":
poll()Local proxy (Flask)
A small proxy keeps the browser request simple and lets you add caching, rate limits, or logging.
from flask import Flask, request, jsonify
import requests
app = Flask(__name__)
CHAT9_URL = "https://api.binjie.fun/api/generateStream"
HEADERS = {
"Content-Type": "application/json",
"Origin": "https://chat9.yqcloud.top",
"Referer": "https://chat9.yqcloud.top/",
}
@app.post("/api/chat")
def chat():
data = request.get_json(force=True)
prompt = data.get("prompt", "").strip()
if not prompt:
return jsonify({"error": "prompt is required"}), 400
payload = {
"prompt": prompt,
"userId": data.get("userId", "#/chat/0"),
"network": data.get("network", True),
"system": data.get("system", ""),
"withoutContext": data.get("withoutContext", False),
"stream": False,
}
r = requests.post(CHAT9_URL, json=payload, headers=HEADERS, timeout=120)
r.raise_for_status()
return jsonify({"answer": r.text})
if __name__ == "__main__":
app.run(port=5000)curl -sS -X POST http://localhost:5000/api/chat \
-H 'Content-Type: application/json' \
-d '{"prompt":"Say hello"}'GitHub Actions step
- name: Generate release summary with Chat9
run: |
SUMMARY=$(curl -sS -m 120 -X POST 'https://api.binjie.fun/api/generateStream' \
-H 'Content-Type: application/json' \
-H 'Origin: https://chat9.yqcloud.top' \
-H 'Referer: https://chat9.yqcloud.top/' \
-d "{\"prompt\":\"Summarize these commits: $(git log -5 --oneline | tr '\n' ' ')\",\"userId\":\"#/chat/$(date +%s)\",\"network\":false,\"system\":\"\",\"withoutContext\":true,\"stream\":false}")
echo "$SUMMARY"n8n / Make / Zapier
Use an HTTP Request node with:
- Method:
POST - URL:
https://api.binjie.fun/api/generateStream - Headers:
Content-Type: application/json,Origin: https://chat9.yqcloud.top,Referer: https://chat9.yqcloud.top/ - Body: JSON with
promptanduserId
Map the plain-text response into the next node.
{
"prompt": "Classify this review: The battery dies in two hours.",
"userId": "#/chat/1795677000000",
"network": false,
"system": "Return only valid JSON: {\"sentiment\":\"positive|neutral|negative\",\"reason\":\"...\"}",
"withoutContext": true,
"stream": false
}Set system to "You are a senior editor. Rewrite for clarity and keep under 80
words." and put the content in prompt.
Classify each line as POSITIVE or NEGATIVE.
Input: I love this product
Output: POSITIVE
Input: The app crashes constantly
Output: NEGATIVE
Input: It is okay, nothing special
Output:
Wrap user content in tags so the model treats it as data:
Summarize the text between <article> and </article>.
<article>...untrusted content...</article>
- Split a long document into chunks.
- Summarize each chunk with
withoutContext: true. - Send the partial summaries in one final
prompt.
Ask for a maximum length, a format (bullets, table, CSV), a language, and a reading level. State what to do when the input is ambiguous.
Chat9 does not return a conversation ID. Context is tied to the userId you
send, so a simple multi-turn loop looks like this:
import time
import requests
URL = "https://api.binjie.fun/api/generateStream"
USER = f"#/chat/{int(time.time() * 1000)}"
HEADERS = {
"Content-Type": "application/json",
"Origin": "https://chat9.yqcloud.top",
"Referer": "https://chat9.yqcloud.top/",
}
def ask(prompt, keep_context=True):
payload = {
"prompt": prompt,
"userId": USER,
"network": True,
"system": "You are a helpful assistant.",
"withoutContext": not keep_context,
"stream": False,
}
r = requests.post(URL, json=payload, headers=HEADERS, timeout=120)
r.raise_for_status()
return r.text
print(ask("My name is Alex."))
print(ask("What is my name?"))
print(ask("What is my name?", keep_context=False))Rules of thumb:
- Same
userId+withoutContext: false= remembered conversation. - Same
userId+withoutContext: true= one-shot, no memory. - New
userId= fresh conversation. - Include critical facts in the prompt if context is unreliable.
Set stream: true to receive the answer as it is generated. Key details:
- The response is chunked plain text, not Server-Sent Events.
- The
Content-Typeisapplication/octet-streamwithContent-Disposition: attachment; filename="data.txt". - Use
curl -Nto disable client-side buffering. - In Python, use
stream=Truewithiter_content. - In JavaScript, read
res.body.getReader().
Streaming is ideal for chat UIs, terminal output, and long answers where you want to show progress immediately.
Hash the normalized prompt plus system and network settings. Cache answers for repeated questions. Add a short TTL for time-sensitive topics.
cache_key = sha256(system + network + withoutContext + prompt)
Limit per user and per IP. Queue bursts instead of hammering the endpoint. Return a friendly message when the limit is reached.
Retry 5xx, 410, timeouts, and empty bodies with exponential backoff and
jitter. Never retry 4xx caused by bad requests.
Track consecutive failures. After a threshold, fail fast for a cooldown period, then probe again. This protects both your app and the shared service.
Log:
- request duration and time-to-first-byte
- HTTP status and response size
- prompt length and whether streaming was used
- retry count and cache hit rate
Never log full prompts that may contain personal data.
If Chat9 is unavailable, fall back to a cached answer, a static message, or an alternate internal workflow. Design UIs for delayed and missing responses.
| Factor | Guidance |
|---|---|
| Latency | Varies by load; long answers take longer |
| Timeout | Use 60–120 seconds for full answers |
| Throughput | Keep traffic human-scale; avoid bursts |
| Payload size | Keep prompts focused; chunk very long text |
| Streaming | Best for perceived speed, not raw throughput |
| Caching | Cache repeated questions locally |
Because this is a public endpoint, treat capacity as shared and unpredictable. Design your app to degrade gracefully when the service is slow or unavailable.
Always check the HTTP status and retry transient failures.
import time
import requests
URL = "https://api.binjie.fun/api/generateStream"
HEADERS = {
"Content-Type": "application/json",
"Origin": "https://chat9.yqcloud.top",
"Referer": "https://chat9.yqcloud.top/",
}
def ask_with_retry(prompt, tries=3):
payload = {
"prompt": prompt,
"userId": "#/chat/1795677000000",
"network": True,
"system": "",
"withoutContext": True,
"stream": False,
}
for attempt in range(1, tries + 1):
try:
r = requests.post(URL, json=payload, headers=HEADERS, timeout=120)
if r.status_code == 200 and r.text.strip():
return r.text
print(f"attempt {attempt}: status {r.status_code}")
except requests.RequestException as exc:
print(f"attempt {attempt}: {exc}")
time.sleep(2 ** attempt)
raise RuntimeError("Chat9 request failed after retries")Guidelines:
- Retry on
5xx,410, timeouts, and empty bodies. - Do not retry on repeated
4xxwithout fixing the request. - Add jitter to backoff when sending concurrent traffic.
- Fail gracefully in user-facing apps.
- Do not send secrets — prompts may be processed or logged upstream.
- Redact personal data before sending logs, emails, or documents.
- Keep keys out of the repo — local scripts should read secrets from the environment.
- Use
network: falsewhen you want to reduce external lookups. - Proxy server-side if you need to add auth, rate limits, or audit logs for your own users.
- Validate model output before executing commands or rendering HTML.
| Symptom | Likely Cause | Fix |
|---|---|---|
| Empty response | Missing prompt or blocked origin |
Check body fields and headers |
403 or silent failure |
Wrong Origin / Referer |
Use https://chat9.yqcloud.top |
410 or 502 with system notice |
Upstream maintenance | Wait and retry with backoff |
| Timeout | Long generation or upstream load | Raise timeout, retry |
| Truncated answer | Client buffering or connection drop | Use streaming or retry |
| No memory between turns | withoutContext: true or changed userId |
Reuse the same userId |
| JSON parse error | Endpoint returns plain text | Treat the body as text |
| Slow first token | Cold upstream session | Keep timeouts generous |
| Runtime | Support | Notes |
|---|---|---|
| curl | Yes | Use -N for streaming |
| Python 3.8+ | Yes | requests recommended |
| Node.js 18+ | Yes | Built-in fetch and streams |
| Deno / Bun | Yes | Standard fetch API |
| Browsers | Yes | CORS enabled; proxy if blocked |
| Go 1.18+ | Yes | Standard net/http |
| PHP 7.4+ | Yes | curl extension |
| Android / iOS | Yes | Any HTTP library |
Is Chat9 free? Yes. The public endpoint requires no API key, account, or payment.
Do I need cookies?
No. Only the JSON body plus Content-Type, Origin, and Referer headers.
Why is the response not JSON? Chat9 returns plain text by design. Parse or wrap it yourself.
Why did I get an empty response?
Usually a missing prompt, a blocked origin, or a temporary upstream error.
Retry and verify the headers.
Does context persist between requests?
Yes, when withoutContext is false and the same userId is reused, as long as
the upstream session is retained.
Can I stream the answer?
Yes. Set stream: true and read the response body incrementally.
Can I use this in production? It is best for prototypes, internal tools, and low-volume use. For critical production workloads, add retries, caching, monitoring, and a fallback provider.
Does it support images or files? No. The documented endpoint accepts text prompts only.
Which languages are supported? Natural-language prompts and answers work across languages; results vary by model.
Why do I sometimes see a maintenance message?
The upstream is best-effort. Retry later, and handle 410 / 502 in your code.
| Term | Meaning |
|---|---|
prompt |
The user message sent to Chat9 |
userId |
Session key that ties requests to one conversation |
system |
Instruction that shapes the model's behavior |
network |
Toggle for live web/network lookup |
withoutContext |
Stateless mode that ignores prior turns |
stream |
Chunked delivery of the plain-text answer |
| Scrap API | Unofficial access to a website's public endpoint |
| SSE | Server-Sent Events; Chat9 uses chunked text instead |
- Document the core Chat9 endpoint
- Add curl, Python, JavaScript, TypeScript, Go, PHP, and shell examples
- Add streaming and multi-turn recipes
- Add use cases and integration guides
- Add production patterns and troubleshooting
- Add Postman collection
- Add OpenAPI-style schema for the request body
- Add more bot integrations
Found a new parameter, header, or behavior on Chat9? Open an issue or pull request with a reproducible example. Keep contributions focused on Chat9 only.
This project is an independent documentation effort for Chat9. It is not affiliated with, endorsed by, or supported by Chat9 or its providers. Endpoints, parameters, and behavior may change or disappear at any time. Use responsibly, respect the service's terms, and avoid abusive traffic.