@fractaal/pi-ai 0.86.9 → 1.6.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 (411) hide show
  1. package/README.md +154 -78
  2. package/dist/api/anthropic-messages.d.ts.map +1 -1
  3. package/dist/api/anthropic-messages.js +380 -144
  4. package/dist/api/anthropic-messages.js.map +1 -1
  5. package/dist/api/azure-openai-responses.d.ts.map +1 -1
  6. package/dist/api/azure-openai-responses.js +9 -11
  7. package/dist/api/azure-openai-responses.js.map +1 -1
  8. package/dist/api/bedrock-converse-stream.d.ts.map +1 -1
  9. package/dist/api/bedrock-converse-stream.js +184 -121
  10. package/dist/api/bedrock-converse-stream.js.map +1 -1
  11. package/dist/api/bedrock-converse-stream.lazy.d.ts +7 -0
  12. package/dist/api/bedrock-converse-stream.lazy.d.ts.map +1 -1
  13. package/dist/api/bedrock-converse-stream.lazy.js +18 -5
  14. package/dist/api/bedrock-converse-stream.lazy.js.map +1 -1
  15. package/dist/api/classifier-shared.d.ts +21 -0
  16. package/dist/api/classifier-shared.d.ts.map +1 -0
  17. package/dist/api/classifier-shared.js +99 -0
  18. package/dist/api/classifier-shared.js.map +1 -0
  19. package/dist/api/cloudflare-workers-ai-system-one.d.ts.map +1 -1
  20. package/dist/api/cloudflare-workers-ai-system-one.js +10 -1
  21. package/dist/api/cloudflare-workers-ai-system-one.js.map +1 -1
  22. package/dist/api/constrained-sampling.d.ts +15 -1
  23. package/dist/api/constrained-sampling.d.ts.map +1 -1
  24. package/dist/api/constrained-sampling.js +51 -18
  25. package/dist/api/constrained-sampling.js.map +1 -1
  26. package/dist/api/google-generative-ai.d.ts.map +1 -1
  27. package/dist/api/google-generative-ai.js +4 -10
  28. package/dist/api/google-generative-ai.js.map +1 -1
  29. package/dist/api/google-shared.d.ts +2 -1
  30. package/dist/api/google-shared.d.ts.map +1 -1
  31. package/dist/api/google-shared.js +60 -3
  32. package/dist/api/google-shared.js.map +1 -1
  33. package/dist/api/google-vertex.d.ts.map +1 -1
  34. package/dist/api/google-vertex.js +9 -15
  35. package/dist/api/google-vertex.js.map +1 -1
  36. package/dist/api/lazy.d.ts +7 -2
  37. package/dist/api/lazy.d.ts.map +1 -1
  38. package/dist/api/lazy.js +33 -12
  39. package/dist/api/lazy.js.map +1 -1
  40. package/dist/api/llama-cpp-classify.d.ts.map +1 -1
  41. package/dist/api/llama-cpp-classify.js +4 -1
  42. package/dist/api/llama-cpp-classify.js.map +1 -1
  43. package/dist/api/mistral-conversations.d.ts.map +1 -1
  44. package/dist/api/mistral-conversations.js +50 -60
  45. package/dist/api/mistral-conversations.js.map +1 -1
  46. package/dist/api/openai-codex-responses.d.ts.map +1 -1
  47. package/dist/api/openai-codex-responses.js +30 -17
  48. package/dist/api/openai-codex-responses.js.map +1 -1
  49. package/dist/api/openai-completions.d.ts +2 -1
  50. package/dist/api/openai-completions.d.ts.map +1 -1
  51. package/dist/api/openai-completions.js +93 -90
  52. package/dist/api/openai-completions.js.map +1 -1
  53. package/dist/api/openai-decisions.d.ts +4 -0
  54. package/dist/api/openai-decisions.d.ts.map +1 -0
  55. package/dist/api/openai-decisions.js +162 -0
  56. package/dist/api/openai-decisions.js.map +1 -0
  57. package/dist/api/openai-decisions.lazy.d.ts +3 -0
  58. package/dist/api/openai-decisions.lazy.d.ts.map +1 -0
  59. package/dist/api/openai-decisions.lazy.js +4 -0
  60. package/dist/api/openai-decisions.lazy.js.map +1 -0
  61. package/dist/api/openai-responses-shared.d.ts +26 -0
  62. package/dist/api/openai-responses-shared.d.ts.map +1 -1
  63. package/dist/api/openai-responses-shared.js +132 -66
  64. package/dist/api/openai-responses-shared.js.map +1 -1
  65. package/dist/api/openai-responses.d.ts.map +1 -1
  66. package/dist/api/openai-responses.js +42 -21
  67. package/dist/api/openai-responses.js.map +1 -1
  68. package/dist/api/openrouter-images.d.ts.map +1 -1
  69. package/dist/api/openrouter-images.js +5 -3
  70. package/dist/api/openrouter-images.js.map +1 -1
  71. package/dist/api/pi-messages.d.ts +2 -0
  72. package/dist/api/pi-messages.d.ts.map +1 -1
  73. package/dist/api/pi-messages.js +27 -12
  74. package/dist/api/pi-messages.js.map +1 -1
  75. package/dist/api/simple-options.d.ts +1 -0
  76. package/dist/api/simple-options.d.ts.map +1 -1
  77. package/dist/api/simple-options.js +18 -3
  78. package/dist/api/simple-options.js.map +1 -1
  79. package/dist/api/system-one-shared.d.ts +29 -3
  80. package/dist/api/system-one-shared.d.ts.map +1 -1
  81. package/dist/api/system-one-shared.js +54 -86
  82. package/dist/api/system-one-shared.js.map +1 -1
  83. package/dist/api/transform-messages.d.ts +16 -1
  84. package/dist/api/transform-messages.d.ts.map +1 -1
  85. package/dist/api/transform-messages.js +28 -15
  86. package/dist/api/transform-messages.js.map +1 -1
  87. package/dist/api/typesafe-system-one.d.ts.map +1 -1
  88. package/dist/api/typesafe-system-one.js +12 -1
  89. package/dist/api/typesafe-system-one.js.map +1 -1
  90. package/dist/auth/oauth/anthropic.d.ts.map +1 -1
  91. package/dist/auth/oauth/anthropic.js +14 -6
  92. package/dist/auth/oauth/anthropic.js.map +1 -1
  93. package/dist/auth/oauth/github-copilot.d.ts.map +1 -1
  94. package/dist/auth/oauth/github-copilot.js +4 -11
  95. package/dist/auth/oauth/github-copilot.js.map +1 -1
  96. package/dist/auth/oauth/kimi-coding.d.ts.map +1 -1
  97. package/dist/auth/oauth/kimi-coding.js +4 -22
  98. package/dist/auth/oauth/kimi-coding.js.map +1 -1
  99. package/dist/auth/oauth/load.d.ts.map +1 -1
  100. package/dist/auth/oauth/load.js +5 -2
  101. package/dist/auth/oauth/load.js.map +1 -1
  102. package/dist/auth/oauth/meta.d.ts.map +1 -1
  103. package/dist/auth/oauth/meta.js +1 -14
  104. package/dist/auth/oauth/meta.js.map +1 -1
  105. package/dist/auth/oauth/openai-chatgpt.js +1 -1
  106. package/dist/auth/oauth/openai-chatgpt.js.map +1 -1
  107. package/dist/auth/oauth/openai-codex.d.ts.map +1 -1
  108. package/dist/auth/oauth/openai-codex.js +4 -4
  109. package/dist/auth/oauth/openai-codex.js.map +1 -1
  110. package/dist/auth/oauth/radius.d.ts.map +1 -1
  111. package/dist/auth/oauth/radius.js +9 -3
  112. package/dist/auth/oauth/radius.js.map +1 -1
  113. package/dist/auth/oauth/trusted-url.d.ts +7 -0
  114. package/dist/auth/oauth/trusted-url.d.ts.map +1 -0
  115. package/dist/auth/oauth/trusted-url.js +12 -0
  116. package/dist/auth/oauth/trusted-url.js.map +1 -0
  117. package/dist/auth/types.d.ts +9 -0
  118. package/dist/auth/types.d.ts.map +1 -1
  119. package/dist/auth/types.js.map +1 -1
  120. package/dist/cli.js +6 -2
  121. package/dist/cli.js.map +1 -1
  122. package/dist/compat/extension-oauth-types.d.ts +4 -0
  123. package/dist/compat/extension-oauth-types.d.ts.map +1 -1
  124. package/dist/compat/extension-oauth-types.js.map +1 -1
  125. package/dist/env-api-keys.d.ts.map +1 -1
  126. package/dist/env-api-keys.js +1 -0
  127. package/dist/env-api-keys.js.map +1 -1
  128. package/dist/index.d.ts +4 -4
  129. package/dist/index.d.ts.map +1 -1
  130. package/dist/index.js +4 -3
  131. package/dist/index.js.map +1 -1
  132. package/dist/lazy-bedrock-provider.d.ts +10 -0
  133. package/dist/lazy-bedrock-provider.d.ts.map +1 -0
  134. package/dist/lazy-bedrock-provider.js +13 -0
  135. package/dist/lazy-bedrock-provider.js.map +1 -0
  136. package/dist/lazy-oauth.d.ts +10 -0
  137. package/dist/lazy-oauth.d.ts.map +1 -0
  138. package/dist/lazy-oauth.js +23 -0
  139. package/dist/lazy-oauth.js.map +1 -0
  140. package/dist/models.d.ts +9 -0
  141. package/dist/models.d.ts.map +1 -1
  142. package/dist/models.generated.d.ts +4 -0
  143. package/dist/models.generated.d.ts.map +1 -1
  144. package/dist/models.generated.js +5 -1
  145. package/dist/models.generated.js.map +1 -1
  146. package/dist/models.js +28 -12
  147. package/dist/models.js.map +1 -1
  148. package/dist/providers/all.d.ts.map +1 -1
  149. package/dist/providers/all.js +2 -0
  150. package/dist/providers/all.js.map +1 -1
  151. package/dist/providers/amazon-bedrock.models.js +1 -1
  152. package/dist/providers/amazon-bedrock.models.js.map +1 -1
  153. package/dist/providers/ant-ling.models.js +1 -1
  154. package/dist/providers/ant-ling.models.js.map +1 -1
  155. package/dist/providers/anthropic.models.js +1 -1
  156. package/dist/providers/anthropic.models.js.map +1 -1
  157. package/dist/providers/azure.models.js +1 -1
  158. package/dist/providers/azure.models.js.map +1 -1
  159. package/dist/providers/baseten.models.js +1 -1
  160. package/dist/providers/baseten.models.js.map +1 -1
  161. package/dist/providers/cerebras.models.js +1 -1
  162. package/dist/providers/cerebras.models.js.map +1 -1
  163. package/dist/providers/cloudflare-ai-gateway.models.js +1 -1
  164. package/dist/providers/cloudflare-ai-gateway.models.js.map +1 -1
  165. package/dist/providers/cloudflare-workers-ai.models.js +1 -1
  166. package/dist/providers/cloudflare-workers-ai.models.js.map +1 -1
  167. package/dist/providers/compat-schema.d.ts +494 -0
  168. package/dist/providers/compat-schema.d.ts.map +1 -0
  169. package/dist/providers/compat-schema.js +447 -0
  170. package/dist/providers/compat-schema.js.map +1 -0
  171. package/dist/providers/data/.manifest.json +1 -1
  172. package/dist/providers/data/amazon-bedrock.json +1 -1
  173. package/dist/providers/data/anthropic.json +1 -1
  174. package/dist/providers/data/azure.json +1 -1
  175. package/dist/providers/data/baseten.json +1 -1
  176. package/dist/providers/data/cerebras.json +1 -1
  177. package/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  178. package/dist/providers/data/cloudflare-workers-ai.json +1 -1
  179. package/dist/providers/data/fireworks.json +1 -1
  180. package/dist/providers/data/github-copilot.json +1 -1
  181. package/dist/providers/data/google-vertex.json +1 -1
  182. package/dist/providers/data/google.json +1 -1
  183. package/dist/providers/data/groq.json +1 -1
  184. package/dist/providers/data/huggingface.json +1 -1
  185. package/dist/providers/data/kimi-coding.json +1 -1
  186. package/dist/providers/data/meta.json +1 -1
  187. package/dist/providers/data/minimax-cn.json +1 -1
  188. package/dist/providers/data/minimax.json +1 -1
  189. package/dist/providers/data/mistral.json +1 -1
  190. package/dist/providers/data/moonshotai-cn.json +1 -1
  191. package/dist/providers/data/moonshotai.json +1 -1
  192. package/dist/providers/data/nvidia.json +1 -1
  193. package/dist/providers/data/openai-codex.json +1 -1
  194. package/dist/providers/data/openai.json +1 -1
  195. package/dist/providers/data/opencode-go.json +1 -1
  196. package/dist/providers/data/opencode.json +1 -1
  197. package/dist/providers/data/openrouter.json +1 -1
  198. package/dist/providers/data/qwen-token-plan-cn.json +1 -1
  199. package/dist/providers/data/qwen-token-plan-individual-cn.json +1 -0
  200. package/dist/providers/data/qwen-token-plan-individual.json +1 -1
  201. package/dist/providers/data/qwen-token-plan.json +1 -1
  202. package/dist/providers/data/radius.json +1 -1
  203. package/dist/providers/data/together.json +1 -1
  204. package/dist/providers/data/typesafe.json +1 -1
  205. package/dist/providers/data/vercel-ai-gateway.json +1 -1
  206. package/dist/providers/data/xai.json +1 -1
  207. package/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
  208. package/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
  209. package/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
  210. package/dist/providers/data/xiaomi.json +1 -1
  211. package/dist/providers/data/zai-coding-cn.json +1 -1
  212. package/dist/providers/data/zai.json +1 -1
  213. package/dist/providers/deepseek.models.js +1 -1
  214. package/dist/providers/deepseek.models.js.map +1 -1
  215. package/dist/providers/faux.d.ts.map +1 -1
  216. package/dist/providers/faux.js +31 -9
  217. package/dist/providers/faux.js.map +1 -1
  218. package/dist/providers/fireworks.models.js +1 -1
  219. package/dist/providers/fireworks.models.js.map +1 -1
  220. package/dist/providers/github-copilot.d.ts +3 -1
  221. package/dist/providers/github-copilot.d.ts.map +1 -1
  222. package/dist/providers/github-copilot.js +13 -2
  223. package/dist/providers/github-copilot.js.map +1 -1
  224. package/dist/providers/github-copilot.models.js +1 -1
  225. package/dist/providers/github-copilot.models.js.map +1 -1
  226. package/dist/providers/google-vertex.models.js +1 -1
  227. package/dist/providers/google-vertex.models.js.map +1 -1
  228. package/dist/providers/google.models.js +1 -1
  229. package/dist/providers/google.models.js.map +1 -1
  230. package/dist/providers/groq.models.js +1 -1
  231. package/dist/providers/groq.models.js.map +1 -1
  232. package/dist/providers/huggingface.models.js +1 -1
  233. package/dist/providers/huggingface.models.js.map +1 -1
  234. package/dist/providers/kimi-coding.d.ts +1 -1
  235. package/dist/providers/kimi-coding.js +3 -3
  236. package/dist/providers/kimi-coding.js.map +1 -1
  237. package/dist/providers/kimi-coding.models.js +1 -1
  238. package/dist/providers/kimi-coding.models.js.map +1 -1
  239. package/dist/providers/meta.models.js +1 -1
  240. package/dist/providers/meta.models.js.map +1 -1
  241. package/dist/providers/minimax-cn.models.js +1 -1
  242. package/dist/providers/minimax-cn.models.js.map +1 -1
  243. package/dist/providers/minimax.models.js +1 -1
  244. package/dist/providers/minimax.models.js.map +1 -1
  245. package/dist/providers/mistral.models.js +1 -1
  246. package/dist/providers/mistral.models.js.map +1 -1
  247. package/dist/providers/model-schema.d.ts +91 -0
  248. package/dist/providers/model-schema.d.ts.map +1 -0
  249. package/dist/providers/model-schema.js +68 -0
  250. package/dist/providers/model-schema.js.map +1 -0
  251. package/dist/providers/moonshotai-cn.models.js +1 -1
  252. package/dist/providers/moonshotai-cn.models.js.map +1 -1
  253. package/dist/providers/moonshotai.models.js +1 -1
  254. package/dist/providers/moonshotai.models.js.map +1 -1
  255. package/dist/providers/nvidia.models.js +1 -1
  256. package/dist/providers/nvidia.models.js.map +1 -1
  257. package/dist/providers/openai-codex-catalog.d.ts.map +1 -1
  258. package/dist/providers/openai-codex-catalog.js +44 -44
  259. package/dist/providers/openai-codex-catalog.js.map +1 -1
  260. package/dist/providers/openai-codex.models.js +1 -1
  261. package/dist/providers/openai-codex.models.js.map +1 -1
  262. package/dist/providers/openai.d.ts.map +1 -1
  263. package/dist/providers/openai.js +12 -3
  264. package/dist/providers/openai.js.map +1 -1
  265. package/dist/providers/openai.models.js +1 -1
  266. package/dist/providers/openai.models.js.map +1 -1
  267. package/dist/providers/opencode-go.d.ts +3 -1
  268. package/dist/providers/opencode-go.d.ts.map +1 -1
  269. package/dist/providers/opencode-go.js +2 -0
  270. package/dist/providers/opencode-go.js.map +1 -1
  271. package/dist/providers/opencode-go.models.js +1 -1
  272. package/dist/providers/opencode-go.models.js.map +1 -1
  273. package/dist/providers/opencode.js +1 -1
  274. package/dist/providers/opencode.js.map +1 -1
  275. package/dist/providers/opencode.models.js +1 -1
  276. package/dist/providers/opencode.models.js.map +1 -1
  277. package/dist/providers/openrouter-api.d.ts +40 -0
  278. package/dist/providers/openrouter-api.d.ts.map +1 -0
  279. package/dist/providers/openrouter-api.js +41 -0
  280. package/dist/providers/openrouter-api.js.map +1 -0
  281. package/dist/providers/openrouter.d.ts +11 -1
  282. package/dist/providers/openrouter.d.ts.map +1 -1
  283. package/dist/providers/openrouter.js +52 -1
  284. package/dist/providers/openrouter.js.map +1 -1
  285. package/dist/providers/openrouter.models.js +1 -1
  286. package/dist/providers/openrouter.models.js.map +1 -1
  287. package/dist/providers/qwen-token-plan-cn.models.js +1 -1
  288. package/dist/providers/qwen-token-plan-cn.models.js.map +1 -1
  289. package/dist/providers/qwen-token-plan-individual-cn.d.ts +3 -0
  290. package/dist/providers/qwen-token-plan-individual-cn.d.ts.map +1 -0
  291. package/dist/providers/qwen-token-plan-individual-cn.js +15 -0
  292. package/dist/providers/qwen-token-plan-individual-cn.js.map +1 -0
  293. package/dist/providers/qwen-token-plan-individual-cn.models.d.ts +6 -0
  294. package/dist/providers/qwen-token-plan-individual-cn.models.d.ts.map +1 -0
  295. package/dist/providers/qwen-token-plan-individual-cn.models.js +8 -0
  296. package/dist/providers/qwen-token-plan-individual-cn.models.js.map +1 -0
  297. package/dist/providers/qwen-token-plan-individual.models.js +1 -1
  298. package/dist/providers/qwen-token-plan-individual.models.js.map +1 -1
  299. package/dist/providers/qwen-token-plan.models.js +1 -1
  300. package/dist/providers/qwen-token-plan.models.js.map +1 -1
  301. package/dist/providers/radius-config.d.ts.map +1 -1
  302. package/dist/providers/radius-config.js +2 -1
  303. package/dist/providers/radius-config.js.map +1 -1
  304. package/dist/providers/radius.d.ts.map +1 -1
  305. package/dist/providers/radius.js +4 -12
  306. package/dist/providers/radius.js.map +1 -1
  307. package/dist/providers/radius.models.js +1 -1
  308. package/dist/providers/radius.models.js.map +1 -1
  309. package/dist/providers/schema-builders.d.ts +10 -0
  310. package/dist/providers/schema-builders.d.ts.map +1 -0
  311. package/dist/providers/schema-builders.js +18 -0
  312. package/dist/providers/schema-builders.js.map +1 -0
  313. package/dist/providers/together.models.js +1 -1
  314. package/dist/providers/together.models.js.map +1 -1
  315. package/dist/providers/typesafe.models.js +1 -1
  316. package/dist/providers/typesafe.models.js.map +1 -1
  317. package/dist/providers/vercel-ai-gateway.models.js +1 -1
  318. package/dist/providers/vercel-ai-gateway.models.js.map +1 -1
  319. package/dist/providers/xai.models.js +1 -1
  320. package/dist/providers/xai.models.js.map +1 -1
  321. package/dist/providers/xiaomi-token-plan-ams.models.js +1 -1
  322. package/dist/providers/xiaomi-token-plan-ams.models.js.map +1 -1
  323. package/dist/providers/xiaomi-token-plan-cn.models.js +1 -1
  324. package/dist/providers/xiaomi-token-plan-cn.models.js.map +1 -1
  325. package/dist/providers/xiaomi-token-plan-sgp.models.js +1 -1
  326. package/dist/providers/xiaomi-token-plan-sgp.models.js.map +1 -1
  327. package/dist/providers/xiaomi.models.js +1 -1
  328. package/dist/providers/xiaomi.models.js.map +1 -1
  329. package/dist/providers/zai-coding-cn.models.js +1 -1
  330. package/dist/providers/zai-coding-cn.models.js.map +1 -1
  331. package/dist/providers/zai.models.js +1 -1
  332. package/dist/providers/zai.models.js.map +1 -1
  333. package/dist/telemetry.d.ts +288 -0
  334. package/dist/telemetry.d.ts.map +1 -0
  335. package/dist/telemetry.js +192 -0
  336. package/dist/telemetry.js.map +1 -0
  337. package/dist/types.d.ts +57 -310
  338. package/dist/types.d.ts.map +1 -1
  339. package/dist/types.js.map +1 -1
  340. package/dist/utils/error-body.d.ts +8 -0
  341. package/dist/utils/error-body.d.ts.map +1 -1
  342. package/dist/utils/error-body.js +30 -2
  343. package/dist/utils/error-body.js.map +1 -1
  344. package/dist/utils/estimate.js +1 -1
  345. package/dist/utils/estimate.js.map +1 -1
  346. package/dist/utils/event-stream.d.ts +10 -1
  347. package/dist/utils/event-stream.d.ts.map +1 -1
  348. package/dist/utils/event-stream.js +25 -0
  349. package/dist/utils/event-stream.js.map +1 -1
  350. package/dist/utils/identity.d.ts +65 -0
  351. package/dist/utils/identity.d.ts.map +1 -0
  352. package/dist/utils/identity.js +141 -0
  353. package/dist/utils/identity.js.map +1 -0
  354. package/dist/utils/json-parse.d.ts +10 -0
  355. package/dist/utils/json-parse.d.ts.map +1 -1
  356. package/dist/utils/json-parse.js +26 -1
  357. package/dist/utils/json-parse.js.map +1 -1
  358. package/dist/utils/model-operations.d.ts +3 -1
  359. package/dist/utils/model-operations.d.ts.map +1 -1
  360. package/dist/utils/model-operations.js +6 -0
  361. package/dist/utils/model-operations.js.map +1 -1
  362. package/dist/utils/openrouter-cost.d.ts +24 -0
  363. package/dist/utils/openrouter-cost.d.ts.map +1 -0
  364. package/dist/utils/openrouter-cost.js +34 -0
  365. package/dist/utils/openrouter-cost.js.map +1 -0
  366. package/dist/utils/overflow.d.ts +1 -0
  367. package/dist/utils/overflow.d.ts.map +1 -1
  368. package/dist/utils/overflow.js +8 -1
  369. package/dist/utils/overflow.js.map +1 -1
  370. package/dist/utils/provider-retry.d.ts +2 -0
  371. package/dist/utils/provider-retry.d.ts.map +1 -1
  372. package/dist/utils/provider-retry.js +2 -0
  373. package/dist/utils/provider-retry.js.map +1 -1
  374. package/dist/utils/retry.d.ts.map +1 -1
  375. package/dist/utils/retry.js +29 -10
  376. package/dist/utils/retry.js.map +1 -1
  377. package/dist/utils/streaming-json.d.ts +84 -0
  378. package/dist/utils/streaming-json.d.ts.map +1 -0
  379. package/dist/utils/streaming-json.js +513 -0
  380. package/dist/utils/streaming-json.js.map +1 -0
  381. package/dist/utils/{typebox-helpers.d.ts → string-enum.d.ts} +5 -5
  382. package/dist/utils/string-enum.d.ts.map +1 -0
  383. package/dist/utils/{typebox-helpers.js → string-enum.js} +5 -6
  384. package/dist/utils/string-enum.js.map +1 -0
  385. package/dist/utils/text.d.ts +7 -0
  386. package/dist/utils/text.d.ts.map +1 -1
  387. package/dist/utils/text.js +9 -0
  388. package/dist/utils/text.js.map +1 -1
  389. package/dist/utils/transcript.d.ts +23 -9
  390. package/dist/utils/transcript.d.ts.map +1 -1
  391. package/dist/utils/transcript.js +30 -19
  392. package/dist/utils/transcript.js.map +1 -1
  393. package/dist/utils/validation.d.ts +5 -3
  394. package/dist/utils/validation.d.ts.map +1 -1
  395. package/dist/utils/validation.js +27 -445
  396. package/dist/utils/validation.js.map +1 -1
  397. package/dist/utils/version.d.ts +2 -0
  398. package/dist/utils/version.d.ts.map +1 -0
  399. package/dist/utils/version.js +3 -0
  400. package/dist/utils/version.js.map +1 -0
  401. package/package.json +19 -10
  402. package/dist/utils/assistant-message-frame.d.ts +0 -77
  403. package/dist/utils/assistant-message-frame.d.ts.map +0 -1
  404. package/dist/utils/assistant-message-frame.js +0 -425
  405. package/dist/utils/assistant-message-frame.js.map +0 -1
  406. package/dist/utils/pi-user-agent.d.ts +0 -2
  407. package/dist/utils/pi-user-agent.d.ts.map +0 -1
  408. package/dist/utils/pi-user-agent.js +0 -12
  409. package/dist/utils/pi-user-agent.js.map +0 -1
  410. package/dist/utils/typebox-helpers.d.ts.map +0 -1
  411. package/dist/utils/typebox-helpers.js.map +0 -1
