[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"docs-nav-en":3,"docs-en-models\u002Fchat\u002Foverview":180,"$fMfNGmlyCdNoDCVQ7TgrfnLxKMln4u_bAZVPHPJkuObA":1173},[4,26,43,105,155,172,176],{"title":5,"path":6,"stem":7,"children":8,"page":25},"Getting Started","\u002Fgetting-started","1.getting-started",[9,13,17,21],{"title":10,"path":11,"stem":12},"Your First SilvaMux API Call","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F1.quick-start",{"title":14,"path":15,"stem":16},"Model Selection","\u002Fgetting-started\u002Fmodel-selection","1.getting-started\u002F2.model-selection",{"title":18,"path":19,"stem":20},"Rate Limits","\u002Fgetting-started\u002Frate-limits","1.getting-started\u002F3.rate-limits",{"title":22,"path":23,"stem":24},"FAQ","\u002Fgetting-started\u002Ffaq","1.getting-started\u002F4.faq",false,{"title":27,"path":28,"stem":29,"children":30,"page":25},"Billing","\u002Fbilling","2.billing",[31,35,39],{"title":32,"path":33,"stem":34},"Billing Overview","\u002Fbilling\u002Foverview","2.billing\u002F1.overview",{"title":36,"path":37,"stem":38},"Online Top-up","\u002Fbilling\u002Frecharge","2.billing\u002F2.recharge",{"title":40,"path":41,"stem":42},"Bills, Usage & Exports","\u002Fbilling\u002Fusage-export","2.billing\u002F3.usage-export",{"title":44,"path":45,"stem":46,"children":47,"page":25},"Coding Plan","\u002Fcoding-plan","3.coding-plan",[48,52,56,60,67,102],{"title":49,"path":50,"stem":51},"Coding Plan Overview","\u002Fcoding-plan\u002Foverview","3.coding-plan\u002F1.overview",{"title":53,"path":54,"stem":55},"Quick Start","\u002Fcoding-plan\u002Fquick-start","3.coding-plan\u002F2.quick-start",{"title":57,"path":58,"stem":59},"Usage Notes","\u002Fcoding-plan\u002Fusage-notes","3.coding-plan\u002F3.usage-notes",{"title":61,"path":62,"stem":63,"children":64},"Personal","\u002Fcoding-plan\u002Fpersonal","3.coding-plan\u002F4.personal\u002Findex",[65],{"title":66,"path":62,"stem":63},"Pricing & Benefits",{"title":68,"path":69,"stem":70,"children":71,"page":-1},"Developer Guide","\u002Fcoding-plan\u002Fguide","3.coding-plan\u002F5.guide\u002Findex",[72,74,78,82,86,90,94,98],{"title":73,"path":69,"stem":70},"Endpoints & Protocols",{"title":75,"path":76,"stem":77},"Claude Code","\u002Fcoding-plan\u002Fguide\u002Fclaude-code","3.coding-plan\u002F5.guide\u002F1.claude-code",{"title":79,"path":80,"stem":81},"OpenCode","\u002Fcoding-plan\u002Fguide\u002Fopencode","3.coding-plan\u002F5.guide\u002F2.opencode",{"title":83,"path":84,"stem":85},"Cursor","\u002Fcoding-plan\u002Fguide\u002Fcursor","3.coding-plan\u002F5.guide\u002F3.cursor",{"title":87,"path":88,"stem":89},"Codex","\u002Fcoding-plan\u002Fguide\u002Fcodex","3.coding-plan\u002F5.guide\u002F4.codex",{"title":91,"path":92,"stem":93},"ZCode","\u002Fcoding-plan\u002Fguide\u002Fzcode","3.coding-plan\u002F5.guide\u002F5.zcode",{"title":95,"path":96,"stem":97},"TRAE","\u002Fcoding-plan\u002Fguide\u002Ftrae","3.coding-plan\u002F5.guide\u002F6.trae",{"title":99,"path":100,"stem":101},"CodeBuddy","\u002Fcoding-plan\u002Fguide\u002Fcodebuddy","3.coding-plan\u002F5.guide\u002F7.codebuddy",{"title":22,"path":103,"stem":104},"\u002Fcoding-plan\u002Ffaq","3.coding-plan\u002F6.faq",{"title":106,"path":107,"stem":108,"children":109,"page":25},"Model APIs","\u002Fmodels","4.models",[110,143],{"title":111,"path":112,"stem":113,"children":114,"page":25},"Text Generation Model API","\u002Fmodels\u002Fchat","4.models\u002F1.chat",[115,119,123,127,131,135,139],{"title":116,"path":117,"stem":118},"Overview","\u002Fmodels\u002Fchat\u002Foverview","4.models\u002F1.chat\u002F1.overview",{"title":120,"path":121,"stem":122},"OpenAI Compatible API","\u002Fmodels\u002Fchat\u002Fopenai","4.models\u002F1.chat\u002F2.openai",{"title":124,"path":125,"stem":126},"Anthropic Compatible","\u002Fmodels\u002Fchat\u002Fanthropic","4.models\u002F1.chat\u002F3.anthropic",{"title":128,"path":129,"stem":130},"Volcengine Compatible","\u002Fmodels\u002Fchat\u002Fvolcengine","4.models\u002F1.chat\u002F4.volcengine",{"title":132,"path":133,"stem":134},"Zhipu Compatible","\u002Fmodels\u002Fchat\u002Fzhipu","4.models\u002F1.chat\u002F5.zhipu",{"title":136,"path":137,"stem":138},"SilvaMux Unified Entry","\u002Fmodels\u002Fchat\u002Funified","4.models\u002F1.chat\u002F6.unified",{"title":140,"path":141,"stem":142},"Multimodal Input","\u002Fmodels\u002Fchat\u002Fmultimodal","4.models\u002F1.chat\u002F7.multimodal",{"title":144,"path":145,"stem":146,"children":147,"page":25},"Image Generation Model API","\u002Fmodels\u002Fimages","4.models\u002F2.images",[148,151],{"title":116,"path":149,"stem":150},"\u002Fmodels\u002Fimages\u002Foverview","4.models\u002F2.images\u002F1.overview",{"title":152,"path":153,"stem":154},"Image Generation API","\u002Fmodels\u002Fimages\u002Fgeneration","4.models\u002F2.images\u002F2.generation",{"title":156,"path":157,"stem":158,"children":159,"page":25},"Usage & Balance","\u002Fusage-and-balance","5.usage-and-balance",[160,164,168],{"title":161,"path":162,"stem":163},"Query Balance","\u002Fusage-and-balance\u002Fbalance","5.usage-and-balance\u002F1.balance",{"title":165,"path":166,"stem":167},"Query Usage","\u002Fusage-and-balance\u002Fusage","5.usage-and-balance\u002F2.usage",{"title":169,"path":170,"stem":171},"Query Request Usage","\u002Fusage-and-balance\u002Frequest-usage","5.usage-and-balance\u002F3.request-usage",{"title":173,"path":174,"stem":175},"Error Codes","\u002Ferrors","6.errors",{"title":177,"path":178,"stem":179},"Getting Started with SilvaMux","\u002F","index",{"id":181,"title":116,"body":182,"description":1166,"extension":1167,"meta":1168,"navigation":628,"path":117,"rawbody":1169,"requiredFlags":1170,"seo":1171,"stem":118,"__hash__":1172},"docs_en\u002F4.models\u002F1.chat\u002F1.overview.md",{"type":183,"value":184,"toc":1157},"minimark",[185,190,203,208,211,324,329,332,337,341,344,452,466,470,478,482,505,1143,1147,1153],[186,187,189],"h1",{"id":188},"text-generation-models","Text Generation Models",[191,192,193,194,198,199,202],"p",{},"SilvaMux supports multiple ",[195,196,197],"strong",{},"vendor-protocol compatible entries"," plus an optional ",[195,200,201],{},"unified entry",". New projects should integrate via the vendor protocol their target model supports; projects using the OpenAI SDK should default to the OpenAI Chat Completions compatible entry.",[204,205,207],"h2",{"id":206},"vendor-protocol-compatible-entries-recommended","Vendor Protocol Compatible Entries (Recommended)",[191,209,210],{},"The endpoints below accept the corresponding vendor's request format and preserve the matching response and error structures — ideal for official SDKs, existing code migration, or field-level pass-through.",[212,213,214,230],"table",{},[215,216,217],"thead",{},[218,219,220,224,227],"tr",{},[221,222,223],"th",{},"Compatible format",[221,225,226],{},"Endpoint",[221,228,229],{},"Docs",[231,232,233,251,266,281,296,311],"tbody",{},[218,234,235,239,245],{},[236,237,238],"td",{},"OpenAI Chat Completions",[236,240,241],{},[242,243,244],"code",{},"POST \u002Fapi\u002Fv1\u002Fchat\u002Fcompletions",[236,246,247],{},[248,249,120],"a",{"href":250},"\u002Fen\u002Fdocs\u002Fmodels\u002Fchat\u002Fopenai",[218,252,253,256,261],{},[236,254,255],{},"Anthropic",[236,257,258],{},[242,259,260],{},"POST \u002Fapi\u002Fv1\u002Fmessages",[236,262,263],{},[248,264,124],{"href":265},"\u002Fen\u002Fdocs\u002Fmodels\u002Fchat\u002Fanthropic",[218,267,268,271,276],{},[236,269,270],{},"Volcengine v3",[236,272,273],{},[242,274,275],{},"POST \u002Fapi\u002Fv3\u002Fchat\u002Fcompletions",[236,277,278],{},[248,279,128],{"href":280},"\u002Fen\u002Fdocs\u002Fmodels\u002Fchat\u002Fvolcengine",[218,282,283,286,291],{},[236,284,285],{},"Zhipu",[236,287,288],{},[242,289,290],{},"POST \u002Fapi\u002Fpaas\u002Fv4\u002Fchat\u002Fcompletions",[236,292,293],{},[248,294,132],{"href":295},"\u002Fen\u002Fdocs\u002Fmodels\u002Fchat\u002Fzhipu",[218,297,298,301,306],{},[236,299,300],{},"SilvaMux unified entry",[236,302,303],{},[242,304,305],{},"POST \u002Fapi\u002Fv0\u002Fchat\u002Fcompletions",[236,307,308],{},[248,309,136],{"href":310},"\u002Fen\u002Fdocs\u002Fmodels\u002Fchat\u002Funified",[218,312,313,316,321],{},[236,314,315],{},"Responses",[236,317,318],{},[242,319,320],{},"POST \u002Fapi\u002Fv1\u002Fresponses",[236,322,323],{},"Compatible with the OpenAI Responses API; for supported models (e.g. the codex series)",[325,326,328],"h3",{"id":327},"openai-responses","OpenAI Responses",[191,330,331],{},"Compatible with the OpenAI Responses API; for supported models (e.g. the codex series):",[333,334],"api-endpoint",{"method":335,"path":336},"POST","\u002Fapi\u002Fv1\u002Fresponses",[204,338,340],{"id":339},"common-parameters","Common Parameters",[191,342,343],{},"Common parameters for OpenAI Chat and the unified entry:",[212,345,346,359],{},[215,347,348],{},[218,349,350,353,356],{},[221,351,352],{},"Parameter",[221,354,355],{},"Type",[221,357,358],{},"Description",[231,360,361,389,410,426,439],{},[218,362,363,368,371],{},[236,364,365],{},[242,366,367],{},"model",[236,369,370],{},"string",[236,372,373,374,377,378,381,382,385,386],{},"Required. Model call name (",[242,375,376],{},"id"," or ",[242,379,380],{},"alias","), e.g. ",[242,383,384],{},"minimax-m2.5",", ",[242,387,388],{},"doubao-seed-2.0-pro",[218,390,391,396,399],{},[236,392,393],{},[242,394,395],{},"messages",[236,397,398],{},"array",[236,400,401,402,405,406,409],{},"Required. Message list, same shape as OpenAI (",[242,403,404],{},"role"," + ",[242,407,408],{},"content",")",[218,411,412,417,420],{},[236,413,414],{},[242,415,416],{},"stream",[236,418,419],{},"boolean",[236,421,422,423],{},"Whether to stream the response; default ",[242,424,425],{},"false",[218,427,428,433,436],{},[236,429,430],{},[242,431,432],{},"temperature",[236,434,435],{},"number",[236,437,438],{},"Sampling temperature; default 1.0",[218,440,441,446,449],{},[236,442,443],{},[242,444,445],{},"max_tokens",[236,447,448],{},"integer",[236,450,451],{},"Maximum generated tokens",[453,454,455],"blockquote",{},[191,456,457,458,462,463,465],{},"Field structures differ per vendor protocol. First filter the ",[248,459,461],{"href":460},"\u002Fen\u002Fmodels","Model Plaza"," for models supporting your target format, then copy the call name from the detail page into ",[242,464,367],{},".",[204,467,469],{"id":468},"authentication","Authentication",[191,471,472,377,475,465],{},[242,473,474],{},"Authorization: Bearer \u003CAPI_KEY>",[242,476,477],{},"x-api-key: \u003CAPI_KEY>",[204,479,481],{"id":480},"streaming","Streaming",[191,483,484,485,488,489,492,493,496,497,500,501,504],{},"Set ",[242,486,487],{},"stream: true"," to get a streaming response (SSE). The response is ",[242,490,491],{},"text\u002Fevent-stream",", each event starting with ",[242,494,495],{},"data: ",". You may eventually receive a usage chunk with an empty ",[242,498,499],{},"choices",", after which the server closes the connection; do not rely solely on ",[242,502,503],{},"data: [DONE]"," to detect completion. Anthropic-format streaming follows the Anthropic SSE specification.",[506,507,508,599,726,822],"code-tabs",{},[509,510,512],"code-tab",{"label":511},"cURL",[513,514,519],"pre",{"className":515,"code":516,"language":517,"meta":518,"style":518},"language-bash shiki shiki-themes github-light github-dark","curl https:\u002F\u002Fsilvamux.io\u002Fapi\u002Fv1\u002Fchat\u002Fcompletions \\\n  -H \"Authorization: Bearer $SILVAMUX_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"model\": \"minimax-m2.5\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Write a short poem\"}],\n    \"stream\": true\n  }'\n","bash","",[242,520,521,538,556,566,575,581,587,593],{"__ignoreMap":518},[522,523,526,530,534],"span",{"class":524,"line":525},"line",1,[522,527,529],{"class":528},"sScJk","curl",[522,531,533],{"class":532},"sZZnC"," https:\u002F\u002Fsilvamux.io\u002Fapi\u002Fv1\u002Fchat\u002Fcompletions",[522,535,537],{"class":536},"sj4cs"," \\\n",[522,539,541,544,547,551,554],{"class":524,"line":540},2,[522,542,543],{"class":536},"  -H",[522,545,546],{"class":532}," \"Authorization: Bearer ",[522,548,550],{"class":549},"sVt8B","$SILVAMUX_API_KEY",[522,552,553],{"class":532},"\"",[522,555,537],{"class":536},[522,557,559,561,564],{"class":524,"line":558},3,[522,560,543],{"class":536},[522,562,563],{"class":532}," \"Content-Type: application\u002Fjson\"",[522,565,537],{"class":536},[522,567,569,572],{"class":524,"line":568},4,[522,570,571],{"class":536},"  -d",[522,573,574],{"class":532}," '{\n",[522,576,578],{"class":524,"line":577},5,[522,579,580],{"class":532},"    \"model\": \"minimax-m2.5\",\n",[522,582,584],{"class":524,"line":583},6,[522,585,586],{"class":532},"    \"messages\": [{\"role\": \"user\", \"content\": \"Write a short poem\"}],\n",[522,588,590],{"class":524,"line":589},7,[522,591,592],{"class":532},"    \"stream\": true\n",[522,594,596],{"class":524,"line":595},8,[522,597,598],{"class":532},"  }'\n",[509,600,602],{"label":601},"Python",[513,603,607],{"className":604,"code":605,"language":606,"meta":518,"style":518},"language-python shiki shiki-themes github-light github-dark","# pip install openai\nimport os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ[\"SILVAMUX_API_KEY\"],\n    base_url=\"https:\u002F\u002Fsilvamux.io\u002Fapi\u002Fv1\",\n)\n\nstream = client.chat.completions.create(\n    model=\"minimax-m2.5\",\n    messages=[{\"role\": \"user\", \"content\": \"Write a short poem\"}],\n    stream=True,\n)\nfor chunk in stream:\n    if chunk.choices:\n        delta = chunk.choices[0].delta.content\n        if delta:\n            print(delta, end=\"\", flush=True)\n    if chunk.usage:\n        print(f\"\\nUsage: {chunk.usage}\")\n","python",[242,608,609,614,619,624,630,635,640,645,650,655,661,667,673,679,684,690,696,702,708,714,720],{"__ignoreMap":518},[522,610,611],{"class":524,"line":525},[522,612,613],{},"# pip install openai\n",[522,615,616],{"class":524,"line":540},[522,617,618],{},"import os\n",[522,620,621],{"class":524,"line":558},[522,622,623],{},"from openai import OpenAI\n",[522,625,626],{"class":524,"line":568},[522,627,629],{"emptyLinePlaceholder":628},true,"\n",[522,631,632],{"class":524,"line":577},[522,633,634],{},"client = OpenAI(\n",[522,636,637],{"class":524,"line":583},[522,638,639],{},"    api_key=os.environ[\"SILVAMUX_API_KEY\"],\n",[522,641,642],{"class":524,"line":589},[522,643,644],{},"    base_url=\"https:\u002F\u002Fsilvamux.io\u002Fapi\u002Fv1\",\n",[522,646,647],{"class":524,"line":595},[522,648,649],{},")\n",[522,651,653],{"class":524,"line":652},9,[522,654,629],{"emptyLinePlaceholder":628},[522,656,658],{"class":524,"line":657},10,[522,659,660],{},"stream = client.chat.completions.create(\n",[522,662,664],{"class":524,"line":663},11,[522,665,666],{},"    model=\"minimax-m2.5\",\n",[522,668,670],{"class":524,"line":669},12,[522,671,672],{},"    messages=[{\"role\": \"user\", \"content\": \"Write a short poem\"}],\n",[522,674,676],{"class":524,"line":675},13,[522,677,678],{},"    stream=True,\n",[522,680,682],{"class":524,"line":681},14,[522,683,649],{},[522,685,687],{"class":524,"line":686},15,[522,688,689],{},"for chunk in stream:\n",[522,691,693],{"class":524,"line":692},16,[522,694,695],{},"    if chunk.choices:\n",[522,697,699],{"class":524,"line":698},17,[522,700,701],{},"        delta = chunk.choices[0].delta.content\n",[522,703,705],{"class":524,"line":704},18,[522,706,707],{},"        if delta:\n",[522,709,711],{"class":524,"line":710},19,[522,712,713],{},"            print(delta, end=\"\", flush=True)\n",[522,715,717],{"class":524,"line":716},20,[522,718,719],{},"    if chunk.usage:\n",[522,721,723],{"class":524,"line":722},21,[522,724,725],{},"        print(f\"\\nUsage: {chunk.usage}\")\n",[509,727,729],{"label":728},"JavaScript",[513,730,734],{"className":731,"code":732,"language":733,"meta":518,"style":518},"language-javascript shiki shiki-themes github-light github-dark","\u002F\u002F npm install openai\nimport OpenAI from \"openai\";\n\nconst client = new OpenAI({\n  apiKey: process.env.SILVAMUX_API_KEY,\n  baseURL: \"https:\u002F\u002Fsilvamux.io\u002Fapi\u002Fv1\",\n});\n\nconst stream = await client.chat.completions.create({\n  model: \"minimax-m2.5\",\n  messages: [{ role: \"user\", content: \"Write a short poem\" }],\n  stream: true,\n});\n\nfor await (const chunk of stream) {\n  const delta = chunk.choices[0]?.delta?.content;\n  if (delta) process.stdout.write(delta);\n}\n","javascript",[242,735,736,741,746,750,755,760,765,770,774,779,784,789,794,798,802,807,812,817],{"__ignoreMap":518},[522,737,738],{"class":524,"line":525},[522,739,740],{},"\u002F\u002F npm install openai\n",[522,742,743],{"class":524,"line":540},[522,744,745],{},"import OpenAI from \"openai\";\n",[522,747,748],{"class":524,"line":558},[522,749,629],{"emptyLinePlaceholder":628},[522,751,752],{"class":524,"line":568},[522,753,754],{},"const client = new OpenAI({\n",[522,756,757],{"class":524,"line":577},[522,758,759],{},"  apiKey: process.env.SILVAMUX_API_KEY,\n",[522,761,762],{"class":524,"line":583},[522,763,764],{},"  baseURL: \"https:\u002F\u002Fsilvamux.io\u002Fapi\u002Fv1\",\n",[522,766,767],{"class":524,"line":589},[522,768,769],{},"});\n",[522,771,772],{"class":524,"line":595},[522,773,629],{"emptyLinePlaceholder":628},[522,775,776],{"class":524,"line":652},[522,777,778],{},"const stream = await client.chat.completions.create({\n",[522,780,781],{"class":524,"line":657},[522,782,783],{},"  model: \"minimax-m2.5\",\n",[522,785,786],{"class":524,"line":663},[522,787,788],{},"  messages: [{ role: \"user\", content: \"Write a short poem\" }],\n",[522,790,791],{"class":524,"line":669},[522,792,793],{},"  stream: true,\n",[522,795,796],{"class":524,"line":675},[522,797,769],{},[522,799,800],{"class":524,"line":681},[522,801,629],{"emptyLinePlaceholder":628},[522,803,804],{"class":524,"line":686},[522,805,806],{},"for await (const chunk of stream) {\n",[522,808,809],{"class":524,"line":692},[522,810,811],{},"  const delta = chunk.choices[0]?.delta?.content;\n",[522,813,814],{"class":524,"line":698},[522,815,816],{},"  if (delta) process.stdout.write(delta);\n",[522,818,819],{"class":524,"line":704},[522,820,821],{},"}\n",[509,823,825],{"label":824},"Go",[513,826,830],{"className":827,"code":828,"language":829,"meta":518,"style":518},"language-go shiki shiki-themes github-light github-dark","\u002F\u002F Standard library only\npackage main\n\nimport (\n    \"bufio\"\n    \"bytes\"\n    \"encoding\u002Fjson\"\n    \"fmt\"\n    \"net\u002Fhttp\"\n    \"os\"\n    \"strings\"\n)\n\nfunc main() {\n    payload := []byte(`{\n        \"model\": \"minimax-m2.5\",\n        \"messages\": [{\"role\": \"user\", \"content\": \"Write a short poem\"}],\n        \"stream\": true\n    }`)\n\n    req, err := http.NewRequest(\"POST\", \"https:\u002F\u002Fsilvamux.io\u002Fapi\u002Fv1\u002Fchat\u002Fcompletions\", bytes.NewReader(payload))\n    if err != nil {\n        panic(err)\n    }\n    req.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"SILVAMUX_API_KEY\"))\n    req.Header.Set(\"Content-Type\", \"application\u002Fjson\")\n\n    resp, err := http.DefaultClient.Do(req)\n    if err != nil {\n        panic(err)\n    }\n    defer resp.Body.Close()\n\n    scanner := bufio.NewScanner(resp.Body)\n    for scanner.Scan() {\n        line := scanner.Text()\n        if !strings.HasPrefix(line, \"data: \") {\n            continue\n        }\n        data := strings.TrimPrefix(line, \"data: \")\n        if data == \"[DONE]\" {\n            break\n        }\n        var chunk struct {\n            Choices []struct {\n                Delta struct {\n                    Content string `json:\"content\"`\n                } `json:\"delta\"`\n            } `json:\"choices\"`\n        }\n        if err := json.Unmarshal([]byte(data), &chunk); err != nil {\n            continue\n        }\n        if len(chunk.Choices) > 0 {\n            fmt.Print(chunk.Choices[0].Delta.Content)\n        }\n    }\n}\n","go",[242,831,832,837,842,846,851,856,861,866,871,876,881,886,890,894,899,904,909,914,919,924,928,933,939,945,951,957,963,968,974,979,984,989,995,1000,1006,1012,1018,1024,1030,1036,1042,1048,1054,1059,1065,1071,1077,1083,1089,1095,1100,1106,1111,1116,1122,1128,1133,1138],{"__ignoreMap":518},[522,833,834],{"class":524,"line":525},[522,835,836],{},"\u002F\u002F Standard library only\n",[522,838,839],{"class":524,"line":540},[522,840,841],{},"package main\n",[522,843,844],{"class":524,"line":558},[522,845,629],{"emptyLinePlaceholder":628},[522,847,848],{"class":524,"line":568},[522,849,850],{},"import (\n",[522,852,853],{"class":524,"line":577},[522,854,855],{},"    \"bufio\"\n",[522,857,858],{"class":524,"line":583},[522,859,860],{},"    \"bytes\"\n",[522,862,863],{"class":524,"line":589},[522,864,865],{},"    \"encoding\u002Fjson\"\n",[522,867,868],{"class":524,"line":595},[522,869,870],{},"    \"fmt\"\n",[522,872,873],{"class":524,"line":652},[522,874,875],{},"    \"net\u002Fhttp\"\n",[522,877,878],{"class":524,"line":657},[522,879,880],{},"    \"os\"\n",[522,882,883],{"class":524,"line":663},[522,884,885],{},"    \"strings\"\n",[522,887,888],{"class":524,"line":669},[522,889,649],{},[522,891,892],{"class":524,"line":675},[522,893,629],{"emptyLinePlaceholder":628},[522,895,896],{"class":524,"line":681},[522,897,898],{},"func main() {\n",[522,900,901],{"class":524,"line":686},[522,902,903],{},"    payload := []byte(`{\n",[522,905,906],{"class":524,"line":692},[522,907,908],{},"        \"model\": \"minimax-m2.5\",\n",[522,910,911],{"class":524,"line":698},[522,912,913],{},"        \"messages\": [{\"role\": \"user\", \"content\": \"Write a short poem\"}],\n",[522,915,916],{"class":524,"line":704},[522,917,918],{},"        \"stream\": true\n",[522,920,921],{"class":524,"line":710},[522,922,923],{},"    }`)\n",[522,925,926],{"class":524,"line":716},[522,927,629],{"emptyLinePlaceholder":628},[522,929,930],{"class":524,"line":722},[522,931,932],{},"    req, err := http.NewRequest(\"POST\", \"https:\u002F\u002Fsilvamux.io\u002Fapi\u002Fv1\u002Fchat\u002Fcompletions\", bytes.NewReader(payload))\n",[522,934,936],{"class":524,"line":935},22,[522,937,938],{},"    if err != nil {\n",[522,940,942],{"class":524,"line":941},23,[522,943,944],{},"        panic(err)\n",[522,946,948],{"class":524,"line":947},24,[522,949,950],{},"    }\n",[522,952,954],{"class":524,"line":953},25,[522,955,956],{},"    req.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"SILVAMUX_API_KEY\"))\n",[522,958,960],{"class":524,"line":959},26,[522,961,962],{},"    req.Header.Set(\"Content-Type\", \"application\u002Fjson\")\n",[522,964,966],{"class":524,"line":965},27,[522,967,629],{"emptyLinePlaceholder":628},[522,969,971],{"class":524,"line":970},28,[522,972,973],{},"    resp, err := http.DefaultClient.Do(req)\n",[522,975,977],{"class":524,"line":976},29,[522,978,938],{},[522,980,982],{"class":524,"line":981},30,[522,983,944],{},[522,985,987],{"class":524,"line":986},31,[522,988,950],{},[522,990,992],{"class":524,"line":991},32,[522,993,994],{},"    defer resp.Body.Close()\n",[522,996,998],{"class":524,"line":997},33,[522,999,629],{"emptyLinePlaceholder":628},[522,1001,1003],{"class":524,"line":1002},34,[522,1004,1005],{},"    scanner := bufio.NewScanner(resp.Body)\n",[522,1007,1009],{"class":524,"line":1008},35,[522,1010,1011],{},"    for scanner.Scan() {\n",[522,1013,1015],{"class":524,"line":1014},36,[522,1016,1017],{},"        line := scanner.Text()\n",[522,1019,1021],{"class":524,"line":1020},37,[522,1022,1023],{},"        if !strings.HasPrefix(line, \"data: \") {\n",[522,1025,1027],{"class":524,"line":1026},38,[522,1028,1029],{},"            continue\n",[522,1031,1033],{"class":524,"line":1032},39,[522,1034,1035],{},"        }\n",[522,1037,1039],{"class":524,"line":1038},40,[522,1040,1041],{},"        data := strings.TrimPrefix(line, \"data: \")\n",[522,1043,1045],{"class":524,"line":1044},41,[522,1046,1047],{},"        if data == \"[DONE]\" {\n",[522,1049,1051],{"class":524,"line":1050},42,[522,1052,1053],{},"            break\n",[522,1055,1057],{"class":524,"line":1056},43,[522,1058,1035],{},[522,1060,1062],{"class":524,"line":1061},44,[522,1063,1064],{},"        var chunk struct {\n",[522,1066,1068],{"class":524,"line":1067},45,[522,1069,1070],{},"            Choices []struct {\n",[522,1072,1074],{"class":524,"line":1073},46,[522,1075,1076],{},"                Delta struct {\n",[522,1078,1080],{"class":524,"line":1079},47,[522,1081,1082],{},"                    Content string `json:\"content\"`\n",[522,1084,1086],{"class":524,"line":1085},48,[522,1087,1088],{},"                } `json:\"delta\"`\n",[522,1090,1092],{"class":524,"line":1091},49,[522,1093,1094],{},"            } `json:\"choices\"`\n",[522,1096,1098],{"class":524,"line":1097},50,[522,1099,1035],{},[522,1101,1103],{"class":524,"line":1102},51,[522,1104,1105],{},"        if err := json.Unmarshal([]byte(data), &chunk); err != nil {\n",[522,1107,1109],{"class":524,"line":1108},52,[522,1110,1029],{},[522,1112,1114],{"class":524,"line":1113},53,[522,1115,1035],{},[522,1117,1119],{"class":524,"line":1118},54,[522,1120,1121],{},"        if len(chunk.Choices) > 0 {\n",[522,1123,1125],{"class":524,"line":1124},55,[522,1126,1127],{},"            fmt.Print(chunk.Choices[0].Delta.Content)\n",[522,1129,1131],{"class":524,"line":1130},56,[522,1132,1035],{},[522,1134,1136],{"class":524,"line":1135},57,[522,1137,950],{},[522,1139,1141],{"class":524,"line":1140},58,[522,1142,821],{},[204,1144,1146],{"id":1145},"multimodal","Multimodal",[191,1148,1149,1150,465],{},"For image, audio, and other multimodal input formats, see ",[248,1151,140],{"href":1152},"\u002Fen\u002Fdocs\u002Fmodels\u002Fchat\u002Fmultimodal",[1154,1155,1156],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":518,"searchDepth":540,"depth":540,"links":1158},[1159,1162,1163,1164,1165],{"id":206,"depth":540,"text":207,"children":1160},[1161],{"id":327,"depth":558,"text":328},{"id":339,"depth":540,"text":340},{"id":468,"depth":540,"text":469},{"id":480,"depth":540,"text":481},{"id":1145,"depth":540,"text":1146},"Unified entry and OpenAI, Anthropic, Volcengine, Responses, and Zhipu compatible entries.","md",{},"---\ntitle: Overview\ndescription: Unified entry and OpenAI, Anthropic, Volcengine, Responses, and Zhipu compatible entries.\n---\n\n# Text Generation Models\n\nSilvaMux supports multiple **vendor-protocol compatible entries** plus an optional **unified entry**. New projects should integrate via the vendor protocol their target model supports; projects using the OpenAI SDK should default to the OpenAI Chat Completions compatible entry.\n\n## Vendor Protocol Compatible Entries (Recommended)\n\nThe endpoints below accept the corresponding vendor's request format and preserve the matching response and error structures — ideal for official SDKs, existing code migration, or field-level pass-through.\n\n| Compatible format | Endpoint | Docs |\n| --- | --- | --- |\n| OpenAI Chat Completions | `POST \u002Fapi\u002Fv1\u002Fchat\u002Fcompletions` | [OpenAI Compatible API](\u002Fen\u002Fdocs\u002Fmodels\u002Fchat\u002Fopenai) |\n| Anthropic | `POST \u002Fapi\u002Fv1\u002Fmessages` | [Anthropic Compatible](\u002Fen\u002Fdocs\u002Fmodels\u002Fchat\u002Fanthropic) |\n| Volcengine v3 | `POST \u002Fapi\u002Fv3\u002Fchat\u002Fcompletions` | [Volcengine Compatible](\u002Fen\u002Fdocs\u002Fmodels\u002Fchat\u002Fvolcengine) |\n| Zhipu | `POST \u002Fapi\u002Fpaas\u002Fv4\u002Fchat\u002Fcompletions` | [Zhipu Compatible](\u002Fen\u002Fdocs\u002Fmodels\u002Fchat\u002Fzhipu) |\n| SilvaMux unified entry | `POST \u002Fapi\u002Fv0\u002Fchat\u002Fcompletions` | [SilvaMux Unified Entry](\u002Fen\u002Fdocs\u002Fmodels\u002Fchat\u002Funified) |\n| Responses | `POST \u002Fapi\u002Fv1\u002Fresponses` | Compatible with the OpenAI Responses API; for supported models (e.g. the codex series) |\n\n### OpenAI Responses\n\nCompatible with the OpenAI Responses API; for supported models (e.g. the codex series):\n\n::api-endpoint{path=\"\u002Fapi\u002Fv1\u002Fresponses\" method=\"POST\"}\n::\n\n## Common Parameters\n\nCommon parameters for OpenAI Chat and the unified entry:\n\n| Parameter | Type | Description |\n| --- | --- | --- |\n| `model` | string | Required. Model call name (`id` or `alias`), e.g. `minimax-m2.5`, `doubao-seed-2.0-pro` |\n| `messages` | array | Required. Message list, same shape as OpenAI (`role` + `content`) |\n| `stream` | boolean | Whether to stream the response; default `false` |\n| `temperature` | number | Sampling temperature; default 1.0 |\n| `max_tokens` | integer | Maximum generated tokens |\n\n> Field structures differ per vendor protocol. First filter the [Model Plaza](\u002Fen\u002Fmodels) for models supporting your target format, then copy the call name from the detail page into `model`.\n\n## Authentication\n\n`Authorization: Bearer \u003CAPI_KEY>` or `x-api-key: \u003CAPI_KEY>`.\n\n## Streaming\n\nSet `stream: true` to get a streaming response (SSE). The response is `text\u002Fevent-stream`, each event starting with `data: `. You may eventually receive a usage chunk with an empty `choices`, after which the server closes the connection; do not rely solely on `data: [DONE]` to detect completion. Anthropic-format streaming follows the Anthropic SSE specification.\n\n::code-tabs\n:::code-tab{label=\"cURL\"}\n```bash\ncurl https:\u002F\u002Fsilvamux.io\u002Fapi\u002Fv1\u002Fchat\u002Fcompletions \\\n  -H \"Authorization: Bearer $SILVAMUX_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"model\": \"minimax-m2.5\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Write a short poem\"}],\n    \"stream\": true\n  }'\n```\n:::\n:::code-tab{label=\"Python\"}\n```python\n# pip install openai\nimport os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=os.environ[\"SILVAMUX_API_KEY\"],\n    base_url=\"https:\u002F\u002Fsilvamux.io\u002Fapi\u002Fv1\",\n)\n\nstream = client.chat.completions.create(\n    model=\"minimax-m2.5\",\n    messages=[{\"role\": \"user\", \"content\": \"Write a short poem\"}],\n    stream=True,\n)\nfor chunk in stream:\n    if chunk.choices:\n        delta = chunk.choices[0].delta.content\n        if delta:\n            print(delta, end=\"\", flush=True)\n    if chunk.usage:\n        print(f\"\\nUsage: {chunk.usage}\")\n```\n:::\n:::code-tab{label=\"JavaScript\"}\n```javascript\n\u002F\u002F npm install openai\nimport OpenAI from \"openai\";\n\nconst client = new OpenAI({\n  apiKey: process.env.SILVAMUX_API_KEY,\n  baseURL: \"https:\u002F\u002Fsilvamux.io\u002Fapi\u002Fv1\",\n});\n\nconst stream = await client.chat.completions.create({\n  model: \"minimax-m2.5\",\n  messages: [{ role: \"user\", content: \"Write a short poem\" }],\n  stream: true,\n});\n\nfor await (const chunk of stream) {\n  const delta = chunk.choices[0]?.delta?.content;\n  if (delta) process.stdout.write(delta);\n}\n```\n:::\n:::code-tab{label=\"Go\"}\n```go\n\u002F\u002F Standard library only\npackage main\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"encoding\u002Fjson\"\n\t\"fmt\"\n\t\"net\u002Fhttp\"\n\t\"os\"\n\t\"strings\"\n)\n\nfunc main() {\n\tpayload := []byte(`{\n\t\t\"model\": \"minimax-m2.5\",\n\t\t\"messages\": [{\"role\": \"user\", \"content\": \"Write a short poem\"}],\n\t\t\"stream\": true\n\t}`)\n\n\treq, err := http.NewRequest(\"POST\", \"https:\u002F\u002Fsilvamux.io\u002Fapi\u002Fv1\u002Fchat\u002Fcompletions\", bytes.NewReader(payload))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"SILVAMUX_API_KEY\"))\n\treq.Header.Set(\"Content-Type\", \"application\u002Fjson\")\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\tscanner := bufio.NewScanner(resp.Body)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif !strings.HasPrefix(line, \"data: \") {\n\t\t\tcontinue\n\t\t}\n\t\tdata := strings.TrimPrefix(line, \"data: \")\n\t\tif data == \"[DONE]\" {\n\t\t\tbreak\n\t\t}\n\t\tvar chunk struct {\n\t\t\tChoices []struct {\n\t\t\t\tDelta struct {\n\t\t\t\t\tContent string `json:\"content\"`\n\t\t\t\t} `json:\"delta\"`\n\t\t\t} `json:\"choices\"`\n\t\t}\n\t\tif err := json.Unmarshal([]byte(data), &chunk); err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif len(chunk.Choices) > 0 {\n\t\t\tfmt.Print(chunk.Choices[0].Delta.Content)\n\t\t}\n\t}\n}\n```\n:::\n::\n\n## Multimodal\n\nFor image, audio, and other multimodal input formats, see [Multimodal Input](\u002Fen\u002Fdocs\u002Fmodels\u002Fchat\u002Fmultimodal).\n",[],{"title":116,"description":1166},"_Pq4uhd6QgdJUnX4Al2iRRlDf_PNftpTpjOeT1Ppx80",{"found":628,"operationId":1174,"summary":328,"description":518,"method":335,"path":336,"publiclyDiscoverable":628,"security":1175,"parameters":1179,"requestBody":1180,"responses":1191},"createOpenAIResponse",{"schemes":1176,"optional":25},[1177,1178],"BearerAuth","ApiKeyAuth",[],{"present":628,"required":628,"description":518,"contentType":1181,"type":1182,"fields":1183,"variants":1190},"application\u002Fjson","ResponsesRequest",[1184,1187,1189],{"name":1185,"type":1186,"required":628,"description":518},"input","string | array\u003CFreeFormObject>",{"name":367,"type":370,"required":628,"description":1188},"从模型广场选择标注支持 OpenAI Responses 的模型并复制调用名。",{"name":416,"type":419,"required":25,"description":518,"defaultValue":425},[],[1192,1197],{"status":1193,"description":1194,"contentType":1181,"type":1195,"fields":1196},"200","Responses JSON 或 SSE 响应。","FreeFormObject",[],{"status":1198,"description":1199,"contentType":1181,"type":1200,"fields":1201},"default","OpenAI 兼容错误。","OpenAIError",[1202,1205,1208,1210],{"name":1203,"type":1204,"required":628,"description":518},"error","object",{"name":1206,"type":1207,"required":25,"description":518},"error.code","string | integer",{"name":1209,"type":370,"required":628,"description":518},"error.message",{"name":1211,"type":370,"required":25,"description":518},"error.type"]