@earendil-works/pi-ai 0.80.9 → 0.81.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/README.md +4 -2
  2. package/dist/api/openai-codex-responses.d.ts.map +1 -1
  3. package/dist/api/openai-codex-responses.js +2 -7
  4. package/dist/api/openai-codex-responses.js.map +1 -1
  5. package/dist/api/openai-completions.d.ts.map +1 -1
  6. package/dist/api/openai-completions.js +14 -2
  7. package/dist/api/openai-completions.js.map +1 -1
  8. package/dist/api/pi-messages.d.ts.map +1 -1
  9. package/dist/api/pi-messages.js +2 -4
  10. package/dist/api/pi-messages.js.map +1 -1
  11. package/dist/auth/helpers.d.ts.map +1 -1
  12. package/dist/auth/helpers.js +3 -2
  13. package/dist/auth/helpers.js.map +1 -1
  14. package/dist/env-api-keys.d.ts.map +1 -1
  15. package/dist/env-api-keys.js +2 -0
  16. package/dist/env-api-keys.js.map +1 -1
  17. package/dist/image-models.generated.d.ts +60 -0
  18. package/dist/image-models.generated.d.ts.map +1 -1
  19. package/dist/image-models.generated.js +236 -176
  20. package/dist/image-models.generated.js.map +1 -1
  21. package/dist/index.d.ts +2 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +2 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/models-store.d.ts +2 -0
  26. package/dist/models-store.d.ts.map +1 -1
  27. package/dist/models-store.js.map +1 -1
  28. package/dist/models.generated.d.ts +4379 -22338
  29. package/dist/models.generated.d.ts.map +1 -1
  30. package/dist/models.generated.js +4 -0
  31. package/dist/models.generated.js.map +1 -1
  32. package/dist/providers/all.d.ts +2 -0
  33. package/dist/providers/all.d.ts.map +1 -1
  34. package/dist/providers/all.js +8 -0
  35. package/dist/providers/all.js.map +1 -1
  36. package/dist/providers/amazon-bedrock.d.ts.map +1 -1
  37. package/dist/providers/amazon-bedrock.js +3 -2
  38. package/dist/providers/amazon-bedrock.js.map +1 -1
  39. package/dist/providers/amazon-bedrock.models.d.ts +436 -1988
  40. package/dist/providers/amazon-bedrock.models.d.ts.map +1 -1
  41. package/dist/providers/amazon-bedrock.models.js +2 -1892
  42. package/dist/providers/amazon-bedrock.models.js.map +1 -1
  43. package/dist/providers/ant-ling.models.d.ts +10 -80
  44. package/dist/providers/ant-ling.models.d.ts.map +1 -1
  45. package/dist/providers/ant-ling.models.js +2 -57
  46. package/dist/providers/ant-ling.models.js.map +1 -1
  47. package/dist/providers/anthropic.models.d.ts +43 -267
  48. package/dist/providers/anthropic.models.d.ts.map +1 -1
  49. package/dist/providers/anthropic.models.js +2 -252
  50. package/dist/providers/anthropic.models.js.map +1 -1
  51. package/dist/providers/azure-openai-responses.models.d.ts +184 -883
  52. package/dist/providers/azure-openai-responses.models.d.ts.map +1 -1
  53. package/dist/providers/azure-openai-responses.models.js +2 -811
  54. package/dist/providers/azure-openai-responses.models.js.map +1 -1
  55. package/dist/providers/cerebras.models.d.ts +10 -60
  56. package/dist/providers/cerebras.models.d.ts.map +1 -1
  57. package/dist/providers/cerebras.models.js +2 -56
  58. package/dist/providers/cerebras.models.js.map +1 -1
  59. package/dist/providers/cloudflare-ai-gateway.models.d.ts +168 -884
  60. package/dist/providers/cloudflare-ai-gateway.models.d.ts.map +1 -1
  61. package/dist/providers/cloudflare-ai-gateway.models.js +2 -755
  62. package/dist/providers/cloudflare-ai-gateway.models.js.map +1 -1
  63. package/dist/providers/cloudflare-workers-ai.models.d.ts +40 -286
  64. package/dist/providers/cloudflare-workers-ai.models.d.ts.map +1 -1
  65. package/dist/providers/cloudflare-workers-ai.models.js +2 -236
  66. package/dist/providers/cloudflare-workers-ai.models.js.map +1 -1
  67. package/dist/providers/data/.manifest.json +1 -0
  68. package/dist/providers/data/amazon-bedrock.json +1 -0
  69. package/dist/providers/data/ant-ling.json +1 -0
  70. package/dist/providers/data/anthropic.json +1 -0
  71. package/dist/providers/data/azure-openai-responses.json +1 -0
  72. package/dist/providers/data/cerebras.json +1 -0
  73. package/dist/providers/data/cloudflare-ai-gateway.json +1 -0
  74. package/dist/providers/data/cloudflare-workers-ai.json +1 -0
  75. package/dist/providers/data/deepseek.json +1 -0
  76. package/dist/providers/data/fireworks.json +1 -0
  77. package/dist/providers/data/github-copilot.json +1 -0
  78. package/dist/providers/data/google-vertex.json +1 -0
  79. package/dist/providers/data/google.json +1 -0
  80. package/dist/providers/data/groq.json +1 -0
  81. package/dist/providers/data/huggingface.json +1 -0
  82. package/dist/providers/data/kimi-coding.json +1 -0
  83. package/dist/providers/data/minimax-cn.json +1 -0
  84. package/dist/providers/data/minimax.json +1 -0
  85. package/dist/providers/data/mistral.json +1 -0
  86. package/dist/providers/data/moonshotai-cn.json +1 -0
  87. package/dist/providers/data/moonshotai.json +1 -0
  88. package/dist/providers/data/nvidia.json +1 -0
  89. package/dist/providers/data/openai-codex.json +1 -0
  90. package/dist/providers/data/openai.json +1 -0
  91. package/dist/providers/data/opencode-go.json +1 -0
  92. package/dist/providers/data/opencode.json +1 -0
  93. package/dist/providers/data/openrouter.json +1 -0
  94. package/dist/providers/data/qwen-token-plan-cn.json +1 -0
  95. package/dist/providers/data/qwen-token-plan.json +1 -0
  96. package/dist/providers/data/together.json +1 -0
  97. package/dist/providers/data/vercel-ai-gateway.json +1 -0
  98. package/dist/providers/data/xai.json +1 -0
  99. package/dist/providers/data/xiaomi-token-plan-ams.json +1 -0
  100. package/dist/providers/data/xiaomi-token-plan-cn.json +1 -0
  101. package/dist/providers/data/xiaomi-token-plan-sgp.json +1 -0
  102. package/dist/providers/data/xiaomi.json +1 -0
  103. package/dist/providers/data/zai-coding-cn.json +1 -0
  104. package/dist/providers/data/zai.json +1 -0
  105. package/dist/providers/deepseek.models.d.ts +7 -58
  106. package/dist/providers/deepseek.models.d.ts.map +1 -1
  107. package/dist/providers/deepseek.models.js +2 -40
  108. package/dist/providers/deepseek.models.js.map +1 -1
  109. package/dist/providers/fireworks.models.d.ts +49 -362
  110. package/dist/providers/fireworks.models.d.ts.map +1 -1
  111. package/dist/providers/fireworks.models.js +2 -292
  112. package/dist/providers/fireworks.models.js.map +1 -1
  113. package/dist/providers/github-copilot.models.d.ts +85 -760
  114. package/dist/providers/github-copilot.models.d.ts.map +1 -1
  115. package/dist/providers/github-copilot.models.js +2 -538
  116. package/dist/providers/github-copilot.models.js.map +1 -1
  117. package/dist/providers/google-vertex.models.d.ts +31 -189
  118. package/dist/providers/google-vertex.models.d.ts.map +1 -1
  119. package/dist/providers/google-vertex.models.js +2 -179
  120. package/dist/providers/google-vertex.models.js.map +1 -1
  121. package/dist/providers/google.models.d.ts +49 -309
  122. package/dist/providers/google.models.d.ts.map +1 -1
  123. package/dist/providers/google.models.js +2 -285
  124. package/dist/providers/google.models.js.map +1 -1
  125. package/dist/providers/groq.models.d.ts +22 -118
  126. package/dist/providers/groq.models.d.ts.map +1 -1
  127. package/dist/providers/groq.models.js +2 -122
  128. package/dist/providers/groq.models.js.map +1 -1
  129. package/dist/providers/huggingface.models.d.ts +196 -979
  130. package/dist/providers/huggingface.models.d.ts.map +1 -1
  131. package/dist/providers/huggingface.models.js +2 -884
  132. package/dist/providers/huggingface.models.js.map +1 -1
  133. package/dist/providers/kimi-coding.models.d.ts +10 -97
  134. package/dist/providers/kimi-coding.models.d.ts.map +1 -1
  135. package/dist/providers/kimi-coding.models.js +2 -92
  136. package/dist/providers/kimi-coding.models.js.map +1 -1
  137. package/dist/providers/minimax-cn.models.d.ts +10 -48
  138. package/dist/providers/minimax-cn.models.d.ts.map +1 -1
  139. package/dist/providers/minimax-cn.models.js +2 -53
  140. package/dist/providers/minimax-cn.models.js.map +1 -1
  141. package/dist/providers/minimax.models.d.ts +10 -48
  142. package/dist/providers/minimax.models.d.ts.map +1 -1
  143. package/dist/providers/minimax.models.js +2 -53
  144. package/dist/providers/minimax.models.js.map +1 -1
  145. package/dist/providers/mistral.models.d.ts +91 -480
  146. package/dist/providers/mistral.models.d.ts.map +1 -1
  147. package/dist/providers/mistral.models.js +2 -512
  148. package/dist/providers/mistral.models.js.map +1 -1
  149. package/dist/providers/moonshotai-cn.models.d.ts +31 -257
  150. package/dist/providers/moonshotai-cn.models.d.ts.map +1 -1
  151. package/dist/providers/moonshotai-cn.models.js +2 -185
  152. package/dist/providers/moonshotai-cn.models.js.map +1 -1
  153. package/dist/providers/moonshotai.models.d.ts +31 -257
  154. package/dist/providers/moonshotai.models.d.ts.map +1 -1
  155. package/dist/providers/moonshotai.models.js +2 -185
  156. package/dist/providers/moonshotai.models.js.map +1 -1
  157. package/dist/providers/nvidia.models.d.ts +58 -541
  158. package/dist/providers/nvidia.models.d.ts.map +1 -1
  159. package/dist/providers/nvidia.models.js +2 -382
  160. package/dist/providers/nvidia.models.js.map +1 -1
  161. package/dist/providers/openai-codex.models.d.ts +22 -196
  162. package/dist/providers/openai-codex.models.d.ts.map +1 -1
  163. package/dist/providers/openai-codex.models.js +2 -139
  164. package/dist/providers/openai-codex.models.js.map +1 -1
  165. package/dist/providers/openai.models.d.ts +184 -954
  166. package/dist/providers/openai.models.d.ts.map +1 -1
  167. package/dist/providers/openai.models.js +2 -825
  168. package/dist/providers/openai.models.js.map +1 -1
  169. package/dist/providers/opencode-go.d.ts +1 -1
  170. package/dist/providers/opencode-go.d.ts.map +1 -1
  171. package/dist/providers/opencode-go.js +2 -0
  172. package/dist/providers/opencode-go.js.map +1 -1
  173. package/dist/providers/opencode-go.models.d.ts +48 -293
  174. package/dist/providers/opencode-go.models.d.ts.map +1 -1
  175. package/dist/providers/opencode-go.models.js +2 -237
  176. package/dist/providers/opencode-go.models.js.map +1 -1
  177. package/dist/providers/opencode.models.d.ts +160 -1185
  178. package/dist/providers/opencode.models.d.ts.map +1 -1
  179. package/dist/providers/opencode.models.js +2 -996
  180. package/dist/providers/opencode.models.js.map +1 -1
  181. package/dist/providers/openrouter.models.d.ts +1076 -5750
  182. package/dist/providers/openrouter.models.d.ts.map +1 -1
  183. package/dist/providers/openrouter.models.js +2 -4910
  184. package/dist/providers/openrouter.models.js.map +1 -1
  185. package/dist/providers/qwen-token-plan-cn.d.ts +3 -0
  186. package/dist/providers/qwen-token-plan-cn.d.ts.map +1 -0
  187. package/dist/providers/qwen-token-plan-cn.js +15 -0
  188. package/dist/providers/qwen-token-plan-cn.js.map +1 -0
  189. package/dist/providers/qwen-token-plan-cn.models.d.ts +64 -0
  190. package/dist/providers/qwen-token-plan-cn.models.d.ts.map +1 -0
  191. package/dist/providers/qwen-token-plan-cn.models.js +5 -0
  192. package/dist/providers/qwen-token-plan-cn.models.js.map +1 -0
  193. package/dist/providers/qwen-token-plan.d.ts +3 -0
  194. package/dist/providers/qwen-token-plan.d.ts.map +1 -0
  195. package/dist/providers/qwen-token-plan.js +15 -0
  196. package/dist/providers/qwen-token-plan.js.map +1 -0
  197. package/dist/providers/qwen-token-plan.models.d.ts +64 -0
  198. package/dist/providers/qwen-token-plan.models.d.ts.map +1 -0
  199. package/dist/providers/qwen-token-plan.models.js +5 -0
  200. package/dist/providers/qwen-token-plan.models.js.map +1 -0
  201. package/dist/providers/radius-config.d.ts.map +1 -1
  202. package/dist/providers/radius-config.js +18 -14
  203. package/dist/providers/radius-config.js.map +1 -1
  204. package/dist/providers/together.models.d.ts +49 -579
  205. package/dist/providers/together.models.d.ts.map +1 -1
  206. package/dist/providers/together.models.js +2 -377
  207. package/dist/providers/together.models.js.map +1 -1
  208. package/dist/providers/vercel-ai-gateway.models.d.ts +752 -3336
  209. package/dist/providers/vercel-ai-gateway.models.d.ts.map +1 -1
  210. package/dist/providers/vercel-ai-gateway.models.js +2 -3263
  211. package/dist/providers/vercel-ai-gateway.models.js.map +1 -1
  212. package/dist/providers/xai.models.d.ts +10 -175
  213. package/dist/providers/xai.models.d.ts.map +1 -1
  214. package/dist/providers/xai.models.js +2 -147
  215. package/dist/providers/xai.models.js.map +1 -1
  216. package/dist/providers/xiaomi-token-plan-ams.models.d.ts +10 -60
  217. package/dist/providers/xiaomi-token-plan-ams.models.d.ts.map +1 -1
  218. package/dist/providers/xiaomi-token-plan-ams.models.js +2 -56
  219. package/dist/providers/xiaomi-token-plan-ams.models.js.map +1 -1
  220. package/dist/providers/xiaomi-token-plan-cn.models.d.ts +10 -60
  221. package/dist/providers/xiaomi-token-plan-cn.models.d.ts.map +1 -1
  222. package/dist/providers/xiaomi-token-plan-cn.models.js +2 -56
  223. package/dist/providers/xiaomi-token-plan-cn.models.js.map +1 -1
  224. package/dist/providers/xiaomi-token-plan-sgp.models.d.ts +10 -60
  225. package/dist/providers/xiaomi-token-plan-sgp.models.d.ts.map +1 -1
  226. package/dist/providers/xiaomi-token-plan-sgp.models.js +2 -56
  227. package/dist/providers/xiaomi-token-plan-sgp.models.js.map +1 -1
  228. package/dist/providers/xiaomi.models.d.ts +19 -120
  229. package/dist/providers/xiaomi.models.d.ts.map +1 -1
  230. package/dist/providers/xiaomi.models.js +2 -110
  231. package/dist/providers/xiaomi.models.js.map +1 -1
  232. package/dist/providers/zai-coding-cn.models.d.ts +19 -144
  233. package/dist/providers/zai-coding-cn.models.d.ts.map +1 -1
  234. package/dist/providers/zai-coding-cn.models.js +2 -111
  235. package/dist/providers/zai-coding-cn.models.js.map +1 -1
  236. package/dist/providers/zai.models.d.ts +19 -144
  237. package/dist/providers/zai.models.d.ts.map +1 -1
  238. package/dist/providers/zai.models.js +2 -111
  239. package/dist/providers/zai.models.js.map +1 -1
  240. package/dist/types.d.ts +3 -1
  241. package/dist/types.d.ts.map +1 -1
  242. package/dist/types.js.map +1 -1
  243. package/dist/utils/overflow.d.ts +1 -0
  244. package/dist/utils/overflow.d.ts.map +1 -1
  245. package/dist/utils/overflow.js +3 -0
  246. package/dist/utils/overflow.js.map +1 -1
  247. package/dist/utils/retry.d.ts.map +1 -1
  248. package/dist/utils/retry.js +1 -0
  249. package/dist/utils/retry.js.map +1 -1
  250. package/dist/utils/text.d.ts +6 -0
  251. package/dist/utils/text.d.ts.map +1 -0
  252. package/dist/utils/text.js +10 -0
  253. package/dist/utils/text.js.map +1 -0
  254. package/dist/utils/uuid.d.ts +3 -0
  255. package/dist/utils/uuid.d.ts.map +1 -0
  256. package/dist/utils/uuid.js +46 -0
  257. package/dist/utils/uuid.js.map +1 -0
  258. package/package.json +8 -5
