Feixiaohao AIDocs
Product GuideTrading & SecurityListing & TrustDeveloper API
Open AIAI
Docs Home
Product Guide
  • Quick StartStart
  • Research & Data Standards
  • Explore & News
  • Alerts, Review & AI Studio
  • Account, Fei Diamonds & AI Memory
  • Community, Articles & Clubs
  • Live Streams & Red Packets
  • Events, FXH ID & Fei Diamonds
Trading & Security
  • Trading Overview
  • Wallets & Fund SecurityCore
Listing & Trust
  • Get Listed & Updates
  • FAQ
  • Terms & Risk Disclosure
  • Changelog
Developer API
  • API Quick Start & AuthAllowlist
  • Chat, Vision & Conversations
  • TTS Audio & AI Images
  • Errors, Limits & Code Examples
Back to Feixiaohao AI
Docs/Developer API/Chat, Vision & Conversations

Chat, Vision & Conversations

Detailed reference for POST /chat text and multimodal image input, SSE streaming and Nginx proxy setup, run cancellation, and conversation history endpoints.

Updated 2026-12-02
Ask Feixiaohao AI
Note

The Developer API is currently allowlist-only. Multimodal image input (images) requires the vision sub-capability to be enabled for your allowlisted tenant; otherwise requests return 403 CAPABILITY_DISABLED.

Send a Chat Turn POST /api/partner/v1/chat

Include Authorization: Bearer <API_KEY> and Content-Type: application/json. Body size ceiling is 64 KB for text-only payloads and 24 MB when images are included.

Request Body (JSON, strict)

FieldTypeRequiredDescription
user_idstringYes1-128 chars, stable anonymous user identifier
messagestringConditional0-8,000 trimmed chars; provide message, images, or both
imagesImageInput[]Conditional1-3 inline images; provide message, images, or both
conversation_idstring (UUID)NoPass to continue an existing conversation; omit to create one
request_idstringNoIdempotency key (1-100 chars, ^[A-Za-z0-9_-]+$)
streambooleanNoDefault true (SSE stream); false returns one JSON payload

Multimodal images[] Input Rules

To prevent broken external URLs and SSRF risks, only inline Base64 or Data URIs are accepted (no remote image URL fetching):

FieldTypeRequiredDescription
datastringYesRaw Base64 string or data:image/<type>;base64,... Data URI
media_typestringNoOptional declaration: image/png, image/jpeg, image/webp, image/gif, image/avif (verified via magic bytes)
filenamestringNoOriginal filename (1-160 chars)
  • Decoded limits: <= 5 MB per image, <= 15 MB combined across up to 3 images.
  • Unsupported formats return 415 IMAGE_FORMAT, invalid encoding or MIME mismatches return 422 INVALID_IMAGE, oversized payloads return 413 IMAGE_TOO_LARGE, and missing vision model configuration returns 400 VISION_UNAVAILABLE.

Synchronous Success Response (stream: false, HTTP 200)

json
{
  "conversation_id": "7d0c4e1a-5b32-4c9a-9f12-8a7e3d4c2b10",
  "run_id": "a3f19b20-1c4d-4e8a-8b11-2f6c9a4d0e77",
  "request_id": "req-20261202-0001",
  "status": "completed",
  "text": "As of 2026-12-02 12:30 (UTC+8), BTC is trading near $95,420 (24h +2.15%).",
  "suggestions": [
    "Compare BTC and ETH performance over the past 7 days",
    "What macro events are driving BTC this week?"
  ],
  "usage": {
    "input_tokens": 5321,
    "cached_tokens": 4096,
    "output_tokens": 612,
    "tool_calls": 3,
    "web_searches": 1
  }
}
Tip

Sync mode waits until both the answer and follow-up suggestions finish, so set your HTTP read timeout to >= 660 seconds (11 minutes). Failed or cancelled sync runs return HTTP 502 with {"error":{"code","message","run_id","status","text",...}}. Streaming is recommended for interactive UIs.

SSE Streaming Protocol & Proxy Settings

Streaming responses use Content-Type: text/event-stream; charset=utf-8 with : ping heartbeat comments every 15 seconds:

