import{g as i}from"./env-api-keys.browser-DGvvjVWg.js";import{a}from"./index-3wjvth7D.js";import{streamOpenAIChatCompletions as m}from"./openai-completions-DjTaE95D.js";import{b as f}from"./transform-messages-B_np3yTy.js";import"./vendor-katex-6s3QXDY8.js";import"./vendor-pdfjs-9liOkivS.js";import"./vendor-automerge-Dpota_ma.js";import"./vendor-socket-BkL6vOXg.js";import"./client-Sq9UPDIz.js";import"./headers-CgnjaPPL.js";import"./json-parse-DUjbyQwB.js";import"./sanitize-unicode-B62XMGgN.js";import"./github-copilot-headers-CVWOSrQr.js";const l="/api/modelhub/online/v2/crawl",u={supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,supportsUsageInStreaming:!0,maxTokensField:"max_tokens",supportsStrictMode:!1,supportsLongCacheRetention:!1};function n(o,r){const e=r?.apiKey||i(o.provider)||i();if(!e)throw new Error(`No API key for provider: ${o.provider}. Set MODELHUB_AK or MODELHUB_API_KEY.`);return e}const c=(o,r,e)=>{const t=n(o,e);return m(o,r,{...e,apiKey:t},{compat:u,clientHeaders:{Authorization:null},requestOptions:{path:l,query:{ak:t}}})},_=(o,r,e)=>{const t=n(o,e),p=f(o,e,t),s=e?.reasoning?a(o,e.reasoning):void 0;return c(o,r,{...p,reasoningEffort:s==="off"?void 0:s})};export{c as streamModelHubCompletions,_ as streamSimpleModelHubCompletions};