@@ -0,0 +1,3 @@
1
+ import { type Provider } from "../models.ts";
2
+ export declare function qwenTokenPlanCnProvider(): Provider<"openai-completions">;
3
+ //# sourceMappingURL=qwen-token-plan-cn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qwen-token-plan-cn.d.ts","sourceRoot":"","sources":["../../src/providers/qwen-token-plan-cn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7D,wBAAgB,uBAAuB,IAAI,QAAQ,CAAC,oBAAoB,CAAC,CASxE","sourcesContent":["import { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { QWEN_TOKEN_PLAN_CN_MODELS } from \"./qwen-token-plan-cn.models.ts\";\n\nexport function qwenTokenPlanCnProvider(): Provider<\"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"qwen-token-plan-cn\",\n\t\tname: \"Qwen Token Plan CN\",\n\t\tbaseUrl: \"https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Qwen Token Plan CN API key\", [\"QWEN_TOKEN_PLAN_CN_API_KEY\"]) },\n\t\tmodels: Object.values(QWEN_TOKEN_PLAN_CN_MODELS),\n\t\tapi: openAICompletionsApi(),\n\t});\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { openAICompletionsApi } from "../api/openai-completions.lazy.js";
2
+ import { envApiKeyAuth } from "../auth/helpers.js";
3
+ import { createProvider } from "../models.js";
4
+ import { QWEN_TOKEN_PLAN_CN_MODELS } from "./qwen-token-plan-cn.models.js";
5
+ export function qwenTokenPlanCnProvider() {
6
+ return createProvider({
7
+ id: "qwen-token-plan-cn",
8
+ name: "Qwen Token Plan CN",
9
+ baseUrl: "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
10
+ auth: { apiKey: envApiKeyAuth("Qwen Token Plan CN API key", ["QWEN_TOKEN_PLAN_CN_API_KEY"]) },
11
+ models: Object.values(QWEN_TOKEN_PLAN_CN_MODELS),
12
+ api: openAICompletionsApi(),
13
+ });
14
+ }
15
+ //# sourceMappingURL=qwen-token-plan-cn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qwen-token-plan-cn.js","sourceRoot":"","sources":["../../src/providers/qwen-token-plan-cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,MAAM,UAAU,uBAAuB,GAAmC;IACzE,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,oBAAoB;QACxB,IAAI,EAAE,oBAAoB;QAC1B,OAAO,EAAE,oEAAoE;QAC7E,IAAI,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,4BAA4B,EAAE,CAAC,4BAA4B,CAAC,CAAC,EAAE;QAC7F,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,yBAAyB,CAAC;QAChD,GAAG,EAAE,oBAAoB,EAAE;KAC3B,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { QWEN_TOKEN_PLAN_CN_MODELS } from \"./qwen-token-plan-cn.models.ts\";\n\nexport function qwenTokenPlanCnProvider(): Provider<\"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"qwen-token-plan-cn\",\n\t\tname: \"Qwen Token Plan CN\",\n\t\tbaseUrl: \"https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Qwen Token Plan CN API key\", [\"QWEN_TOKEN_PLAN_CN_API_KEY\"]) },\n\t\tmodels: Object.values(QWEN_TOKEN_PLAN_CN_MODELS),\n\t\tapi: openAICompletionsApi(),\n\t});\n}\n"]}
@@ -0,0 +1,64 @@
1
+ import type { Model } from "../types.ts";
2
+ export declare const QWEN_TOKEN_PLAN_CN_MODELS: {
3
+ "MiniMax-M2.5": Model<"openai-completions"> & {
4
+ id: "MiniMax-M2.5";
5
+ provider: "qwen-token-plan-cn";
6
+ };
7
+ "deepseek-v3.2": Model<"openai-completions"> & {
8
+ id: "deepseek-v3.2";
9
+ provider: "qwen-token-plan-cn";
10
+ };
11
+ "deepseek-v4-flash": Model<"openai-completions"> & {
12
+ id: "deepseek-v4-flash";
13
+ provider: "qwen-token-plan-cn";
14
+ };
15
+ "deepseek-v4-pro": Model<"openai-completions"> & {
16
+ id: "deepseek-v4-pro";
17
+ provider: "qwen-token-plan-cn";
18
+ };
19
+ "glm-5": Model<"openai-completions"> & {
20
+ id: "glm-5";
21
+ provider: "qwen-token-plan-cn";
22
+ };
23
+ "glm-5.1": Model<"openai-completions"> & {
24
+ id: "glm-5.1";
25
+ provider: "qwen-token-plan-cn";
26
+ };
27
+ "glm-5.2": Model<"openai-completions"> & {
28
+ id: "glm-5.2";
29
+ provider: "qwen-token-plan-cn";
30
+ };
31
+ "kimi-k2.5": Model<"openai-completions"> & {
32
+ id: "kimi-k2.5";
33
+ provider: "qwen-token-plan-cn";
34
+ };
35
+ "kimi-k2.6": Model<"openai-completions"> & {
36
+ id: "kimi-k2.6";
37
+ provider: "qwen-token-plan-cn";
38
+ };
39
+ "kimi-k2.7-code": Model<"openai-completions"> & {
40
+ id: "kimi-k2.7-code";
41
+ provider: "qwen-token-plan-cn";
42
+ };
43
+ "qwen3.6-flash": Model<"openai-completions"> & {
44
+ id: "qwen3.6-flash";
45
+ provider: "qwen-token-plan-cn";
46
+ };
47
+ "qwen3.6-plus": Model<"openai-completions"> & {
48
+ id: "qwen3.6-plus";
49
+ provider: "qwen-token-plan-cn";
50
+ };
51
+ "qwen3.7-max": Model<"openai-completions"> & {
52
+ id: "qwen3.7-max";
53
+ provider: "qwen-token-plan-cn";
54
+ };
55
+ "qwen3.7-plus": Model<"openai-completions"> & {
56
+ id: "qwen3.7-plus";
57
+ provider: "qwen-token-plan-cn";
58
+ };
59
+ "qwen3.8-max-preview": Model<"openai-completions"> & {
60
+ id: "qwen3.8-max-preview";
61
+ provider: "qwen-token-plan-cn";
62
+ };
63
+ };
64
+ //# sourceMappingURL=qwen-token-plan-cn.models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qwen-token-plan-cn.models.d.ts","sourceRoot":"","sources":["../../src/providers/qwen-token-plan-cn.models.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DrC,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport values from \"./data/qwen-token-plan-cn.json\" with { type: \"json\" };\nimport type { Model } from \"../types.ts\";\n\nexport const QWEN_TOKEN_PLAN_CN_MODELS = values as {\n\t\"MiniMax-M2.5\": Model<\"openai-completions\"> & {\n\t\tid: \"MiniMax-M2.5\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"deepseek-v3.2\": Model<\"openai-completions\"> & {\n\t\tid: \"deepseek-v3.2\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"deepseek-v4-flash\": Model<\"openai-completions\"> & {\n\t\tid: \"deepseek-v4-flash\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"deepseek-v4-pro\": Model<\"openai-completions\"> & {\n\t\tid: \"deepseek-v4-pro\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"glm-5\": Model<\"openai-completions\"> & {\n\t\tid: \"glm-5\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"glm-5.1\": Model<\"openai-completions\"> & {\n\t\tid: \"glm-5.1\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"glm-5.2\": Model<\"openai-completions\"> & {\n\t\tid: \"glm-5.2\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"kimi-k2.5\": Model<\"openai-completions\"> & {\n\t\tid: \"kimi-k2.5\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"kimi-k2.6\": Model<\"openai-completions\"> & {\n\t\tid: \"kimi-k2.6\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"kimi-k2.7-code\": Model<\"openai-completions\"> & {\n\t\tid: \"kimi-k2.7-code\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"qwen3.6-flash\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.6-flash\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"qwen3.6-plus\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.6-plus\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"qwen3.7-max\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.7-max\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"qwen3.7-plus\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.7-plus\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"qwen3.8-max-preview\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.8-max-preview\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n};\n"]}
@@ -0,0 +1,5 @@
1
+ // This file is auto-generated by scripts/generate-models.ts
2
+ // Do not edit manually - run 'npm run generate-models' to update
3
+ import values from "./data/qwen-token-plan-cn.json" with { type: "json" };
4
+ export const QWEN_TOKEN_PLAN_CN_MODELS = values;
5
+ //# sourceMappingURL=qwen-token-plan-cn.models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qwen-token-plan-cn.models.js","sourceRoot":"","sources":["../../src/providers/qwen-token-plan-cn.models.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,iEAAiE;AAEjE,OAAO,MAAM,MAAM,gCAAgC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAG1E,MAAM,CAAC,MAAM,yBAAyB,GAAG,MA6DxC,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport values from \"./data/qwen-token-plan-cn.json\" with { type: \"json\" };\nimport type { Model } from \"../types.ts\";\n\nexport const QWEN_TOKEN_PLAN_CN_MODELS = values as {\n\t\"MiniMax-M2.5\": Model<\"openai-completions\"> & {\n\t\tid: \"MiniMax-M2.5\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"deepseek-v3.2\": Model<\"openai-completions\"> & {\n\t\tid: \"deepseek-v3.2\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"deepseek-v4-flash\": Model<\"openai-completions\"> & {\n\t\tid: \"deepseek-v4-flash\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"deepseek-v4-pro\": Model<\"openai-completions\"> & {\n\t\tid: \"deepseek-v4-pro\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"glm-5\": Model<\"openai-completions\"> & {\n\t\tid: \"glm-5\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"glm-5.1\": Model<\"openai-completions\"> & {\n\t\tid: \"glm-5.1\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"glm-5.2\": Model<\"openai-completions\"> & {\n\t\tid: \"glm-5.2\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"kimi-k2.5\": Model<\"openai-completions\"> & {\n\t\tid: \"kimi-k2.5\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"kimi-k2.6\": Model<\"openai-completions\"> & {\n\t\tid: \"kimi-k2.6\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"kimi-k2.7-code\": Model<\"openai-completions\"> & {\n\t\tid: \"kimi-k2.7-code\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"qwen3.6-flash\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.6-flash\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"qwen3.6-plus\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.6-plus\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"qwen3.7-max\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.7-max\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"qwen3.7-plus\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.7-plus\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n\t\"qwen3.8-max-preview\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.8-max-preview\";\n\t\tprovider: \"qwen-token-plan-cn\";\n\t};\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import { type Provider } from "../models.ts";
2
+ export declare function qwenTokenPlanProvider(): Provider<"openai-completions">;
3
+ //# sourceMappingURL=qwen-token-plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qwen-token-plan.d.ts","sourceRoot":"","sources":["../../src/providers/qwen-token-plan.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7D,wBAAgB,qBAAqB,IAAI,QAAQ,CAAC,oBAAoB,CAAC,CAStE","sourcesContent":["import { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { QWEN_TOKEN_PLAN_MODELS } from \"./qwen-token-plan.models.ts\";\n\nexport function qwenTokenPlanProvider(): Provider<\"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"qwen-token-plan\",\n\t\tname: \"Qwen Token Plan\",\n\t\tbaseUrl: \"https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Qwen Token Plan API key\", [\"QWEN_TOKEN_PLAN_API_KEY\"]) },\n\t\tmodels: Object.values(QWEN_TOKEN_PLAN_MODELS),\n\t\tapi: openAICompletionsApi(),\n\t});\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { openAICompletionsApi } from "../api/openai-completions.lazy.js";
2
+ import { envApiKeyAuth } from "../auth/helpers.js";
3
+ import { createProvider } from "../models.js";
4
+ import { QWEN_TOKEN_PLAN_MODELS } from "./qwen-token-plan.models.js";
5
+ export function qwenTokenPlanProvider() {
6
+ return createProvider({
7
+ id: "qwen-token-plan",
8
+ name: "Qwen Token Plan",
9
+ baseUrl: "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
10
+ auth: { apiKey: envApiKeyAuth("Qwen Token Plan API key", ["QWEN_TOKEN_PLAN_API_KEY"]) },
11
+ models: Object.values(QWEN_TOKEN_PLAN_MODELS),
12
+ api: openAICompletionsApi(),
13
+ });
14
+ }
15
+ //# sourceMappingURL=qwen-token-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qwen-token-plan.js","sourceRoot":"","sources":["../../src/providers/qwen-token-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,MAAM,UAAU,qBAAqB,GAAmC;IACvE,OAAO,cAAc,CAAC;QACrB,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,wEAAwE;QACjF,IAAI,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,yBAAyB,EAAE,CAAC,yBAAyB,CAAC,CAAC,EAAE;QACvF,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC;QAC7C,GAAG,EAAE,oBAAoB,EAAE;KAC3B,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { openAICompletionsApi } from \"../api/openai-completions.lazy.ts\";\nimport { envApiKeyAuth } from \"../auth/helpers.ts\";\nimport { createProvider, type Provider } from \"../models.ts\";\nimport { QWEN_TOKEN_PLAN_MODELS } from \"./qwen-token-plan.models.ts\";\n\nexport function qwenTokenPlanProvider(): Provider<\"openai-completions\"> {\n\treturn createProvider({\n\t\tid: \"qwen-token-plan\",\n\t\tname: \"Qwen Token Plan\",\n\t\tbaseUrl: \"https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1\",\n\t\tauth: { apiKey: envApiKeyAuth(\"Qwen Token Plan API key\", [\"QWEN_TOKEN_PLAN_API_KEY\"]) },\n\t\tmodels: Object.values(QWEN_TOKEN_PLAN_MODELS),\n\t\tapi: openAICompletionsApi(),\n\t});\n}\n"]}
@@ -0,0 +1,64 @@
1
+ import type { Model } from "../types.ts";
2
+ export declare const QWEN_TOKEN_PLAN_MODELS: {
3
+ "MiniMax-M2.5": Model<"openai-completions"> & {
4
+ id: "MiniMax-M2.5";
5
+ provider: "qwen-token-plan";
6
+ };
7
+ "deepseek-v3.2": Model<"openai-completions"> & {
8
+ id: "deepseek-v3.2";
9
+ provider: "qwen-token-plan";
10
+ };
11
+ "deepseek-v4-flash": Model<"openai-completions"> & {
12
+ id: "deepseek-v4-flash";
13
+ provider: "qwen-token-plan";
14
+ };
15
+ "deepseek-v4-pro": Model<"openai-completions"> & {
16
+ id: "deepseek-v4-pro";
17
+ provider: "qwen-token-plan";
18
+ };
19
+ "glm-5": Model<"openai-completions"> & {
20
+ id: "glm-5";
21
+ provider: "qwen-token-plan";
22
+ };
23
+ "glm-5.1": Model<"openai-completions"> & {
24
+ id: "glm-5.1";
25
+ provider: "qwen-token-plan";
26
+ };
27
+ "glm-5.2": Model<"openai-completions"> & {
28
+ id: "glm-5.2";
29
+ provider: "qwen-token-plan";
30
+ };
31
+ "kimi-k2.5": Model<"openai-completions"> & {
32
+ id: "kimi-k2.5";
33
+ provider: "qwen-token-plan";
34
+ };
35
+ "kimi-k2.6": Model<"openai-completions"> & {
36
+ id: "kimi-k2.6";
37
+ provider: "qwen-token-plan";
38
+ };
39
+ "kimi-k2.7-code": Model<"openai-completions"> & {
40
+ id: "kimi-k2.7-code";
41
+ provider: "qwen-token-plan";
42
+ };
43
+ "qwen3.6-flash": Model<"openai-completions"> & {
44
+ id: "qwen3.6-flash";
45
+ provider: "qwen-token-plan";
46
+ };
47
+ "qwen3.6-plus": Model<"openai-completions"> & {
48
+ id: "qwen3.6-plus";
49
+ provider: "qwen-token-plan";
50
+ };
51
+ "qwen3.7-max": Model<"openai-completions"> & {
52
+ id: "qwen3.7-max";
53
+ provider: "qwen-token-plan";
54
+ };
55
+ "qwen3.7-plus": Model<"openai-completions"> & {
56
+ id: "qwen3.7-plus";
57
+ provider: "qwen-token-plan";
58
+ };
59
+ "qwen3.8-max-preview": Model<"openai-completions"> & {
60
+ id: "qwen3.8-max-preview";
61
+ provider: "qwen-token-plan";
62
+ };
63
+ };
64
+ //# sourceMappingURL=qwen-token-plan.models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qwen-token-plan.models.d.ts","sourceRoot":"","sources":["../../src/providers/qwen-token-plan.models.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DlC,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport values from \"./data/qwen-token-plan.json\" with { type: \"json\" };\nimport type { Model } from \"../types.ts\";\n\nexport const QWEN_TOKEN_PLAN_MODELS = values as {\n\t\"MiniMax-M2.5\": Model<\"openai-completions\"> & {\n\t\tid: \"MiniMax-M2.5\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"deepseek-v3.2\": Model<\"openai-completions\"> & {\n\t\tid: \"deepseek-v3.2\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"deepseek-v4-flash\": Model<\"openai-completions\"> & {\n\t\tid: \"deepseek-v4-flash\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"deepseek-v4-pro\": Model<\"openai-completions\"> & {\n\t\tid: \"deepseek-v4-pro\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"glm-5\": Model<\"openai-completions\"> & {\n\t\tid: \"glm-5\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"glm-5.1\": Model<\"openai-completions\"> & {\n\t\tid: \"glm-5.1\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"glm-5.2\": Model<\"openai-completions\"> & {\n\t\tid: \"glm-5.2\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"kimi-k2.5\": Model<\"openai-completions\"> & {\n\t\tid: \"kimi-k2.5\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"kimi-k2.6\": Model<\"openai-completions\"> & {\n\t\tid: \"kimi-k2.6\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"kimi-k2.7-code\": Model<\"openai-completions\"> & {\n\t\tid: \"kimi-k2.7-code\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"qwen3.6-flash\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.6-flash\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"qwen3.6-plus\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.6-plus\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"qwen3.7-max\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.7-max\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"qwen3.7-plus\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.7-plus\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"qwen3.8-max-preview\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.8-max-preview\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n};\n"]}
@@ -0,0 +1,5 @@
1
+ // This file is auto-generated by scripts/generate-models.ts
2
+ // Do not edit manually - run 'npm run generate-models' to update
3
+ import values from "./data/qwen-token-plan.json" with { type: "json" };
4
+ export const QWEN_TOKEN_PLAN_MODELS = values;
5
+ //# sourceMappingURL=qwen-token-plan.models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qwen-token-plan.models.js","sourceRoot":"","sources":["../../src/providers/qwen-token-plan.models.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,iEAAiE;AAEjE,OAAO,MAAM,MAAM,6BAA6B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAGvE,MAAM,CAAC,MAAM,sBAAsB,GAAG,MA6DrC,CAAC","sourcesContent":["// This file is auto-generated by scripts/generate-models.ts\n// Do not edit manually - run 'npm run generate-models' to update\n\nimport values from \"./data/qwen-token-plan.json\" with { type: \"json\" };\nimport type { Model } from \"../types.ts\";\n\nexport const QWEN_TOKEN_PLAN_MODELS = values as {\n\t\"MiniMax-M2.5\": Model<\"openai-completions\"> & {\n\t\tid: \"MiniMax-M2.5\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"deepseek-v3.2\": Model<\"openai-completions\"> & {\n\t\tid: \"deepseek-v3.2\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"deepseek-v4-flash\": Model<\"openai-completions\"> & {\n\t\tid: \"deepseek-v4-flash\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"deepseek-v4-pro\": Model<\"openai-completions\"> & {\n\t\tid: \"deepseek-v4-pro\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"glm-5\": Model<\"openai-completions\"> & {\n\t\tid: \"glm-5\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"glm-5.1\": Model<\"openai-completions\"> & {\n\t\tid: \"glm-5.1\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"glm-5.2\": Model<\"openai-completions\"> & {\n\t\tid: \"glm-5.2\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"kimi-k2.5\": Model<\"openai-completions\"> & {\n\t\tid: \"kimi-k2.5\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"kimi-k2.6\": Model<\"openai-completions\"> & {\n\t\tid: \"kimi-k2.6\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"kimi-k2.7-code\": Model<\"openai-completions\"> & {\n\t\tid: \"kimi-k2.7-code\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"qwen3.6-flash\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.6-flash\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"qwen3.6-plus\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.6-plus\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"qwen3.7-max\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.7-max\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"qwen3.7-plus\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.7-plus\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n\t\"qwen3.8-max-preview\": Model<\"openai-completions\"> & {\n\t\tid: \"qwen3.8-max-preview\";\n\t\tprovider: \"qwen-token-plan\";\n\t};\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"radius-config.d.ts","sourceRoot":"","sources":["../../src/providers/radius-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE3D,eAAO,MAAM,sBAAsB,0BAA0B,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,KAAK,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;IAC5B,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,eAAe,GAAG;IACrD,aAAa,CAAC,EAAE,mBAAmB,CAAC;CACpC,CAAC;AA2BF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,eAAe,GAAG,SAAS,GAAG,mBAAmB,GAAG,SAAS,CAElH;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAAC,EAAE,CAOjH;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,GAAG,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,EAAE,CAGnH;AAOD,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,mBAAmB,CAAC,CAY9B","sourcesContent":["import type { OAuthCredential } from \"../auth/types.ts\";\nimport type { Model, ThinkingLevelMap } from \"../types.ts\";\n\nexport const DEFAULT_RADIUS_GATEWAY = \"https://radius.pi.dev\";\n\nexport type RadiusGatewayModel = {\n\tid: string;\n\tname: string;\n\treasoning: boolean;\n\tthinkingLevelMap?: ThinkingLevelMap;\n\tinput: (\"text\" | \"image\")[];\n\tcost: Model<\"pi-messages\">[\"cost\"];\n\tcontextWindow: number;\n\tmaxTokens: number;\n};\n\nexport type RadiusGatewayConfig = {\n\tbaseUrl: string;\n\tmodels: RadiusGatewayModel[];\n};\n\nexport type RadiusOAuthCredential = OAuthCredential & {\n\tgatewayConfig?: RadiusGatewayConfig;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isRadiusGatewayModel(value: unknown): value is RadiusGatewayModel {\n\treturn (\n\t\tisRecord(value) &&\n\t\ttypeof value.id === \"string\" &&\n\t\ttypeof value.name === \"string\" &&\n\t\ttypeof value.reasoning === \"boolean\" &&\n\t\tArray.isArray(value.input) &&\n\t\tisRecord(value.cost) &&\n\t\ttypeof value.contextWindow === \"number\" &&\n\t\ttypeof value.maxTokens === \"number\"\n\t);\n}\n\nfunction sanitizeRadiusGatewayConfig(config: unknown): RadiusGatewayConfig | undefined {\n\tif (!isRecord(config) || typeof config.baseUrl !== \"string\" || !Array.isArray(config.models)) return undefined;\n\treturn {\n\t\tbaseUrl: config.baseUrl,\n\t\tmodels: config.models.filter(isRadiusGatewayModel).map((model) => ({ ...model })),\n\t};\n}\n\nexport function normalizeRadiusGatewayUrl(value: string): string {\n\tconst withScheme = /^https?:\\/\\//iu.test(value) ? value : `https://${value}`;\n\treturn withScheme.replace(/\\/+$/u, \"\");\n}\n\nexport function getRadiusCredentialConfig(credential: OAuthCredential | undefined): RadiusGatewayConfig | undefined {\n\treturn sanitizeRadiusGatewayConfig((credential as RadiusOAuthCredential | undefined)?.gatewayConfig);\n}\n\nexport function getRadiusModelsFromConfig(providerId: string, config: RadiusGatewayConfig): Model<\"pi-messages\">[] {\n\treturn config.models.map((model) => ({\n\t\t...model,\n\t\tapi: \"pi-messages\",\n\t\tprovider: providerId,\n\t\tbaseUrl: config.baseUrl,\n\t}));\n}\n\nexport function getRadiusModels(providerId: string, credential: OAuthCredential | undefined): Model<\"pi-messages\">[] {\n\tconst config = getRadiusCredentialConfig(credential);\n\treturn config ? getRadiusModelsFromConfig(providerId, config) : [];\n}\n\nfunction truncateHttpBody(body: string): string {\n\tconst trimmed = body.trim();\n\treturn trimmed.length > 512 ? `${trimmed.slice(0, 512)}…` : trimmed;\n}\n\nexport async function loadRadiusGatewayConfig(\n\tgateway: string,\n\tapiKey?: string,\n\tsignal?: AbortSignal,\n): Promise<RadiusGatewayConfig> {\n\tconst headers: Record<string, string> = { accept: \"application/json\" };\n\tif (apiKey) headers.authorization = `Bearer ${apiKey}`;\n\tconst response = await fetch(new URL(\"/v1/config\", gateway), { headers, signal });\n\tif (!response.ok) {\n\t\tthrow new Error(\n\t\t\t`Could not load Radius config from ${gateway}: ${response.status}: ${truncateHttpBody(await response.text())}`,\n\t\t);\n\t}\n\tconst config = sanitizeRadiusGatewayConfig(await response.json());\n\tif (!config) throw new Error(`Invalid Radius config from ${gateway}`);\n\treturn config;\n}\n"]}
1
+ {"version":3,"file":"radius-config.d.ts","sourceRoot":"","sources":["../../src/providers/radius-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,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Map } from \"../types.ts\";\n\nexport const DEFAULT_RADIUS_GATEWAY = \"https://radius.pi.dev\";\n\nexport type RadiusGatewayModel = {\n\tid: string;\n\tname: string;\n\treasoning: boolean;\n\tthinkingLevelMap?: ThinkingLevelMap;\n\tinput: (\"text\" | \"image\")[];\n\tcost: Model<\"pi-messages\">[\"cost\"];\n\tcontextWindow: number;\n\tmaxTokens: number;\n};\n\nexport type RadiusGatewayConfig = {\n\tbaseUrl: string;\n\tmodels: RadiusGatewayModel[];\n};\n\nexport type RadiusOAuthCredential = OAuthCredential & {\n\tgatewayConfig?: RadiusGatewayConfig;\n};\n\nfunction isRadiusGatewayModel(value: unknown): value is RadiusGatewayModel {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n\tconst model = value as Partial<RadiusGatewayModel>;\n\treturn (\n\t\ttypeof model.id === \"string\" &&\n\t\ttypeof model.name === \"string\" &&\n\t\ttypeof model.reasoning === \"boolean\" &&\n\t\tArray.isArray(model.input) &&\n\t\ttypeof model.cost === \"object\" &&\n\t\tmodel.cost !== null &&\n\t\t!Array.isArray(model.cost) &&\n\t\ttypeof model.contextWindow === \"number\" &&\n\t\ttypeof model.maxTokens === \"number\"\n\t);\n}\n\nfunction sanitizeRadiusGatewayConfig(config: unknown): RadiusGatewayConfig | undefined {\n\tif (typeof config !== \"object\" || config === null || Array.isArray(config)) return undefined;\n\tconst { baseUrl, models } = config as Partial<RadiusGatewayConfig>;\n\tif (typeof baseUrl !== \"string\" || !Array.isArray(models)) return undefined;\n\treturn {\n\t\tbaseUrl,\n\t\tmodels: models.filter(isRadiusGatewayModel).map((model) => ({ ...model })),\n\t};\n}\n\nexport function normalizeRadiusGatewayUrl(value: string): string {\n\tconst withScheme = /^https?:\\/\\//iu.test(value) ? value : `https://${value}`;\n\treturn withScheme.replace(/\\/+$/u, \"\");\n}\n\nexport function getRadiusCredentialConfig(credential: OAuthCredential | undefined): RadiusGatewayConfig | undefined {\n\treturn sanitizeRadiusGatewayConfig((credential as RadiusOAuthCredential | undefined)?.gatewayConfig);\n}\n\nexport function getRadiusModelsFromConfig(providerId: string, config: RadiusGatewayConfig): Model<\"pi-messages\">[] {\n\treturn config.models.map((model) => ({\n\t\t...model,\n\t\tapi: \"pi-messages\",\n\t\tprovider: providerId,\n\t\tbaseUrl: config.baseUrl,\n\t}));\n}\n\nexport function getRadiusModels(providerId: string, credential: OAuthCredential | undefined): Model<\"pi-messages\">[] {\n\tconst config = getRadiusCredentialConfig(credential);\n\treturn config ? getRadiusModelsFromConfig(providerId, config) : [];\n}\n\nfunction truncateHttpBody(body: string): string {\n\tconst trimmed = body.trim();\n\treturn trimmed.length > 512 ? `${trimmed.slice(0, 512)}…` : trimmed;\n}\n\nexport async function loadRadiusGatewayConfig(\n\tgateway: string,\n\tapiKey?: string,\n\tsignal?: AbortSignal,\n): Promise<RadiusGatewayConfig> {\n\tconst headers: Record<string, string> = { accept: \"application/json\" };\n\tif (apiKey) headers.authorization = `Bearer ${apiKey}`;\n\tconst response = await fetch(new URL(\"/v1/config\", gateway), { headers, signal });\n\tif (!response.ok) {\n\t\tthrow new Error(\n\t\t\t`Could not load Radius config from ${gateway}: ${response.status}: ${truncateHttpBody(await response.text())}`,\n\t\t);\n\t}\n\tconst config = sanitizeRadiusGatewayConfig(await response.json());\n\tif (!config) throw new Error(`Invalid Radius config from ${gateway}`);\n\treturn config;\n}\n"]}
@@ -1,23 +1,27 @@
1
1
  export const DEFAULT_RADIUS_GATEWAY = "https://radius.pi.dev";
