Wenxin (ERNIE)

Query Baidu's Wenxin / ERNIE via Wire — China's leading AI assistant, with citations

POSThttps://api.anakin.io/v1/wire/task

Wenxin (文心一言 / ERNIE) is Baidu's AI assistant. Send a prompt in any language and get the answer with its citations and web sources. Run it with the wenxin_prompt action on POST /v1/wire/task.

Catalog: wenxin · action_id: wenxin_prompt · Credits: 2 / call · Auth: none


Request Body

{
  "action_id": "wenxin_prompt",
  "params": { "prompt": "What are the best running shoes in 2026?" }
}
ParameterTypeDescription
action_id requiredstringSet to wenxin_prompt
params.prompt requiredstringYour question for ERNIE (up to 8192 chars, any language)
params.additional_promptstringOptional follow-up, asked as a second turn
params.include_htmlbooleanAlso return the answer as HTML under answer_html. Default false
params.include_rawbooleanAlso return ERNIE's raw response stream under response_raw. Default false

Code Examples

curl -X POST http://staging-alb-1217701800.ap-south-1.elb.amazonaws.com/v1/wire/task \
  -H "X-API-Key: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "action_id": "wenxin_prompt",
    "params": { "prompt": "What are the best running shoes in 2026?" }
  }'

Response

202 Accepted
{ "status": "processing", "job_id": "…", "poll_url": "/v1/wire/jobs/…" }

Poll GET /v1/wire/jobs/{id} until status: "completed":

200 OK
{
  "status": "completed",
  "credits_used": 2,
  "data": {
    "status": "ok",
    "data": {
      "prompt": "…", "title": "…",
      "answer_text": "…", "answer_text_markdown": "…", "answer_html": "…",
      "citations": [], "citation_anchors": [], "sources": [],
      "search_sources": [], "references": [],
      "related_media": [], "recommendations": [],
      "conversation_id": "…", "response_id": "…", "language": "zh", "detected_location": "…", "model": "…"
    },
    "meta": { "action_id": "wenxin_prompt", "catalog_slug": "wenxin", "envelope_version": "v1" }
  }
}
FieldTypeDescription
data.data.answer_textstringThe answer (also answer_text_markdown, and answer_html when include_html)
data.data.additional_answer_textstringThe answer to additional_prompt, when you send one
data.data.answer_text_rawstringThe raw, unprocessed answer — keeps ERNIE's inline citation-chip labels and placeholder tokens that answer_text strips out
data.data.citationsarraySources cited in the answer
data.data.recommendationsarrayRelated products or items the engine recommends alongside the answer
data.data.shoppingarrayShopping module for commercial-intent queries — products with titles, prices and links
data.data.related_mediaarrayImages or videos attached to the answer
data.data.citation_anchorsarrayPassage-level placement when ERNIE grounds the answer — one entry per cited span with its cited_text, character range in answer_text/answer_text_raw, and the source URL (empty when the answer carries no inline citations)
data.data.links_attachedarrayThe cited sources as a flat list in reading order: { url, text, position }
data.data.referencesarrayThe cited sources in { url, title, attribution, domain } shape
data.data.sourcesarraySource pages behind the answer (ERNIE's own source list; distinct from citations)
data.data.search_sourcesarraySources considered during search
data.data.web_search_triggeredbooleanWhether ERNIE actually ran a web search for this answer
data.data.web_search_queriesstring[]The search queries ERNIE ran
data.data.tools_usedstring[]Tools ERNIE invoked (e.g. search)
data.data.conversation_idstringReuse to continue the thread (multi-turn)
data.data.adsobjectReserved for sponsored results — none are captured today, so this is always { name: null, url: null, favicon_url: null, carousel_cards: null }
data.data.response_rawstringERNIE's raw response stream, verbatim. Not a stable contract — its format can change without notice; use the structured fields instead
data.data.languagestringDetected answer language

Handles any language, strongest on Chinese-language queries. additional_prompt runs a second conversational turn. Billed only on success.