{"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../../src/providers/cloudflare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,qFAAqF;AACrF,eAAO,MAAM,8BAA8B,gFACmC,CAAC;AAE/E,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,gFAAgF;AAChF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAC,GAAG,MAAM,CAUnF","sourcesContent":["import type { Model } from \"../types.js\";\n\n/** Workers AI endpoint. `{CLOUDFLARE_ACCOUNT_ID}` is substituted at request time. */\nexport const CLOUDFLARE_WORKERS_AI_BASE_URL =\n\t\"https://api.cloudflare.com/client/v4/accounts/{CLOUDFLARE_ACCOUNT_ID}/ai/v1\";\n\nexport function isCloudflareProvider(provider: string): boolean {\n\treturn provider === \"cloudflare-workers-ai\";\n}\n\n/** Substitute `{VAR}` placeholders in a Cloudflare baseUrl from process.env. */\nexport function resolveCloudflareBaseUrl(model: Model<\"openai-completions\">): string {\n\tconst url = model.baseUrl;\n\tif (!url.includes(\"{\")) return url;\n\treturn url.replace(/\\{([A-Z_][A-Z0-9_]*)\\}/g, (_match, name: string) => {\n\t\tconst value = process.env[name];\n\t\tif (!value) {\n\t\t\tthrow new Error(`${name} is required for provider ${model.provider} but is not set.`);\n\t\t}\n\t\treturn value;\n\t});\n}\n"]}