2
- function isRecord(value) {
3
- return typeof value === "object" && value !== null && !Array.isArray(value);
4
- }
5
2
  function isRadiusGatewayModel(value) {
6
- return (isRecord(value) &&
7
- typeof value.id === "string" &&
8
- typeof value.name === "string" &&
9
- typeof value.reasoning === "boolean" &&
10
- Array.isArray(value.input) &&
11
- isRecord(value.cost) &&
12
- typeof value.contextWindow === "number" &&
13
- typeof value.maxTokens === "number");
3
+ if (typeof value !== "object" || value === null || Array.isArray(value))
4
+ return false;
5
+ const model = value;
6
+ return (typeof model.id === "string" &&
7
+ typeof model.name === "string" &&
8
+ typeof model.reasoning === "boolean" &&
9
+ Array.isArray(model.input) &&
10
+ typeof model.cost === "object" &&
11
+ model.cost !== null &&
12
+ !Array.isArray(model.cost) &&
13
+ typeof model.contextWindow === "number" &&
14
+ typeof model.maxTokens === "number");
14
15
  }
15
16
  function sanitizeRadiusGatewayConfig(config) {
16
- if (!isRecord(config) || typeof config.baseUrl !== "string" || !Array.isArray(config.models))
17
+ if (typeof config !== "object" || config === null || Array.isArray(config))
18
+ return undefined;
19
+ const { baseUrl, models } = config;
20
+ if (typeof baseUrl !== "string" || !Array.isArray(models))
17
21
  return undefined;
18
22
  return {
19
- baseUrl: config.baseUrl,
20
- models: config.models.filter(isRadiusGatewayModel).map((model) => ({ ...model })),
23
+ baseUrl,
24
+ models: models.filter(isRadiusGatewayModel).map((model) => ({ ...model })),
21
25
  };
22
26
  }