package/README.md CHANGED
@@ -18,6 +18,7 @@ Unified LLM API with provider collections, automatic auth resolution, token and
18
18
  - [Auth](#auth)
19
19
  - [How Auth Resolves](#how-auth-resolves)
20
20
  - [Transforming Request Headers](#transforming-request-headers)
21
+ - [Client Identity](#client-identity)
21
22
  - [Credential Store](#credential-store)
22
23
  - [Environment Variables](#environment-variables)
23
24
  - [Tools](#tools)
@@ -26,7 +27,6 @@ Unified LLM API with provider collections, automatic auth resolution, token and
26
27
  - [Streaming Tool Calls with Partial JSON](#streaming-tool-calls-with-partial-json)
27
28
  - [Validating Tool Arguments](#validating-tool-arguments)
28
29
  - [Complete Event Reference](#complete-event-reference)
29
- - [Compact Assistant Message Frames](#compact-assistant-message-frames)
30
30
  - [Image Input](#image-input)
31
31
  - [Image Generation](#image-generation)
32
32
  - [Classification](#classification)
@@ -35,6 +35,7 @@ Unified LLM API with provider collections, automatic auth resolution, token and
35
35
  - [Provider-Specific Options](#provider-specific-options-streamcomplete)
36
36
  - [Streaming Thinking Content](#streaming-thinking-content)
37
37
  - [Stop Reasons](#stop-reasons)
38
+ - [Telemetry](#telemetry)
38
39
  - [Error Handling](#error-handling)
39
40
  - [Aborting Requests](#aborting-requests)
40
41
  - [Continuing After Abort](#continuing-after-abort)
@@ -60,10 +61,10 @@ Unified LLM API with provider collections, automatic auth resolution, token and
60
61
 
61
62
  ## Supported Providers
62
63
 
63
- - **OpenAI**
64
+ - **OpenAI** (including the Decisions classifier API)
64
65
  - **Ant Ling**
65
66
  - **Azure OpenAI (Responses)**
66
- - **OpenAI Codex (legacy)** (ChatGPT Plus/Pro subscription, requires OAuth, see below)
67
+ - **OpenAI Codex** (ChatGPT Plus/Pro subscription, requires OAuth, see below)
67
68
  - **Radius** (API key or OAuth, with a dynamically refreshed gateway catalog)
68
69
  - **TypeSafe** (System One classifier API)
69
70
  - **DeepSeek**
@@ -102,15 +103,16 @@ Unified LLM API with provider collections, automatic auth resolution, token and
102
103
  npm install @earendil-works/pi-ai
103
104
  ```
104
105
 
105
- TypeBox exports are re-exported from `@earendil-works/pi-ai`: `Type`, `Static`, and `TSchema`.
106
+ Tool parameters are JSON Schema. The examples build them with `@earendil-works/pi-schema`, which also types the arguments (`npm install @earendil-works/pi-schema`); TypeBox schemas and plain JSON Schema objects work as well.
106
107
 
107
108
  ## Quick Start
108
109
 
109
110
  You build a `Models` collection of providers and stream through it. The quickest start registers every built-in provider; apps that care about bundle size register individual providers instead (see [Provider Factories](#provider-factories) and [Bundling and Tree Shaking](#bundling-and-tree-shaking)).
110
111
 
111
112
  ```typescript
112
- import { Type, type Context, type Tool } from '@earendil-works/pi-ai';
113
+ import { type Context, type Tool } from '@earendil-works/pi-ai';
113
114
  import { builtinModels } from '@earendil-works/pi-ai/providers/all';
115
+ import { obj, opt, str } from '@earendil-works/pi-schema';
114
116
 
115
117
  // A Models collection with every built-in provider registered
116
118
  const models = builtinModels();
@@ -118,12 +120,12 @@ const models = builtinModels();
118
120
  // Sync lookup against the collection
119
121
  const model = models.getModel('openai', 'gpt-4o-mini')!;
120
122
 
121
- // Define tools with TypeBox schemas for type safety and validation
123
+ // Define tools with JSON Schema; pi-schema's builders also type the arguments
122
124
  const tools: Tool[] = [{
123
125
  name: 'get_time',
124
126
  description: 'Get the current time',
125
- parameters: Type.Object({
126
- timezone: Type.Optional(Type.String({ description: 'Optional timezone (e.g., America/New_York)' }))
127
+ parameters: obj({
128
+ timezone: opt(str({ description: 'Optional timezone (e.g., America/New_York)' }))
127
129
  })
128
130
  }];
129
131
 
@@ -232,8 +234,12 @@ for (const block of response.content) {
232
234
  }
233
235
  ```
234
236
 
237
+ `usage.cost.totalFromProvider` is `true` when `usage.cost.total` is the billed cost reported by the provider and `false` when it is estimated from the model's catalog rates. A missing value, as in sessions recorded before this field existed, also means `false`.
238
+
235
239
  Snippets in the rest of this README assume a `models` collection set up like this (with the relevant providers registered).
236
240
 
241
+ `usage.cost.total` is the best available total cost. For OpenRouter chat responses, it uses the cost reported by OpenRouter, including both the OpenRouter charge and upstream inference cost for BYOK requests. When provider accounting is unavailable or invalid, it falls back to the model's catalog rates. The `input`, `output`, `cacheRead`, and `cacheWrite` cost components remain catalog estimates and may not sum to a provider-reported total.
242
+
237
243
  ## Providers and Models
238
244
 
239
245
  A **provider** is the runtime unit: it owns its model catalog, its auth (API key resolution, OAuth flows), and its stream behavior. A `Models` collection holds providers and routes every request to the provider that owns the model.
@@ -425,6 +431,33 @@ Header names are merged case-insensitively. Explicit headers override auth/model
425
431
 
426
432
  `transformHeaders` belongs to `Models`, not `Provider`. A `Models` implementation must consume it and remove it before calling `Provider.stream*()`. Provider implementations continue receiving ordinary `ApiStreamOptions` or `SimpleStreamOptions` and never handle the transform themselves. Use this option instead of calling `getAuth(model)` before `stream*()`, which would resolve request auth twice.
427
433
 
434
+ ### Client Identity
435
+
436
+ `identity` controls how requests identify the calling app to providers. Set it on `createModels()` as a default, or per request; a request's fields override the `Models` default field by field:
437
+
438
+ ```typescript
439
+ const models = createModels({
440
+ identity: {
441
+ userAgent: 'detailed',
442
+ version: '2.1.0',
443
+ attribution: { name: 'my-app', url: 'https://my-app.example', categories: ['cloud-agent'] },
444
+ },
445
+ });
446
+
447
+ await models.completeSimple(model, context, { identity: { attribution: null } });
448
+ ```
449
+
450
+ - `userAgent`: `"detailed"` (default) sends `pi/<version> (<platform>; <runtime>; <arch>)`, `"short"` sends `pi`, and `{ custom: "..." }` sends the given value. On Bedrock the value is appended to the AWS SDK user agent.
451
+ - `version`: the version in the detailed `User-Agent`. Default: the pi-ai version.
452
+ - `attribution`: provider attribution headers. Absent (default) or `null` sends none; `null` also turns off attribution from a merged identity. `{ name, url, categories? }` maps to each provider's headers:
453
+ - OpenRouter: `HTTP-Referer: <url>` (the app's identity in OpenRouter's rankings, grouped by origin), `X-OpenRouter-Title: <name>`, and `X-OpenRouter-Categories` (comma-separated).
454
+ - NVIDIA NIM: `X-BILLING-INVOKE-ORIGIN: <name>` with its first letter upper-cased.
455
+ - OpenCode: `x-opencode-client: <name>`.
456
+
457
+ `PI_ATTRIBUTION` is pi's: `{ name: "pi", url: "https://pi.dev", categories: ["cli-agent"] }`.
458
+
459
+ Identity headers are defaults below provider, model, and request headers, so configured headers win and a `null` request header removes one. Providers that send a fixed client identity, such as GitHub Copilot and Anthropic OAuth, keep it. `withClientIdentity(models, identity)` returns a wrapper of a `Models` (or `MutableModels`) whose requests use `identity` over the one the `Models` was created with, for libraries that receive a `Models` from their host. `identity` is plain JSON, so it can be persisted with other request options.
460
+
428
461
  ### Credential Store
429
462
 
430
463
  Stored credentials (API keys entered interactively, OAuth tokens) live in a `CredentialStore` — one type-tagged credential per provider. pi-ai ships an in-memory default; apps inject persistent storage:
@@ -491,6 +524,7 @@ Built-in providers resolve these env vars (Node.js; in browsers pass `apiKey` ex
491
524
  | Qwen Token Plan (existing catalog) | `QWEN_TOKEN_PLAN_API_KEY` |
492
525
  | Qwen Token Plan (Individual) | `QWEN_TOKEN_PLAN_API_KEY` |
493
526
  | Qwen Token Plan (China) | `QWEN_TOKEN_PLAN_CN_API_KEY` |
527
+ | Qwen Token Plan (Individual, China) | `QWEN_TOKEN_PLAN_CN_API_KEY` |
494
528
  | Xiaomi MiMo (API billing) | `XIAOMI_API_KEY` |
495
529
  | Xiaomi MiMo Token Plan (China) | `XIAOMI_TOKEN_PLAN_CN_API_KEY` |
496
530
  | Xiaomi MiMo Token Plan (Amsterdam) | `XIAOMI_TOKEN_PLAN_AMS_API_KEY` |
@@ -500,40 +534,43 @@ Built-in providers resolve these env vars (Node.js; in browsers pass `apiKey` ex
500
534
  `qwen-token-plan-individual` and `qwen-token-plan` share the international endpoint and
501
535
  `QWEN_TOKEN_PLAN_API_KEY`. The Individual provider exposes only the models documented for Individual
502
536
  subscriptions, while the existing provider retains its broader catalog for backward compatibility.
537
+ `qwen-token-plan-individual-cn` applies the same Individual catalog to the China endpoint and
538
+ `QWEN_TOKEN_PLAN_CN_API_KEY`.
503
539
  Stored credentials remain provider-scoped, so save the key under the provider ID you register.
504
540
 
505
541
  Amazon Bedrock resolves ambient AWS credentials (`AWS_PROFILE`, access key pairs, `AWS_BEARER_TOKEN_BEDROCK`, ECS task roles, web identity tokens); its provider-owned login flow supports bearer tokens, AWS profiles, and the existing credential chain. Vertex AI resolves either an explicit key or gcloud Application Default Credentials plus project/location, with a provider-owned login flow for API keys, ADC, and service-account files.
506
542
 
507
543
  ## Tools
508
544
 
509
- Tools enable LLMs to interact with external systems. This library uses TypeBox schemas for type-safe tool definitions with automatic validation using TypeBox's built-in validator and value conversion utilities. TypeBox schemas can be serialized and deserialized as plain JSON, making them ideal for distributed systems.
545
+ Tools enable LLMs to interact with external systems. A tool's `parameters` is a JSON Schema object: built with `@earendil-works/pi-schema`'s builders (which also type the arguments through its `Static`), with TypeBox, or written by hand. `validateToolCall()` and `validateToolArguments()` validate with pi-schema, coercing loosely typed arguments first (numeric strings, `"true"`, a single value for an array, `null` for an omitted optional property). Schemas are plain JSON, so they serialize with the rest of a context.
510
546
 
511
547
  ### Defining Tools
512
548
 
513
549
  ```typescript
514
- import { Type, type Tool, StringEnum } from '@earendil-works/pi-ai';
550
+ import { type Tool, StringEnum } from '@earendil-works/pi-ai';
551
+ import { arr, obj, str } from '@earendil-works/pi-schema';
515
552
 
516
- // Define tool parameters with TypeBox
553
+ // Define tool parameters with pi-schema's builders
517
554
  const weatherTool: Tool = {
518
555
  name: 'get_weather',
519
556
  description: 'Get current weather for a location',
520
- parameters: Type.Object({
521
- location: Type.String({ description: 'City name or coordinates' }),
557
+ parameters: obj({
558
+ location: str({ description: 'City name or coordinates' }),
522
559
  units: StringEnum(['celsius', 'fahrenheit'], { default: 'celsius' })
523
560
  })
524
561
  };
525
562
 
526
- // Note: For Google API compatibility, use StringEnum helper instead of Type.Enum
527
- // Type.Enum generates anyOf/const patterns that Google doesn't support
563
+ // Note: StringEnum gives { type: "string", enum: [...] }, which every provider accepts,
564
+ // including Google's, which rejects anyOf/const patterns
528
565
 
529
566
  const bookMeetingTool: Tool = {
530
567
  name: 'book_meeting',
531
568
  description: 'Schedule a meeting',
532
- parameters: Type.Object({
533
- title: Type.String({ minLength: 1 }),
534
- startTime: Type.String({ format: 'date-time' }),
535
- endTime: Type.String({ format: 'date-time' }),
536
- attendees: Type.Array(Type.String({ format: 'email' }), { minItems: 1 })
569
+ parameters: obj({
570
+ title: str({ minLength: 1 }),
571
+ startTime: str({ format: 'date-time' }),
572
+ endTime: str({ format: 'date-time' }),
573
+ attendees: arr(str({ format: 'email' }), { minItems: 1 })
537
574
  })
538
575
  };
539
576
  ```
@@ -546,10 +583,7 @@ Tools can opt in to provider-side constrained sampling. For JSON-schema tools, `
546
583
  const strictTool: Tool = {
547
584
  name: 'edit_file',
548
585
  description: 'Edit a file',
549
- parameters: Type.Object({
550
- path: Type.String(),
551
- content: Type.String()
552
- }, { additionalProperties: false }),
586
+ parameters: obj({ path: str(), content: str() }), // obj() is closed: additionalProperties: false
553
587
  constrainedSampling: { type: 'json_schema', strict: 'prefer' }
554
588
  };
555
589
  ```
@@ -560,9 +594,7 @@ Strict JSON-schema constrained sampling is supported for OpenAI, Anthropic, supp
560
594
  const patchTool: Tool = {
561
595
  name: 'apply_patch',
562
596
  description: 'Apply a patch',
563
- parameters: Type.Object({
564
- input: Type.String()
565
- }, { additionalProperties: false }),
597
+ parameters: obj({ input: str() }),
566
598
  constrainedSampling: {
567
599
  type: 'grammar',
568
600
  variants: {
@@ -666,7 +698,7 @@ for await (const event of s) {
666
698
 
667
699
  ### Validating Tool Arguments
668
700
 
669
- When implementing your own tool execution loop, use `validateToolCall` to validate arguments before passing them to your tools:
701
+ When implementing your own tool execution loop, use `validateToolCall` to validate arguments before passing them to your tools. It coerces loosely typed arguments with pi-schema (`compile(schema, { coerce: true }).parse()`), returns the coerced arguments, and throws an error listing pi-schema's errors (`path: message`) followed by the arguments it received:
670
702
 
671
703
  ```typescript
672
704
  import { validateToolCall, type Tool } from '@earendil-works/pi-ai';
@@ -723,34 +755,6 @@ All streaming events emitted during assistant message generation:
723
755
 
724
756
  Streaming events for different content blocks are not guaranteed to be contiguous. Providers may emit deltas for text, thinking, and tool calls in the same upstream chunk, and pi may surface corresponding events interleaved, for example `text_start`, `text_delta`, `toolcall_start`, `text_delta`, `toolcall_delta`. Consumers must use `contentIndex` to associate each delta/end event with its block and must not assume that a block's `*_start`/`*_delta`/`*_end` sequence is uninterrupted by events for other blocks.
725
757
 
726
- ### Compact Assistant Message Frames
727
-
728
- `AssistantMessageFrameEncoder` converts one stream into compact, persistable `AssistantMessageFrame` values. Create one encoder per stream and feed it every event in order. The encoder understands that `partial` is live: a block-start event consumed after the provider has already queued later deltas snapshots the current block once, and covered queued text/thinking deltas produce no duplicate frame. It retains only per-open-block counters plus, temporarily, the raw prefix needed to synchronize an already-advanced tool call. It never clones the growing full partial per token.
729
-
730
- The start frame contains message metadata with empty content. Text and thinking frames store each generated character at most once before the authoritative end frame. Tool calls that were already advanced when their start event was consumed use one compact JSON checkpoint before ordinary deltas resume. Terminal `done` and `error` events produce no frame because final message settlement is separate. A pre-generation `error` therefore produces no frames.
731
-
732
- `reduceAssistantMessageFrames()` is the canonical pure reducer. It reconstructs text, thinking, and tool-call arguments, including interleaved blocks identified by `contentIndex`, and rejects malformed sequences. It performs a single pass over the iterable and returns `undefined` when there is no start frame. End frames replace blocks with the provider's authoritative completed content and metadata. The reducer does not validate tool arguments against a TypeBox schema; call `validateToolCall` before execution.
733
-
734
- ```typescript
735
- import {
736
- AssistantMessageFrameEncoder,
737
- reduceAssistantMessageFrames,
738
- type AssistantMessageFrame,
739
- } from '@earendil-works/pi-ai';
740
-
741
- const encoder = new AssistantMessageFrameEncoder();
742
- const frames: AssistantMessageFrame[] = [];
743
- for await (const event of s) {
744
- const frame = encoder.encode(event);
745
- if (frame) frames.push(frame);
746
- }
747
-
748
- const reconstructedPartial = reduceAssistantMessageFrames(frames);
749
- const finalMessage = await s.result(); // Persist terminal settlement separately.
750
- ```
751
-
752
- An encoder rejects duplicate starts, updates before start, `done` before start, events after a terminal event, duplicate block starts, and block-kind mismatches. An `error` before start is valid and returns no frame.
753
-
754
758
  ## Image Input
755
759
 
756
760
  Models with vision capabilities can process images. You can check if a model supports images via the `input` property. If you pass images to a non-vision model, they are silently ignored.
@@ -890,15 +894,17 @@ console.log(model.output); // ['image'] or ['image', 'text']
890
894
 
891
895
  ## Classification
892
896
 
893
- Classifier models consume structured JSON state and answer one or more typed questions. They do not use chat or image-generation APIs. TypeSafe's Jev model is available from these built-in providers:
897
+ Classifier models consume structured JSON state, and optionally images, and answer one or more typed questions. They do not use chat or image-generation APIs. TypeSafe's Jev model, Cloudflare's Clef models, OpenAI's GPT-6 Luna, and Microsoft-Decision-1 are available from these built-in providers:
894
898
 
895
899
  | Provider | Model IDs | Auth |
896
900
  | --- | --- | --- |
897
901
  | `typesafe` | `jev-latest` | `TYPESAFE_API_KEY` |
898
- | `openrouter` | `typesafe/jev-1.13`, `~typesafe/jev-latest` | `OPENROUTER_API_KEY` or OpenRouter OAuth |
899
- | `cloudflare-workers-ai` | `typesafe/jev`, `@cf/cloudflare/clef`, `@cf/cloudflare/clef-flash` | `CLOUDFLARE_API_KEY` and `CLOUDFLARE_ACCOUNT_ID` |
902
+ | `openrouter` | `typesafe/jev-1.13`, `typesafe/jev-1.14`, `~typesafe/jev-latest`, `cloudflare/clef`, `cloudflare/clef-flash`, `cloudflare/clef-omni` | `OPENROUTER_API_KEY` or OpenRouter OAuth |
903
+ | `cloudflare-workers-ai` | `typesafe/jev`, `typesafe/jev-1.14.0`, `@cf/cloudflare/clef`, `@cf/cloudflare/clef-flash`, `@cf/cloudflare/clef-omni` | `CLOUDFLARE_API_KEY` and `CLOUDFLARE_ACCOUNT_ID` |
900
904
  | `vercel-ai-gateway` | `typesafe-ai/jev` | `AI_GATEWAY_API_KEY` |
901
905
  | `opencode` | `jev-1.13`, `jev-1.13-free` | `OPENCODE_API_KEY` |
906
+ | `openai` | `gpt-6-luna` | `OPENAI_API_KEY` |
907
+ | `github-copilot` | `microsoft-decision-1` | `COPILOT_GITHUB_TOKEN` or GitHub Copilot OAuth |
902
908
 
903
909
  ```typescript
904
910
  import { builtinModels } from '@earendil-works/pi-ai/providers/all';
@@ -936,10 +942,32 @@ The public contract uses `bool` questions and `{ type: "bool", probability }` an
936
942
 
937
943
  When the service reports token counts, `result.usage` carries them with their cost at the model's catalog price, the same `Usage` shape as chat messages. All System One services report token counts; a request that was answered with malformed answers keeps its usage. Local classifiers such as `llama-cpp-classify` report no usage.
938
944
 
939
- `ClassifierOptions.temperature` divides the answer logits by the given value before they are normalized; values above 1 soften the distribution. APIs that cannot apply it, such as System One, ignore it.
945
+ `ClassifierOptions.temperature` divides the answer logits by the given value before they are normalized; values above 1 soften the distribution. APIs that cannot apply it, such as System One and OpenAI Decisions, ignore it.
946
+
947
+ `ClassifierContext.images` holds image blocks (`{ type: "image", data, mimeType }`) judged together with the state. Only models whose `input` includes `"image"` accept them; `classify()` returns an error result for other models.
948
+
949
+ ### System One images
950
+
951
+ System One services take images in three forms. The model's `compat.imageInput` chooses the form (`"assets"`, `"images"`, or `"state-image-urls"`), and `compat.sendImageOptInHeader` controls TypeSafe's opt-in header:
952
+
953
+ - **TypeSafe** (`typesafe`, and Jev on Workers AI) takes PNG and JPEG images as `assets`, `{ "<image-1>": { type: "image", format: "png", data_base64 } }`. Every asset must be referenced from the request, so the state is sent as `["<image-1>", ..., state]`. Images are experimental on TypeSafe's own API and need the `TypeSafe-Danger-Zone-Images: true` header, which the API sends with requests that carry images.
954
+ - **Clef on Workers AI** takes up to four PNG, JPEG, or WebP images as an `images` list of data URLs, next to the unchanged state.
955
+ - **OpenRouter** takes images as `{ type: "image_url", image_url: { url } }` parts before the state: `[part, ..., state]`. It answers requests with `assets` but drops the images, without an error.
956
+
957
+ Built-in catalog entries set `compat` explicitly, so they keep their form when `baseUrl` points at a proxy. For models without it, the APIs detect the form: OpenRouter by provider `openrouter` or a `baseUrl` containing `openrouter.ai`, Clef by a model ID starting with `@cf/cloudflare/clef`, and TypeSafe's form with the opt-in header otherwise. A custom provider that reaches OpenRouter through a proxy matches neither check and must set `compat.imageInput: "state-image-urls"` and `compat.sendImageOptInHeader: false`; otherwise OpenRouter drops its images.
958
+
959
+ Vercel AI Gateway and OpenCode list their Jev models with text input only.
960
+
961
+ ### OpenAI Decisions
962
+
963
+ The `openai-decisions` API calls OpenAI's [Decisions API](https://developers.openai.com/api/docs/guides/decisions) (`POST /v1/decisions`). GPT-6 Luna is its only model. The state is sent as JSON text; with images, the input is one user message with the state followed by the images as data URLs (at most 128). `choice` and `score` questions map to the Decisions types of the same name. `bool` questions become `predicate` questions; predicates have no criteria field, so the meanings of true and false are appended to the instructions. If OpenAI refuses to answer a question, the whole result is an error. Usage reports input tokens only, priced at the catalog input rate with OpenAI's long-context multiplier.
964
+
965
+ The endpoint needs an OpenAI API key; Sign in with ChatGPT credentials are rejected, so the `openai` provider hides `gpt-6-luna` from `getAvailableOfType('classifier')` while it uses OAuth. The API rejects inputs above 922K tokens, but requests that run longer than about five seconds, currently above roughly 600K input tokens, fail with a gateway timeout (504).
940
966
 
941
967
  ### Chat models on llama.cpp
942
968
 
969
+ llama.cpp also serves decision models such as Julia-1 or Kev natively through `/v1/systemone`. Since llama.cpp 0.6.0, `GET /models` lists `decisions` in a model's `architecture.output_modalities` for these models. They use the `typesafe-system-one` API with the server's `/v1` URL as `baseUrl` (for example `http://127.0.0.1:8080/v1`); it needs an `apiKey`, which llama.cpp ignores unless it was started with `--api-key`. The `llama-cpp-classify` API is the fallback for chat models.
970
+
943
971
  The `llama-cpp-classify` API turns a chat model served by llama.cpp's `llama-server` into a classifier. Each question becomes one chat prompt: the state, every question of the request, the state again, and the question with its answers under single-token labels (letters for a choice, `Yes`/`No` for a bool, digits for a score). The prompt up to the final question is shared by all questions of a request, so the server's prompt cache evaluates the state once per request. The server returns the log-probabilities of the next token, and the answer is the softmax over the label tokens. Choices support up to 62 options and scores up to 10 levels. The model's `baseUrl` is the server URL; a trailing `/v1` is ignored. In router mode, the model ID selects the model.
944
972
 
945
973
  ```typescript
@@ -1088,6 +1116,40 @@ Every `AssistantMessage` includes a `stopReason` field that indicates how the ge
1088
1116
 
1089
1117
  `AssistantMessage` may also include `responseId`, a provider-specific upstream response or message identifier when the underlying API exposes one. Do not assume it is always present across providers.
1090
1118
 
1119
+ ## Telemetry
1120
+
1121
+ Pass an explicit parent span (`TelemetrySpan`, not an adapter) through `telemetry`; omitting it uses the no-op span:
1122
+
1123
+ ```typescript
1124
+ import { InMemoryTelemetryContext } from '@earendil-works/pi-telemetry';
1125
+
1126
+ const telemetry = new InMemoryTelemetryContext();
1127
+ await telemetry.startSpan({ name: 'application.turn' }, async (span) => {
1128
+ await models.completeSimple(model, context, { telemetry: span });
1129
+ });
1130
+ ```
1131
+
1132
+ `Models.stream()` and `streamSimple()` create `pi.ai.request`; `streamDeferred()` creates one `pi.ai.poll` per poll. Their completion helpers use the same spans. These spans include auth/setup, end at the terminal result, and do not require the caller to consume events. Direct provider/API calls are not instrumented.
1133
+
1134
+ `AI_TELEMETRY_SCHEMA`, exported from the root and `@earendil-works/pi-ai/models`, defines the typed Pi-owned vocabulary:
1135
+
1136
+ - Start attributes: `provider`, `api`, `model`, and `reasoning` only when `options.reasoning` is a string. Provider-native reasoning objects are ignored.
1137
+ - End attributes: `stop`, `usage.input`, `usage.output`, `usage.cache_read`, `usage.cache_write`, `cost.total`, and optional `response.id`. `stop: "error"` sets error status with the fixed category `provider_error` and `AssistantMessage.errorMessage` truncated to 500 characters (empty when absent). Cancellation keeps status `ok` with `stop: "aborted"`.
1138
+ - `pi.ai.first_chunk` marks the first normalized event, including setup errors. Each completed text, thinking, or tool-call block emits `pi.ai.block` with `type`, `index`, and `chars`; only tool calls include `tool`. Character counts use JavaScript string length; tool counts sum argument delta lengths without serializing arguments.
1139
+
1140
+ When `options.telemetry.metrics` is available, the same requests record metrics:
1141
+
1142
+ | Metric | Unit | Attributes |
1143
+ | --- | --- | --- |
1144
+ | `pi.ai.request.duration` | `ms` | `provider`, `model`, `stop` |
1145
+ | `pi.ai.first_chunk.duration` | `ms` | `provider`, `model` |
1146
+ | `pi.ai.tokens` | `token` | `provider`, `model`, `kind` (`input`, `output`, `cache_read`, `cache_write`) |
1147
+ | `pi.ai.cost` | `USD` | `provider`, `model` |
1148
+
1149
+ Durations use `performance.now()`. Pending/deferred polls do not add tokens or cost; final completed/error polls do. A parent span without metric capabilities remains valid and simply records no metrics. Adapter-created spans carry the same optional metric and propagation capabilities as their root.
1150
+
1151
+ Telemetry does not record prompts, generated text, reasoning content, or arguments in attributes/events. Error status includes up to 500 characters of provider error text, which may contain sensitive data; apply your export policy accordingly. Telemetry observes the existing forwarding path without another stream consumer or per-delta events. Response identifiers and error messages never become metric attributes.
1152
+
1091
1153
  ## Error Handling
1092
1154
 
1093
1155
  Request failures after a stream is returned never throw: when a request ends with an error (including aborts and tool call validation errors), the streaming API emits an error event and the final message carries the details. Setup failures may emit `error` without `start`; failures after generation begins emit `start`, any observed updates, then `error`. Direct API `streamSimple()` calls throw synchronously when request auth is missing:
@@ -1379,6 +1441,8 @@ Built-in API implementations live under `./api/<api-id>`:
1379
1441
 
1380
1442
  Importing an implementation module loads its SDK. The `./api/<id>.lazy` wrappers (used by the provider factories) defer that load to the first request when the runtime or bundler supports dynamic import chunking. Legacy raw API subpaths from older releases (`./anthropic`, `./google`, `./mistral`, `./openai-completions`, ...) were removed; use `@earendil-works/pi-ai/api/<api-id>`.
1381
1443
 
1444
+ **Anthropic message threads:** with `sessionId` set and `cacheRetention` not `"none"`, Anthropic requests continue from the previous reply on the server (`message-threads-2026-08-12` beta) and send only the new messages. When anything earlier in the request changed, or the server can't continue, the full request is sent. Token counts and prompt caching are unchanged. On by default only for the `anthropic` provider on `api.anthropic.com`; set `compat.supportsMessageThreads` to change that, for example for gateways that forward the `thread` field. Set `disableContinuation: true` on requests that repeat an earlier one, such as cache warming. Call `cleanupSessionResources(sessionId)` when a session ends.
1445
+
1382
1446
  ### OpenAI Compatibility Settings
1383
1447
 
1384
1448
  The `openai-completions` API is implemented by many providers with minor differences. By default, the library auto-detects compatibility settings based on `baseUrl` for a small set of known OpenAI-compatible providers (Cerebras, xAI, Chutes, DeepSeek, NVIDIA NIM, Together AI, zAi, OpenCode, Cloudflare Workers AI, etc.). For custom proxies or unknown endpoints, you can override these settings via the `compat` field. For `openai-responses` models, the compat field supports Responses-specific flags.
@@ -1398,6 +1462,7 @@ interface OpenAICompletionsCompat {
1398
1462
  maxTokensField?: 'max_completion_tokens' | 'max_tokens'; // Which field name to use (default: max_completion_tokens)
1399
1463
  requiresToolResultName?: boolean; // Whether tool results require the `name` field (default: false)
1400
1464
  requiresAssistantAfterToolResult?: boolean; // Whether tool results must be followed by an assistant message (default: false)
1465
+ requiresNonNullAssistantContent?: boolean; // Whether replayed assistant messages with no text must send "" instead of null content (default: false)
1401
1466
  requiresThinkingAsText?: boolean; // Whether thinking blocks must be converted to text (default: false)
1402
1467
  requiresReasoningContentOnAssistantMessages?: boolean; // Whether all replayed assistant messages must include empty reasoning_content when reasoning is enabled (default: auto-detected for DeepSeek)
1403
1468
  thinkingFormat?: 'openai' | 'openrouter' | 'deepseek' | 'together' | 'baseten' | 'zai' | 'qwen' | 'chat-template' | 'qwen-chat-template' | 'string-thinking' | 'ant-ling'; // Format for reasoning param: 'openai' uses reasoning_effort, 'openrouter' uses reasoning: { effort }, 'deepseek' uses thinking: { type } plus reasoning_effort when supported, 'together' uses reasoning: { enabled } plus reasoning_effort when supported, 'baseten' uses configurable chat_template_args plus reasoning_effort when supported, 'zai' uses thinking: { type }, 'qwen' uses enable_thinking, 'chat-template' uses configurable chat_template_kwargs, 'qwen-chat-template' uses chat_template_kwargs.enable_thinking and preserve_thinking, 'string-thinking' uses top-level thinking, 'ant-ling' uses reasoning: { effort } only for mapped efforts (default: openai)
@@ -1516,13 +1581,13 @@ Notes:
1516
1581
 
1517
1582
  ## Cross-Provider Handoffs
1518
1583
 
1519
- The library supports seamless handoffs between different LLM providers within the same conversation. This allows you to switch models mid-conversation while preserving context, including thinking blocks, tool calls, and tool results.
1584
+ The library supports seamless handoffs between different LLM providers within the same conversation. This allows you to switch models mid-conversation while preserving context, including text, tool calls, and tool results.
1520
1585
 
1521
1586
  When messages from one provider are sent to a different provider, the library automatically transforms them for compatibility:
1522
1587
 
1523
1588
  - **User and tool result messages** are passed through unchanged
1524
- - **Assistant messages from the same provider/API** are preserved as-is
1525
- - **Assistant messages from different providers** have their thinking blocks converted to text with `<thinking>` tags
1589
+ - **Assistant messages from the same provider, API, and model** are preserved as-is, including thinking blocks
1590
+ - **Assistant messages from a different model** have their thinking blocks dropped. Signatures and encrypted reasoning only work with the model that produced them, and readable thinking sent as plain text makes the new model treat it as part of the reply
1526
1591
  - **Tool calls and regular text** are preserved unchanged
1527
1592
 
1528
1593
  ```typescript
@@ -1543,7 +1608,7 @@ const claude = models.getModel('anthropic', 'claude-sonnet-4-5')!;
1543
1608
  context.messages.push({ role: 'user', content: 'What is 25 * 18?', timestamp: Date.now() });
1544
1609
  context.messages.push(await models.completeSimple(claude, context, { reasoning: 'medium' }));
1545
1610
 
1546
- // Switch to GPT-5 - it will see Claude's thinking as <thinking> tagged text
1611
+ // Switch to GPT-5 - it sees Claude's answer, but not Claude's thinking
1547
1612
  const gpt5 = models.getModel('openai', 'gpt-5-mini')!;
1548
1613
  context.messages.push({ role: 'user', content: 'Is that calculation correct?', timestamp: Date.now() });
1549
1614
  context.messages.push(await models.complete(gpt5, context));
@@ -1554,7 +1619,7 @@ context.messages.push({ role: 'user', content: 'What was the original question?'
1554
1619
  const geminiResponse = await models.complete(gemini, context);
1555
1620
  ```
1556
1621
 
1557
- All providers can handle messages from other providers — text, tool calls and results (including images), thinking blocks (transformed to tagged text), and aborted messages with partial content. This enables flexible workflows: start with a fast model, switch to a more capable one for complex reasoning, or maintain continuity across provider outages.
1622
+ All providers can handle messages from other providers — text, tool calls and results (including images), thinking blocks (dropped when the model changes), and aborted messages with partial content. This enables flexible workflows: start with a fast model, switch to a more capable one for complex reasoning, or maintain continuity across provider outages.
1558
1623
 
1559
1624
  ## System Messages
1560
1625
 
@@ -1587,7 +1652,7 @@ getCurrentTools(messages); // []
1587
1652
 
1588
1653
  A custom `Provider` or `ProviderStreams` implementation reads the prompt and tools the same way from `context.messages`; `context.systemPrompt` and `context.tools` do not exist at that layer.
1589
1654
 
1590
- Models that accept system messages mid-conversation (`supportsMidConvoSystemMessages` in the model's compat settings, set by the generated catalog for verified models) receive each later system message in place, so the cached prefix stays intact; section changes are framed by name for the model. Every other model receives `collapseSystemMessages(transcript)`: the replayed prompt and current tools as the leading system message, with later system messages dropped. Anthropic models that also set `supportsMidConvoToolChanges` send tool changes as native blocks (`inline-tools-2026-09-15` beta): the top-level tool list holds the initial tools plus a stable deferred placeholder and never changes, later tools are defined by value in `tool_addition` blocks (a new definition under an existing name replaces the old one), and removals are `tool_removal` references, so tool changes do not invalidate the prompt cache. That needs at least one initial tool; otherwise the current tool list is sent at the top level with the system text only. OpenAI Responses models with `supportsAdditionalTools` or `supportsToolSearch` anchor additive tool changes at their message; everything else sends the current tool list at the top level.
1655
+ Models that accept system messages mid-conversation (`supportsMidConvoSystemMessages` in the model's compat settings, set by the generated catalog for verified models) receive each later system message in place, so the cached prefix stays intact; section changes are framed by name for the model. Every other model receives `collapseSystemMessages(transcript)`: the replayed prompt and current tools as the leading system message, with later system messages dropped. Anthropic models that also set `supportsMidConvoToolChanges` send tool changes as native blocks (`inline-tools-2026-09-15` beta): the top-level tool list holds the initial tools plus a stable deferred placeholder and never changes, later tools are defined by value in `tool_addition` blocks (a new definition under an existing name replaces the old one), and removals are `tool_removal` references, so tool changes do not invalidate the prompt cache. That needs at least one initial tool; otherwise the current tool list is sent at the top level with the system text only. OpenAI Responses models with `supportsAdditionalTools` declare every tool in `additional_tools` items, like Codex: the initial tools in one at the head of the input and later additions and redefinitions at their message, with no top-level tool list. A later item replaces same-name definitions from earlier items but cannot replace a top-level tool or remove any tool, so removals are announced as text, later updates restate the tools that are still unavailable, and calls to removed tools fail at execution. OpenAI Responses models with only `supportsToolSearch`, and Kimi models with `supportsMidConvoToolAdditions`, anchor new tools at their message; a removal or a redeclared name moves the tool state up to that point into the top-level list once. Everything else sends the current tool list at the top level.
1591
1656
 
1592
1657
  ## Context Serialization
1593
1658
 
@@ -1665,8 +1730,8 @@ models.setProvider(openaiProvider());
1665
1730
 
1666
1731
  Rules:
1667
1732
 
1668
- - `@earendil-works/pi-ai/models` exports the model runtime (`createModels`, `createProvider`, model helpers, and their types) without TypeBox, built-in catalogs, or SDK implementations. Other types can still use `import type` from the root.
1669
- - `@earendil-works/pi-ai` is the core entrypoint and does not import built-in catalogs, real provider factories, or SDK implementations, but it eagerly imports TypeBox and schema validation. Unbundled Node scripts do not tree-shake its unused exports; prefer `./models`, `./providers/faux`, and specific `./utils/*` subpaths when those are all you need.
1733
+ - `@earendil-works/pi-ai/models` exports the model runtime (`createModels`, `createProvider`, model helpers, and their types) without schema validation, built-in catalogs, or SDK implementations. Other types can still use `import type` from the root.
1734
+ - `@earendil-works/pi-ai` is the core entrypoint and does not import built-in catalogs, real provider factories, or SDK implementations, but it eagerly imports schema validation (pi-schema). Unbundled Node scripts do not tree-shake its unused exports; prefer `./models`, `./providers/faux`, and specific `./utils/*` subpaths when those are all you need.
1670
1735
  - `@earendil-works/pi-ai/providers/<provider>` imports that provider's catalog and lazy API wrapper only.
1671
1736
  - `@earendil-works/pi-ai/providers/all` imports every built-in provider factory and all catalogs. Use it only when you want the full built-in set.
1672
1737
  - With code splitting, provider SDKs stay in lazy chunks and load on first request.
@@ -1706,6 +1771,18 @@ setBedrockProviderModule(bedrockProviderModule);
1706
1771
 
1707
1772
  That explicit override bundles the AWS SDK. Without it, Bedrock's opaque runtime import expects the package's Bedrock implementation file to be available at runtime.
1708
1773
 
1774
+ Node bundles that split at dynamic imports (esbuild `splitting: true`) can keep Bedrock and the OAuth login flows inside the bundle but lazy: register loaders with literal dynamic imports, which the bundler turns into chunks that load on first use:
1775
+
1776
+ ```typescript
1777
+ import { registerLazyBedrockProvider } from '@earendil-works/pi-ai/lazy-bedrock-provider';
1778
+ import { registerLazyOAuthFlows } from '@earendil-works/pi-ai/lazy-oauth';
1779
+
1780
+ registerLazyBedrockProvider();
1781
+ registerLazyOAuthFlows();
1782
+ ```
1783
+
1784
+ Both modules are Node-only; never import them into a browser bundle.
1785
+
1709
1786
  ### Provider-Scoped Environment Overrides
1710
1787
 
1711
1788
  Pass `env` in stream options to scope provider configuration to a request. Values in `env` are used before process environment variables for provider auth and configuration such as Cloudflare account IDs, Azure OpenAI settings, Vertex project/location, Bedrock settings, `PI_CACHE_RETENTION`, and `HTTP_PROXY`/`HTTPS_PROXY`.
@@ -1731,7 +1808,7 @@ Several providers support OAuth authentication instead of static API keys:
1731
1808
 
1732
1809
  - **Anthropic** (Claude Pro/Max subscription)
1733
1810
  - **OpenAI** (Sign in with ChatGPT: uses the ChatGPT subscription with the OpenAI API)
1734
- - **OpenAI Codex (legacy)** (ChatGPT Plus/Pro subscription, access to GPT-5.x Codex models)
1811
+ - **OpenAI Codex** (ChatGPT Plus/Pro subscription, access to GPT-5.x Codex models)
1735
1812
  - **GitHub Copilot** (Copilot subscription)
1736
1813
  - **OpenRouter** (OAuth PKCE that mints a user-controlled API key)
1737
1814
 
@@ -1811,7 +1888,7 @@ Built-in login and refresh flows are private provider implementations. Use provi
1811
1888
 
1812
1889
  Provider notes:
1813
1890
 
1814
- **OpenAI Codex (legacy)**: Superseded by Sign in with ChatGPT on the OpenAI provider. Requires a ChatGPT Plus or Pro subscription. Provides access to GPT-5.x Codex models with extended context windows and reasoning capabilities. The library automatically handles session-based prompt caching when `sessionId` is provided in stream options unless `cacheRetention` is `"none"`. You can set `transport` in stream options to `"sse"`, `"websocket"`, or `"auto"` for Codex Responses transport selection. When using WebSocket with a `sessionId` and cache retention enabled, connections are reused per session and expire after 5 minutes of inactivity. Call `cleanupSessionResources(sessionId)` when finished so the pooled connection does not keep the process alive.
1891
+ **OpenAI Codex**: Superseded by Sign in with ChatGPT on the OpenAI provider. Requires a ChatGPT Plus or Pro subscription. Provides access to GPT-5.x Codex models with extended context windows and reasoning capabilities. The library automatically handles session-based prompt caching when `sessionId` is provided in stream options unless `cacheRetention` is `"none"`. You can set `transport` in stream options to `"sse"`, `"websocket"`, or `"auto"` for Codex Responses transport selection. When using WebSocket with a `sessionId` and cache retention enabled, connections are reused per session and expire after 5 minutes of inactivity. Call `cleanupSessionResources(sessionId)` when finished so the pooled connection does not keep the process alive.
1815
1892
 
1816
1893
  **Azure OpenAI (Responses)**: Uses the Responses API only. Set `AZURE_OPENAI_API_KEY` and either `AZURE_OPENAI_BASE_URL` or `AZURE_OPENAI_RESOURCE_NAME`. `AZURE_OPENAI_BASE_URL` supports both `https://<resource>.openai.azure.com` and `https://<resource>.cognitiveservices.azure.com`; root endpoints are normalized to `.../openai/v1` automatically. Use `AZURE_OPENAI_API_VERSION` (defaults to `v1`) to override the API version if needed. Deployment names are treated as model IDs by default, override with `azureDeploymentName` or `AZURE_OPENAI_DEPLOYMENT_NAME_MAP` using comma-separated `model-id=deployment` pairs (for example `gpt-4o-mini=my-deployment,gpt-4o=prod`). Legacy deployment-based URLs are intentionally unsupported.
1817
1894
 
@@ -1867,19 +1944,19 @@ Create a new API implementation file (for example `bedrock-converse-stream.ts`)
1867
1944
 
1868
1945
  Add a lazy wrapper `src/api/<api-id>.lazy.ts` (`<name>Api()` via `lazyApi()`) so providers can reference the implementation without importing its SDK. Add any root-level `export type` re-exports in `src/index.ts` that should remain available from `@earendil-works/pi-ai`.
1869
1946
 
1870
- #### 3. Model Generation (`scripts/generate-models.ts`)
1947
+ #### 3. Model Catalog (`catalog/providers/<id>.ts`)
1871
1948
 
1872
- - Add logic to fetch and parse models from the provider's source (e.g., models.dev API)
1949
+ - Add a provider definition and register it in `catalog/providers/index.ts`; see `catalog/README.md` for the build order and helpers
1873
1950
  - Map chat/tool-capable provider data to `Model`, image-generation data to `ImageModel`, and models.dev `type: "decision"` entries to `ClassifierModel`; hydration groups the ignored `src/providers/data/<id>.json` values by API while stable `src/providers/<id>.models.ts` wrappers derive exact model/API types directly from those JSON keys
1874
1951
  - Keep model ids unique within each provider and model type; emit separate entries when an upstream model supports multiple operations
1875
- - Handle provider-specific quirks (pricing format, capability flags, model ID transformations)
1952
+ - Handle provider-specific quirks (pricing format, capability flags, model ID transformations) in the provider definition
1876
1953
 
1877
1954
  #### 4. Provider Factory (`src/providers/<id>.ts`)
1878
1955
 
1879
1956
  - `createProvider()` wiring catalog + auth + the lazy API wrapper
1880
1957
  - Auth: `envApiKeyAuth` for standard key providers, a custom `ApiKeyAuth` for ambient auth (AWS profiles, ADC), `lazyOAuth` where an OAuth flow exists
1881
1958
  - Register the factory in `src/providers/all.ts`
1882
- - If it is a new API: register it in the builtin list in `src/compat.ts` and add the package subpath export in `package.json`
1959
+ - If it is a new API: register it in the builtin list in `src/compat.ts`; the `./api/*` subpath export in `package.json` already covers the new module
1883
1960
 
1884
1961
  #### 5. Tests (`test/`)
1885
1962
 
@@ -1890,7 +1967,6 @@ Create or update test files to cover the new provider:
1890
1967
  - `abort.test.ts` - Request cancellation
1891
1968
  - `empty.test.ts` - Empty message handling
1892
1969
  - `context-overflow.test.ts` - Context limit errors
1893
- - `image-limits.test.ts` - Image support (if applicable)
1894
1970
  - `unicode-surrogate.test.ts` - Unicode handling
1895
1971
  - `tool-call-without-result.test.ts` - Orphaned tool calls
1896
1972
  - `image-tool-result.test.ts` - Images in tool results
@@ -1906,15 +1982,15 @@ For providers with non-standard auth (AWS, Google Vertex), create a utility like
1906
1982
 
1907
1983
  Update `src/core/model-resolver.ts`:
1908
1984
 
1909
- - Add a default model ID for the provider in `DEFAULT_MODELS`
1985
+ - Add a default model ID for the provider in `defaultModelPerProvider`
1910
1986
 
1911
1987
  Update `src/cli/args.ts`:
1912
1988
 
1913
1989
  - Add environment variable documentation in the help text
1914
1990
 
1915
- Update `README.md`:
1991
+ Update `docs/providers.md`:
1916
1992
 
1917
- - Add the provider to the providers section with setup instructions
1993
+ - Add setup instructions, the environment variable, and the `auth.json` key
1918
1994
 
1919
1995
  #### 7. Documentation
1920
1996
 
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-messages.d.ts","sourceRoot":"","sources":["../../src/api/anthropic-messages.ts"],"names":[],"mappings":"AAAA,OAAO,SAAiC,MAAM,mBAAmB,CAAC;AAoBlE,OAAO,KAAK,EASX,mBAAmB,EAEnB,cAAc,EACd,aAAa,EAMb,MAAM,aAAa,CAAC;AAmJrB,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1E,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,SAAS,CAAC;AA2ChE,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACtD;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,EAAE,wBAAwB,CAAC;IAC3C;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB;AAwRD,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,oBAAoB,EAAE,gBAAgB,CA0UzE,CAAC;AA2BF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,oBAAoB,EAAE,mBAAmB,CAgDlF,CAAC"}
1
+ {"version":3,"file":"anthropic-messages.d.ts","sourceRoot":"","sources":["../../src/api/anthropic-messages.ts"],"names":[],"mappings":"AAAA,OAAO,SAAiC,MAAM,mBAAmB,CAAC;AAqBlE,OAAO,KAAK,EASX,mBAAmB,EAEnB,cAAc,EACd,aAAa,EAIb,MAAM,aAAa,CAAC;AAiKrB,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1E,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,SAAS,CAAC;AA6QhE,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACtD;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,EAAE,wBAAwB,CAAC;IAC3C;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB;AAoRD,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,oBAAoB,EAAE,gBAAgB,CAgXzE,CAAC;AA2BF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,oBAAoB,EAAE,mBAAmB,CAgDlF,CAAC"}