text
Success: meta ──▶ delta (0..N) ──▶ done
Failure: meta ──▶ delta (0..N) ──▶ error
EventPayloadClient Handling
metaconversation_id, run_id, request_idFirst event; store conversation and run IDs
deltatextAppend and re-render full Markdown; unclosed links are briefly buffered
doneSame shape as sync 200Atomically replace accumulated text with done.text before persisting, then render suggestions
errorFlat JSON: code, message, text, etc.No outer {"error":...} wrapper; preserve partial text and handle by code

Proxy & Disconnect Notes

  1. No resume via Last-Event-ID: id: is for troubleshooting only; dropping the connection cancels the active turn.
  2. Node.js 18+ / Express abort handling: req.on("close") fires as soon as the request body finishes reading. Never abort upstream on req.on("close"); bind res.on("close", () => { if (!res.writableEnded) controller.abort(); }) instead.
  3. Disable proxy buffering: Configure Nginx proxies with proxy_buffering off;, gzip off;, client_max_body_size 30m;, and proxy_read_timeout 660s;.

Cancel an Active Run POST /api/partner/v1/chat/{run_id}/cancel

  • Path parameter: run_id (UUID from meta).
  • Request body: {}; Response (HTTP 200): {"ok":true} (idempotent for already finished runs; returns 404 RUN_NOT_FOUND if missing or cross-tenant).
  • Closing an active SSE connection also stops generation immediately.

Conversation Management

Pre-create a Conversation POST /api/partner/v1/conversations

  • Body: {"user_id":"u_anon_9f2c1a8b"}
  • Response (HTTP 201): {"conversation_id":"7d0c4e1a-5b32-4c9a-9f12-8a7e3d4c2b10"}

List Conversations GET /api/partner/v1/conversations

Query params: user_id (required), limit (optional, 1-100, default 50), archived (optional, "true" or "false", default "false"). Unknown user_id values return an empty array without creating user state.

json
{
  "conversations": [
    {
      "conversation_id": "7d0c4e1a-5b32-4c9a-9f12-8a7e3d4c2b10",
      "title": "What is the latest BTC price?",
      "archived": false,
      "message_count": 4,
      "updated_at": "2026-12-02T04:30:12.000Z"
    }
  ]
}

Fetch Conversation Messages GET /api/partner/v1/conversations/{conversation_id}/messages

Query params: user_id (required), limit (optional, 1-100, default 100, latest N messages in chronological order). Missing or cross-user IDs return 404 CONVERSATION_NOT_FOUND.

json
{
  "conversation_id": "7d0c4e1a-5b32-4c9a-9f12-8a7e3d4c2b10",
  "title": "What is the latest BTC price?",
  "archived": false,
  "active_run_id": null,
  "messages": [
    { "id": "msg-u-1", "role": "user", "text": "Analyze this chart", "image_count": 1 },
    { "id": "msg-a-1", "role": "assistant", "text": "Key support levels appear near...", "suggestions": ["Inspect recent volume trends"] }
  ]
}

Delete a Conversation DELETE /api/partner/v1/conversations/{conversation_id}

Accepts query ?user_id=<user_id> (recommended) or JSON body {"user_id":"<user_id>"}. Returns 200 {"ok":true,"conversation_id":"..."}; returns 409 RUN_ACTIVE if a run is currently executing.

PreviousAPI Quick Start & AuthNextTTS Audio & AI Images
AI responses are informational only and do not constitute investment advice.
TermsRisk Disclosurellms.txt
On this page
  • Send a Chat Turn POST /api/partner/v1/chat
  • Request Body (JSON, strict)
  • Multimodal images[] Input Rules
  • Synchronous Success Response (stream: false, HTTP 200)
  • SSE Streaming Protocol & Proxy Settings
  • Cancel an Active Run POST /api/partner/v1/chat/{run_id}/cancel
  • Conversation Management
  • Pre-create a Conversation POST /api/partner/v1/conversations
  • List Conversations GET /api/partner/v1/conversations
  • Fetch Conversation Messages GET /api/partner/v1/conversations/{conversation_id}/messages
  • Delete a Conversation DELETE /api/partner/v1/conversations/{conversation_id}
Quick Actions
Ask Feixiaohao AI