23
27
  export function normalizeRadiusGatewayUrl(value) {
@@ -1 +1 @@
1
- {"version":3,"file":"radius-config.js","sourceRoot":"","sources":["../../src/providers/radius-config.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAsB9D,SAAS,QAAQ,CAAC,KAAc,EAAoC;IACnE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAAA,CAC5E;AAED,SAAS,oBAAoB,CAAC,KAAc,EAA+B;IAC1E,OAAO,CACN,QAAQ,CAAC,KAAK,CAAC;QACf,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ;QAC5B,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,OAAO,KAAK,CAAC,SAAS,KAAK,SAAS;QACpC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;QAC1B,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;QACpB,OAA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ts\";\nimport type { Model, ThinkingLevelMap } from \"../types.ts\";\n\nexport const DEFAULT_RADIUS_GATEWAY = \"https://radius.pi.dev\";\n\nexport type RadiusGatewayModel = {\n\tid: string;\n\tname: string;\n\treasoning: boolean;\n\tthinkingLevelMap?: ThinkingLevelMap;\n\tinput: (\"text\" | \"image\")[];\n\tcost: Model<\"pi-messages\">[\"cost\"];\n\tcontextWindow: number;\n\tmaxTokens: number;\n};\n\nexport type RadiusGatewayConfig = {\n\tbaseUrl: string;\n\tmodels: RadiusGatewayModel[];\n};\n\nexport type RadiusOAuthCredential = OAuthCredential & {\n\tgatewayConfig?: RadiusGatewayConfig;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isRadiusGatewayModel(value: unknown): value is RadiusGatewayModel {\n\treturn (\n\t\tisRecord(value) &&\n\t\ttypeof value.id === \"string\" &&\n\t\ttypeof value.name === \"string\" &&\n\t\ttypeof value.reasoning === \"boolean\" &&\n\t\tArray.isArray(value.input) &&\n\t\tisRecord(value.cost) &&\n\t\ttypeof value.contextWindow === \"number\" &&\n\t\ttypeof value.maxTokens === \"number\"\n\t);\n}\n\nfunction sanitizeRadiusGatewayConfig(config: unknown): RadiusGatewayConfig | undefined {\n\tif (!isRecord(config) || typeof config.baseUrl !== \"string\" || !Array.isArray(config.models)) return undefined;\n\treturn {\n\t\tbaseUrl: config.baseUrl,\n\t\tmodels: config.models.filter(isRadiusGatewayModel).map((model) => ({ ...model })),\n\t};\n}\n\nexport function normalizeRadiusGatewayUrl(value: string): string {\n\tconst withScheme = /^https?:\\/\\//iu.test(value) ? value : `https://${value}`;\n\treturn withScheme.replace(/\\/+$/u, \"\");\n}\n\nexport function getRadiusCredentialConfig(credential: OAuthCredential | undefined): RadiusGatewayConfig | undefined {\n\treturn sanitizeRadiusGatewayConfig((credential as RadiusOAuthCredential | undefined)?.gatewayConfig);\n}\n\nexport function getRadiusModelsFromConfig(providerId: string, config: RadiusGatewayConfig): Model<\"pi-messages\">[] {\n\treturn config.models.map((model) => ({\n\t\t...model,\n\t\tapi: \"pi-messages\",\n\t\tprovider: providerId,\n\t\tbaseUrl: config.baseUrl,\n\t}));\n}\n\nexport function getRadiusModels(providerId: string, credential: OAuthCredential | undefined): Model<\"pi-messages\">[] {\n\tconst config = getRadiusCredentialConfig(credential);\n\treturn config ? getRadiusModelsFromConfig(providerId, config) : [];\n}\n\nfunction truncateHttpBody(body: string): string {\n\tconst trimmed = body.trim();\n\treturn trimmed.length > 512 ? `${trimmed.slice(0, 512)}…` : trimmed;\n}\n\nexport async function loadRadiusGatewayConfig(\n\tgateway: string,\n\tapiKey?: string,\n\tsignal?: AbortSignal,\n): Promise<RadiusGatewayConfig> {\n\tconst headers: Record<string, string> = { accept: \"application/json\" };\n\tif (apiKey) headers.authorization = `Bearer ${apiKey}`;\n\tconst response = await fetch(new URL(\"/v1/config\", gateway), { headers, signal });\n\tif (!response.ok) {\n\t\tthrow new Error(\n\t\t\t`Could not load Radius config from ${gateway}: ${response.status}: ${truncateHttpBody(await response.text())}`,\n\t\t);\n\t}\n\tconst config = sanitizeRadiusGatewayConfig(await response.json());\n\tif (!config) throw new Error(`Invalid Radius config from ${gateway}`);\n\treturn config;\n}\n"]}
1
+ {"version":3,"file":"radius-config.js","sourceRoot":"","sources":["../../src/providers/radius-config.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAsB9D,SAAS,oBAAoB,CAAC,KAAc,EAA+B;IAC1E,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACtF,MAAM,KAAK,GAAG,KAAoC,CAAC;IACnD,OAAO,CACN,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ;QAC5B,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;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QAAQ,CAAC,MAAM,KAAK,gBAAgB,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,EAAE,CAC9G,CAAC;IACH,CAAC;IACD,MAAM,MAAM,GAAG,2BAA2B,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAClE,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,EAAE,CAAC,CAAC;IACtE,OAAO,MAAM,CAAC;AAAA,CACd","sourcesContent":["import type { OAuthCredential } from \"../auth/types.ts\";\nimport type { Model, ThinkingLevelMap } from \"../types.ts\";\n\nexport const DEFAULT_RADIUS_GATEWAY = \"https://radius.pi.dev\";\n\nexport type RadiusGatewayModel = {\n\tid: string;\n\tname: string;\n\treasoning: boolean;\n\tthinkingLevelMap?: ThinkingLevelMap;\n\tinput: (\"text\" | \"image\")[];\n\tcost: Model<\"pi-messages\">[\"cost\"];\n\tcontextWindow: number;\n\tmaxTokens: number;\n};\n\nexport type RadiusGatewayConfig = {\n\tbaseUrl: string;\n\tmodels: RadiusGatewayModel[];\n};\n\nexport type RadiusOAuthCredential = OAuthCredential & {\n\tgatewayConfig?: RadiusGatewayConfig;\n};\n\nfunction isRadiusGatewayModel(value: unknown): value is RadiusGatewayModel {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n\tconst model = value as Partial<RadiusGatewayModel>;\n\treturn (\n\t\ttypeof model.id === \"string\" &&\n\t\ttypeof model.name === \"string\" &&\n\t\ttypeof model.reasoning === \"boolean\" &&\n\t\tArray.isArray(model.input) &&\n\t\ttypeof model.cost === \"object\" &&\n\t\tmodel.cost !== null &&\n\t\t!Array.isArray(model.cost) &&\n\t\ttypeof model.contextWindow === \"number\" &&\n\t\ttypeof model.maxTokens === \"number\"\n\t);\n}\n\nfunction sanitizeRadiusGatewayConfig(config: unknown): RadiusGatewayConfig | undefined {\n\tif (typeof config !== \"object\" || config === null || Array.isArray(config)) return undefined;\n\tconst { baseUrl, models } = config as Partial<RadiusGatewayConfig>;\n\tif (typeof baseUrl !== \"string\" || !Array.isArray(models)) return undefined;\n\treturn {\n\t\tbaseUrl,\n\t\tmodels: models.filter(isRadiusGatewayModel).map((model) => ({ ...model })),\n\t};\n}\n\nexport function normalizeRadiusGatewayUrl(value: string): string {\n\tconst withScheme = /^https?:\\/\\//iu.test(value) ? value : `https://${value}`;\n\treturn withScheme.replace(/\\/+$/u, \"\");\n}\n\nexport function getRadiusCredentialConfig(credential: OAuthCredential | undefined): RadiusGatewayConfig | undefined {\n\treturn sanitizeRadiusGatewayConfig((credential as RadiusOAuthCredential | undefined)?.gatewayConfig);\n}\n\nexport function getRadiusModelsFromConfig(providerId: string, config: RadiusGatewayConfig): Model<\"pi-messages\">[] {\n\treturn config.models.map((model) => ({\n\t\t...model,\n\t\tapi: \"pi-messages\",\n\t\tprovider: providerId,\n\t\tbaseUrl: config.baseUrl,\n\t}));\n}\n\nexport function getRadiusModels(providerId: string, credential: OAuthCredential | undefined): Model<\"pi-messages\">[] {\n\tconst config = getRadiusCredentialConfig(credential);\n\treturn config ? getRadiusModelsFromConfig(providerId, config) : [];\n}\n\nfunction truncateHttpBody(body: string): string {\n\tconst trimmed = body.trim();\n\treturn trimmed.length > 512 ? `${trimmed.slice(0, 512)}…` : trimmed;\n}\n\nexport async function loadRadiusGatewayConfig(\n\tgateway: string,\n\tapiKey?: string,\n\tsignal?: AbortSignal,\n): Promise<RadiusGatewayConfig> {\n\tconst headers: Record<string, string> = { accept: \"application/json\" };\n\tif (apiKey) headers.authorization = `Bearer ${apiKey}`;\n\tconst response = await fetch(new URL(\"/v1/config\", gateway), { headers, signal });\n\tif (!response.ok) {\n\t\tthrow new Error(\n\t\t\t`Could not load Radius config from ${gateway}: ${response.status}: ${truncateHttpBody(await response.text())}`,\n\t\t);\n\t}\n\tconst config = sanitizeRadiusGatewayConfig(await response.json());\n\tif (!config) throw new Error(`Invalid Radius config from ${gateway}`);\n\treturn config;\n}\n"]}