@paid-ai/paid-node 0.5.0-alpha2 → 0.5.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 (269) hide show
  1. package/README.md +118 -36
  2. package/dist/cjs/Client.d.ts +35 -3
  3. package/dist/cjs/Client.js +57 -19
  4. package/dist/cjs/api/errors/InternalServerError.d.ts +9 -0
  5. package/dist/cjs/api/errors/InternalServerError.js +52 -0
  6. package/dist/cjs/api/errors/index.d.ts +1 -0
  7. package/dist/cjs/api/errors/index.js +1 -0
  8. package/dist/cjs/api/index.d.ts +1 -1
  9. package/dist/cjs/api/index.js +1 -1
  10. package/dist/cjs/api/resources/agents/client/Client.d.ts +16 -0
  11. package/dist/cjs/api/resources/agents/client/Client.js +16 -0
  12. package/dist/cjs/api/resources/customers/client/Client.d.ts +38 -0
  13. package/dist/cjs/api/resources/customers/client/Client.js +164 -0
  14. package/dist/cjs/api/resources/customers/client/requests/CustomerCreate.d.ts +2 -0
  15. package/dist/cjs/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.d.ts +30 -0
  16. package/dist/cjs/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.d.ts +30 -0
  17. package/dist/cjs/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.js +5 -0
  18. package/dist/cjs/api/resources/customers/client/requests/index.d.ts +2 -0
  19. package/dist/cjs/api/resources/index.d.ts +8 -1
  20. package/dist/cjs/api/resources/index.js +9 -2
  21. package/dist/cjs/api/resources/orders/client/requests/OrderCreate.d.ts +2 -0
  22. package/dist/cjs/api/resources/orders/resources/lines/client/Client.d.ts +0 -2
  23. package/dist/cjs/api/resources/orders/resources/lines/client/Client.js +0 -2
  24. package/dist/cjs/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.ts +0 -2
  25. package/dist/cjs/api/resources/plans/client/Client.d.ts +75 -0
  26. package/dist/cjs/api/resources/plans/client/Client.js +272 -0
  27. package/dist/cjs/api/resources/plans/client/index.d.ts +1 -0
  28. package/dist/cjs/api/resources/plans/client/index.js +17 -0
  29. package/dist/cjs/api/resources/plans/client/requests/PlansGetUsageRequest.d.ts +35 -0
  30. package/dist/cjs/api/resources/plans/client/requests/PlansGetUsageRequest.js +5 -0
  31. package/dist/cjs/api/resources/plans/client/requests/index.d.ts +1 -0
  32. package/dist/cjs/api/resources/plans/client/requests/index.js +2 -0
  33. package/dist/cjs/api/resources/plans/index.d.ts +1 -0
  34. package/dist/cjs/api/resources/plans/index.js +17 -0
  35. package/dist/cjs/api/resources/products/client/Client.d.ts +109 -0
  36. package/dist/cjs/api/resources/products/client/Client.js +470 -0
  37. package/dist/cjs/api/resources/products/client/index.d.ts +1 -0
  38. package/dist/cjs/api/resources/products/client/index.js +17 -0
  39. package/dist/cjs/api/resources/products/client/requests/ProductCreate.d.ts +29 -0
  40. package/dist/cjs/api/resources/products/client/requests/ProductCreate.js +14 -0
  41. package/dist/cjs/api/resources/products/client/requests/index.d.ts +1 -0
  42. package/dist/cjs/api/resources/products/client/requests/index.js +2 -0
  43. package/dist/cjs/api/resources/products/index.d.ts +1 -0
  44. package/dist/cjs/api/resources/products/index.js +17 -0
  45. package/dist/cjs/api/resources/traces/client/Client.d.ts +52 -0
  46. package/dist/cjs/api/resources/traces/client/Client.js +166 -0
  47. package/dist/cjs/api/resources/traces/client/index.d.ts +1 -0
  48. package/dist/cjs/api/resources/traces/client/index.js +17 -0
  49. package/dist/cjs/api/resources/traces/client/requests/GetTracesRequest.d.ts +50 -0
  50. package/dist/cjs/api/resources/traces/client/requests/GetTracesRequest.js +5 -0
  51. package/dist/cjs/api/resources/traces/client/requests/index.d.ts +1 -0
  52. package/dist/cjs/api/resources/traces/client/requests/index.js +2 -0
  53. package/dist/cjs/api/resources/traces/index.d.ts +1 -0
  54. package/dist/cjs/api/resources/traces/index.js +17 -0
  55. package/dist/cjs/api/resources/usage/client/Client.d.ts +47 -0
  56. package/dist/cjs/api/resources/usage/client/Client.js +146 -0
  57. package/dist/cjs/api/resources/usage/client/requests/UsageCheckUsageRequest.d.ts +28 -0
  58. package/dist/cjs/api/resources/usage/client/requests/UsageCheckUsageRequest.js +5 -0
  59. package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.ts +29 -0
  60. package/dist/cjs/api/resources/usage/client/requests/UsageRecordBulkV2Request.js +5 -0
  61. package/dist/cjs/api/resources/usage/client/requests/index.d.ts +2 -0
  62. package/dist/cjs/api/resources/usage/index.d.ts +1 -0
  63. package/dist/cjs/api/resources/usage/index.js +1 -0
  64. package/dist/cjs/api/resources/usage/types/UsageCheckUsageResponse.d.ts +17 -0
  65. package/dist/cjs/api/resources/usage/types/UsageCheckUsageResponse.js +5 -0
  66. package/dist/cjs/api/resources/usage/types/index.d.ts +1 -0
  67. package/dist/cjs/api/resources/usage/types/index.js +17 -0
  68. package/dist/cjs/api/types/CostAmount.d.ts +12 -0
  69. package/dist/cjs/api/types/CostAmount.js +5 -0
  70. package/dist/cjs/api/types/CostTrace.d.ts +22 -0
  71. package/dist/cjs/api/types/CostTrace.js +5 -0
  72. package/dist/cjs/api/types/CostTracesResponse.d.ts +11 -0
  73. package/dist/cjs/api/types/CostTracesResponse.js +5 -0
  74. package/dist/cjs/api/types/Customer.d.ts +2 -0
  75. package/dist/cjs/api/types/CustomerUpdate.d.ts +2 -0
  76. package/dist/cjs/api/types/OrderLineAttributeCreateOne.d.ts +4 -0
  77. package/dist/cjs/api/types/OrderLineAttributeCreateOne.js +5 -0
  78. package/dist/cjs/api/types/OrderLineCreate.d.ts +10 -4
  79. package/dist/cjs/api/types/PaginationMeta.d.ts +28 -0
  80. package/dist/cjs/api/types/PaginationMeta.js +5 -0
  81. package/dist/cjs/api/types/Plan.d.ts +58 -0
  82. package/dist/cjs/api/types/Plan.js +5 -0
  83. package/dist/cjs/api/types/PlanGroup.d.ts +23 -0
  84. package/dist/cjs/api/types/PlanGroup.js +5 -0
  85. package/dist/cjs/api/types/Product.d.ts +36 -0
  86. package/dist/cjs/api/types/Product.js +14 -0
  87. package/dist/cjs/api/types/ProductUpdate.d.ts +23 -0
  88. package/dist/cjs/api/types/ProductUpdate.js +14 -0
  89. package/dist/cjs/api/types/Signal.d.ts +7 -2
  90. package/dist/cjs/api/types/SignalV2.d.ts +22 -0
  91. package/dist/cjs/api/types/SignalV2.js +5 -0
  92. package/dist/cjs/api/types/Trace.d.ts +26 -0
  93. package/dist/cjs/api/types/Trace.js +5 -0
  94. package/dist/cjs/api/types/TracesResponse.d.ts +11 -0
  95. package/dist/cjs/api/types/TracesResponse.js +5 -0
  96. package/dist/cjs/api/types/UsagePaginationMeta.d.ts +16 -0
  97. package/dist/cjs/api/types/UsagePaginationMeta.js +5 -0
  98. package/dist/cjs/api/types/UsageSummariesResponse.d.ts +11 -0
  99. package/dist/cjs/api/types/UsageSummariesResponse.js +5 -0
  100. package/dist/cjs/api/types/UsageSummary.d.ts +58 -0
  101. package/dist/cjs/api/types/UsageSummary.js +5 -0
  102. package/dist/cjs/api/types/index.d.ts +15 -1
  103. package/dist/cjs/api/types/index.js +15 -1
  104. package/dist/cjs/index.d.ts +1 -0
  105. package/dist/cjs/index.js +4 -0
  106. package/dist/cjs/integrations/adapters/expressjs/base-adapter.d.ts +17 -0
  107. package/dist/cjs/integrations/adapters/expressjs/base-adapter.js +71 -0
  108. package/dist/cjs/integrations/adapters/expressjs/index.d.ts +6 -0
  109. package/dist/cjs/integrations/adapters/expressjs/index.js +20 -0
  110. package/dist/cjs/integrations/adapters/expressjs/routes.d.ts +162 -0
  111. package/dist/cjs/integrations/adapters/expressjs/routes.js +269 -0
  112. package/dist/cjs/integrations/adapters/nestjs/index.d.ts +7 -0
  113. package/dist/cjs/integrations/adapters/nestjs/index.js +23 -0
  114. package/dist/cjs/tracing/autoInstrumentation.d.ts +10 -0
  115. package/dist/cjs/tracing/autoInstrumentation.js +57 -0
  116. package/dist/cjs/tracing/index.d.ts +4 -0
  117. package/dist/cjs/tracing/index.js +12 -0
  118. package/dist/cjs/tracing/signal.d.ts +18 -1
  119. package/dist/cjs/tracing/signal.js +29 -13
  120. package/dist/cjs/tracing/spanProcessor.d.ts +10 -0
  121. package/dist/cjs/tracing/spanProcessor.js +82 -0
  122. package/dist/cjs/tracing/tracing.d.ts +12 -6
  123. package/dist/cjs/tracing/tracing.js +65 -58
  124. package/dist/cjs/tracing/tracingContext.d.ts +8 -0
  125. package/dist/cjs/tracing/tracingContext.js +28 -0
  126. package/dist/cjs/tracing/wrappers/anthropicWrapper.js +11 -7
  127. package/dist/cjs/tracing/wrappers/langchainCallback.js +11 -7
  128. package/dist/cjs/tracing/wrappers/mistralWrapper.js +11 -7
  129. package/dist/cjs/tracing/wrappers/openAiWrapper.js +24 -23
  130. package/dist/cjs/tracing/wrappers/vercelAIWrapper.js +68 -43
  131. package/dist/cjs/version.d.ts +1 -1
  132. package/dist/cjs/version.js +1 -1
  133. package/dist/esm/Client.d.mts +35 -3
  134. package/dist/esm/Client.mjs +54 -16
  135. package/dist/esm/api/errors/InternalServerError.d.mts +9 -0
  136. package/dist/esm/api/errors/InternalServerError.mjs +15 -0
  137. package/dist/esm/api/errors/index.d.mts +1 -0
  138. package/dist/esm/api/errors/index.mjs +1 -0
  139. package/dist/esm/api/index.d.mts +1 -1
  140. package/dist/esm/api/index.mjs +1 -1
  141. package/dist/esm/api/resources/agents/client/Client.d.mts +16 -0
  142. package/dist/esm/api/resources/agents/client/Client.mjs +16 -0
  143. package/dist/esm/api/resources/customers/client/Client.d.mts +38 -0
  144. package/dist/esm/api/resources/customers/client/Client.mjs +164 -0
  145. package/dist/esm/api/resources/customers/client/requests/CustomerCreate.d.mts +2 -0
  146. package/dist/esm/api/resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.d.mts +30 -0
  147. package/dist/esm/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.d.mts +30 -0
  148. package/dist/esm/api/resources/customers/client/requests/CustomersGetUsageByExternalIdRequest.mjs +4 -0
  149. package/dist/esm/api/resources/customers/client/requests/index.d.mts +2 -0
  150. package/dist/esm/api/resources/index.d.mts +8 -1
  151. package/dist/esm/api/resources/index.mjs +8 -1
  152. package/dist/esm/api/resources/orders/client/requests/OrderCreate.d.mts +2 -0
  153. package/dist/esm/api/resources/orders/resources/lines/client/Client.d.mts +0 -2
  154. package/dist/esm/api/resources/orders/resources/lines/client/Client.mjs +0 -2
  155. package/dist/esm/api/resources/orders/resources/lines/client/requests/LinesUpdateRequest.d.mts +0 -2
  156. package/dist/esm/api/resources/plans/client/Client.d.mts +75 -0
  157. package/dist/esm/api/resources/plans/client/Client.mjs +232 -0
  158. package/dist/esm/api/resources/plans/client/index.d.mts +1 -0
  159. package/dist/esm/api/resources/plans/client/index.mjs +1 -0
  160. package/dist/esm/api/resources/plans/client/requests/PlansGetUsageRequest.d.mts +35 -0
  161. package/dist/esm/api/resources/plans/client/requests/PlansGetUsageRequest.mjs +4 -0
  162. package/dist/esm/api/resources/plans/client/requests/index.d.mts +1 -0
  163. package/dist/esm/api/resources/plans/client/requests/index.mjs +1 -0
  164. package/dist/esm/api/resources/plans/index.d.mts +1 -0
  165. package/dist/esm/api/resources/plans/index.mjs +1 -0
  166. package/dist/esm/api/resources/products/client/Client.d.mts +109 -0
  167. package/dist/esm/api/resources/products/client/Client.mjs +430 -0
  168. package/dist/esm/api/resources/products/client/index.d.mts +1 -0
  169. package/dist/esm/api/resources/products/client/index.mjs +1 -0
  170. package/dist/esm/api/resources/products/client/requests/ProductCreate.d.mts +29 -0
  171. package/dist/esm/api/resources/products/client/requests/ProductCreate.mjs +11 -0
  172. package/dist/esm/api/resources/products/client/requests/index.d.mts +1 -0
  173. package/dist/esm/api/resources/products/client/requests/index.mjs +1 -0
  174. package/dist/esm/api/resources/products/index.d.mts +1 -0
  175. package/dist/esm/api/resources/products/index.mjs +1 -0
  176. package/dist/esm/api/resources/traces/client/Client.d.mts +52 -0
  177. package/dist/esm/api/resources/traces/client/Client.mjs +126 -0
  178. package/dist/esm/api/resources/traces/client/index.d.mts +1 -0
  179. package/dist/esm/api/resources/traces/client/index.mjs +1 -0
  180. package/dist/esm/api/resources/traces/client/requests/GetTracesRequest.d.mts +50 -0
  181. package/dist/esm/api/resources/traces/client/requests/GetTracesRequest.mjs +4 -0
  182. package/dist/esm/api/resources/traces/client/requests/index.d.mts +1 -0
  183. package/dist/esm/api/resources/traces/client/requests/index.mjs +1 -0
  184. package/dist/esm/api/resources/traces/index.d.mts +1 -0
  185. package/dist/esm/api/resources/traces/index.mjs +1 -0
  186. package/dist/esm/api/resources/usage/client/Client.d.mts +47 -0
  187. package/dist/esm/api/resources/usage/client/Client.mjs +146 -0
  188. package/dist/esm/api/resources/usage/client/requests/UsageCheckUsageRequest.d.mts +28 -0
  189. package/dist/esm/api/resources/usage/client/requests/UsageCheckUsageRequest.mjs +4 -0
  190. package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkV2Request.d.mts +29 -0
  191. package/dist/esm/api/resources/usage/client/requests/UsageRecordBulkV2Request.mjs +4 -0
  192. package/dist/esm/api/resources/usage/client/requests/index.d.mts +2 -0
  193. package/dist/esm/api/resources/usage/index.d.mts +1 -0
  194. package/dist/esm/api/resources/usage/index.mjs +1 -0
  195. package/dist/esm/api/resources/usage/types/UsageCheckUsageResponse.d.mts +17 -0
  196. package/dist/esm/api/resources/usage/types/UsageCheckUsageResponse.mjs +4 -0
  197. package/dist/esm/api/resources/usage/types/index.d.mts +1 -0
  198. package/dist/esm/api/resources/usage/types/index.mjs +1 -0
  199. package/dist/esm/api/types/CostAmount.d.mts +12 -0
  200. package/dist/esm/api/types/CostAmount.mjs +4 -0
  201. package/dist/esm/api/types/CostTrace.d.mts +22 -0
  202. package/dist/esm/api/types/CostTrace.mjs +4 -0
  203. package/dist/esm/api/types/CostTracesResponse.d.mts +11 -0
  204. package/dist/esm/api/types/CostTracesResponse.mjs +4 -0
  205. package/dist/esm/api/types/Customer.d.mts +2 -0
  206. package/dist/esm/api/types/CustomerUpdate.d.mts +2 -0
  207. package/dist/esm/api/types/OrderLineAttributeCreateOne.d.mts +4 -0
  208. package/dist/esm/api/types/OrderLineAttributeCreateOne.mjs +4 -0
  209. package/dist/esm/api/types/OrderLineCreate.d.mts +10 -4
  210. package/dist/esm/api/types/PaginationMeta.d.mts +28 -0
  211. package/dist/esm/api/types/PaginationMeta.mjs +4 -0
  212. package/dist/esm/api/types/Plan.d.mts +58 -0
  213. package/dist/esm/api/types/Plan.mjs +4 -0
  214. package/dist/esm/api/types/PlanGroup.d.mts +23 -0
  215. package/dist/esm/api/types/PlanGroup.mjs +4 -0
  216. package/dist/esm/api/types/Product.d.mts +36 -0
  217. package/dist/esm/api/types/Product.mjs +11 -0
  218. package/dist/esm/api/types/ProductUpdate.d.mts +23 -0
  219. package/dist/esm/api/types/ProductUpdate.mjs +11 -0
  220. package/dist/esm/api/types/Signal.d.mts +7 -2
  221. package/dist/esm/api/types/SignalV2.d.mts +22 -0
  222. package/dist/esm/api/types/SignalV2.mjs +4 -0
  223. package/dist/esm/api/types/Trace.d.mts +26 -0
  224. package/dist/esm/api/types/Trace.mjs +4 -0
  225. package/dist/esm/api/types/TracesResponse.d.mts +11 -0
  226. package/dist/esm/api/types/TracesResponse.mjs +4 -0
  227. package/dist/esm/api/types/UsagePaginationMeta.d.mts +16 -0
  228. package/dist/esm/api/types/UsagePaginationMeta.mjs +4 -0
  229. package/dist/esm/api/types/UsageSummariesResponse.d.mts +11 -0
  230. package/dist/esm/api/types/UsageSummariesResponse.mjs +4 -0
  231. package/dist/esm/api/types/UsageSummary.d.mts +58 -0
  232. package/dist/esm/api/types/UsageSummary.mjs +4 -0
  233. package/dist/esm/api/types/index.d.mts +15 -1
  234. package/dist/esm/api/types/index.mjs +15 -1
  235. package/dist/esm/index.d.mts +1 -0
  236. package/dist/esm/index.mjs +1 -0
  237. package/dist/esm/integrations/adapters/expressjs/base-adapter.d.mts +17 -0
  238. package/dist/esm/integrations/adapters/expressjs/base-adapter.mjs +67 -0
  239. package/dist/esm/integrations/adapters/expressjs/index.d.mts +6 -0
  240. package/dist/esm/integrations/adapters/expressjs/index.mjs +6 -0
  241. package/dist/esm/integrations/adapters/expressjs/routes.d.mts +162 -0
  242. package/dist/esm/integrations/adapters/expressjs/routes.mjs +258 -0
  243. package/dist/esm/integrations/adapters/nestjs/index.d.mts +7 -0
  244. package/dist/esm/integrations/adapters/nestjs/index.mjs +7 -0
  245. package/dist/esm/tracing/autoInstrumentation.d.mts +10 -0
  246. package/dist/esm/tracing/autoInstrumentation.mjs +54 -0
  247. package/dist/esm/tracing/index.d.mts +4 -0
  248. package/dist/esm/tracing/index.mjs +4 -0
  249. package/dist/esm/tracing/signal.d.mts +18 -1
  250. package/dist/esm/tracing/signal.mjs +28 -12
  251. package/dist/esm/tracing/spanProcessor.d.mts +10 -0
  252. package/dist/esm/tracing/spanProcessor.mjs +78 -0
  253. package/dist/esm/tracing/tracing.d.mts +12 -6
  254. package/dist/esm/tracing/tracing.mjs +59 -52
  255. package/dist/esm/tracing/tracingContext.d.mts +8 -0
  256. package/dist/esm/tracing/tracingContext.mjs +23 -0
  257. package/dist/esm/tracing/wrappers/anthropicWrapper.mjs +11 -7
  258. package/dist/esm/tracing/wrappers/langchainCallback.mjs +11 -7
  259. package/dist/esm/tracing/wrappers/mistralWrapper.mjs +11 -7
  260. package/dist/esm/tracing/wrappers/openAiWrapper.mjs +24 -23
  261. package/dist/esm/tracing/wrappers/vercelAIWrapper.mjs +68 -43
  262. package/dist/esm/version.d.mts +1 -1
  263. package/dist/esm/version.mjs +1 -1
  264. package/package.json +41 -4
  265. package/reference.md +1147 -153
  266. package/dist/cjs/api/types/OrderLineAttributeCreate.d.ts +0 -12
  267. package/dist/esm/api/types/OrderLineAttributeCreate.d.mts +0 -12
  268. /package/dist/cjs/api/{types/OrderLineAttributeCreate.js → resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.js} +0 -0
  269. /package/dist/esm/api/{types/OrderLineAttributeCreate.mjs → resources/customers/client/requests/CustomersGetCostsByExternalIdRequest.mjs} +0 -0
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Paid from "../index.js";
5
+ /**
6
+ * A single cost trace record
7
+ */
8
+ export interface CostTrace {
9
+ /** The name/type of the operation (e.g., "trace.openai.agents.on_agent") */
10
+ name: string;
11
+ /** The vendor/provider (e.g., "openai", "anthropic", "mistral") */
12
+ vendor: string;
13
+ /** The model used for the operation (e.g., "gpt-4o-mini", "claude-3-sonnet") */
14
+ model?: string;
15
+ cost: Paid.CostAmount;
16
+ /** Unix timestamp in nanoseconds when the operation started */
17
+ startTimeUnixNano: string;
18
+ /** Unix timestamp in nanoseconds when the operation completed */
19
+ endTimeUnixNano: string;
20
+ /** Additional metadata about the trace (e.g., tokens, etc.) */
21
+ attributes: Record<string, unknown>;
22
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Paid from "../index.js";
5
+ /**
6
+ * Response containing cost traces and pagination metadata
7
+ */
8
+ export interface CostTracesResponse {
9
+ traces: Paid.CostTrace[];
10
+ meta: Paid.PaginationMeta;
11
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -15,4 +15,6 @@ export interface Customer {
15
15
  creationState?: Paid.CreationState;
16
16
  website?: string;
17
17
  billingAddress?: Paid.Address;
18
+ /** Flexible JSON field for storing custom metadata about the customer */
19
+ metadata?: Record<string, unknown>;
18
20
  }
@@ -12,4 +12,6 @@ export interface CustomerUpdate {
12
12
  creationSource?: Paid.CreationSource;
13
13
  website?: string;
14
14
  billingAddress?: Paid.Address;
15
+ /** Flexible JSON field for storing custom metadata about the customer */
16
+ metadata?: Record<string, unknown>;
15
17
  }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type OrderLineAttributeCreateOne = unknown;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,14 +3,20 @@
3
3
  */
4
4
  import * as Paid from "../index.js";
5
5
  export interface OrderLineCreate {
6
- /** Paid's internal ID for the agent/product */
6
+ /** Paid's internal ID for the product */
7
+ productId?: string;
8
+ /** The external ID of the product i.e. the id within your system */
9
+ productExternalId?: string;
10
+ /** DEPRECATED: Use productId instead. Paid's internal ID for the agent/product */
7
11
  agentId?: string;
8
- /** The external ID of the agent/product i.e. the id within your system */
12
+ /** DEPRECATED: Use productExternalId instead. The external ID of the agent/product i.e. the id within your system */
9
13
  agentExternalId?: string;
10
14
  /** Name of the order line */
11
15
  name?: string;
12
16
  /** Description of the order line */
13
17
  description?: string;
14
- /** Optional array of custom agent attributes to override default pricing, allowing per customer pricing. If not provided, attributes will be auto-generated from the product definition. */
15
- agentAttributes?: Paid.OrderLineAttributeCreate[];
18
+ /** Optional array of custom product attributes to override default pricing, allowing per customer pricing. If not provided, attributes will be auto-generated from the product definition. */
19
+ ProductAttribute?: (Paid.OrderLineAttributeCreateOne | undefined)[];
20
+ /** DEPRECATED: Use ProductAttribute instead. Optional array of custom agent attributes to override default pricing, allowing per customer pricing. If not provided, attributes will be auto-generated from the product definition. */
21
+ agentAttributes?: (Paid.OrderLineAttributeCreateOne | undefined)[];
16
22
  }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Pagination metadata for cost traces
6
+ */
7
+ export interface PaginationMeta {
8
+ /** The requested limit */
9
+ limit: number;
10
+ /** The requested offset */
11
+ offset: number;
12
+ /** Number of items returned in this response */
13
+ count: number;
14
+ /** Whether there are more results available */
15
+ hasMore: boolean;
16
+ /** The startTime filter that was applied (if any) */
17
+ startTime?: string;
18
+ /** The endTime filter that was applied (if any) */
19
+ endTime?: string;
20
+ /** The externalCustomerId filter that was applied (if any) */
21
+ externalCustomerId?: string;
22
+ /** The externalProductId filter that was applied (if any) */
23
+ externalProductId?: string;
24
+ /** DEPRECATED: Use externalProductId instead. The externalAgentId filter that was applied (if any) */
25
+ externalAgentId?: string;
26
+ /** The metadata filter that was applied (if any) */
27
+ metadata?: string;
28
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,58 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * A plan containing products and their attributes
6
+ */
7
+ export interface Plan {
8
+ /** The unique identifier of the plan */
9
+ id: string;
10
+ /** The organization ID that owns this plan */
11
+ organizationId: string;
12
+ /** The plan group ID this plan belongs to */
13
+ planGroupId: string;
14
+ /** The name of the plan */
15
+ name: string;
16
+ /** The description of the plan */
17
+ description?: string;
18
+ /** The ID of the next plan in the sequence */
19
+ nextPlanId?: string;
20
+ /** The ID of the previous plan in the sequence */
21
+ prevPlanId?: string;
22
+ /** When the plan was created */
23
+ createdAt: string;
24
+ /** When the plan was last updated */
25
+ updatedAt: string;
26
+ /** The products included in this plan */
27
+ planProducts?: Plan.PlanProducts.Item[];
28
+ }
29
+ export declare namespace Plan {
30
+ type PlanProducts = PlanProducts.Item[];
31
+ namespace PlanProducts {
32
+ interface Item {
33
+ id?: string;
34
+ organizationId?: string;
35
+ planId?: string;
36
+ productId?: string;
37
+ createdAt?: string;
38
+ updatedAt?: string;
39
+ /** The product attributes with pricing for this plan */
40
+ planProductAttribute?: Item.PlanProductAttribute.Item[];
41
+ }
42
+ namespace Item {
43
+ type PlanProductAttribute = PlanProductAttribute.Item[];
44
+ namespace PlanProductAttribute {
45
+ interface Item {
46
+ id?: string;
47
+ organizationId?: string;
48
+ planProductId?: string;
49
+ productAttributeId?: string;
50
+ /** The pricing configuration for this attribute */
51
+ pricing?: Record<string, unknown>;
52
+ createdAt?: string;
53
+ updatedAt?: string;
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Paid from "../index.js";
5
+ /**
6
+ * A plan group containing multiple plans
7
+ */
8
+ export interface PlanGroup {
9
+ /** The unique identifier of the plan group */
10
+ id: string;
11
+ /** The organization ID that owns this plan group */
12
+ organizationId: string;
13
+ /** The name of the plan group */
14
+ name: string;
15
+ /** The description of the plan group */
16
+ description?: string;
17
+ /** When the plan group was created */
18
+ createdAt: string;
19
+ /** When the plan group was last updated */
20
+ updatedAt: string;
21
+ /** The plans included in this plan group */
22
+ plans?: Paid.Plan[];
23
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,36 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Paid from "../index.js";
5
+ /**
6
+ * A product in the Paid system (previously called Agent)
7
+ */
8
+ export interface Product {
9
+ id: string;
10
+ externalId?: string;
11
+ /** Human-readable display ID */
12
+ displayId?: string;
13
+ organizationId: string;
14
+ name: string;
15
+ description?: string;
16
+ /** The type of product */
17
+ type: Product.Type;
18
+ active: boolean;
19
+ productCode?: string;
20
+ /** Pricing attributes for this product */
21
+ ProductAttribute?: Paid.AgentAttribute[];
22
+ metadata?: Record<string, unknown>;
23
+ createdAt?: string;
24
+ updatedAt?: string;
25
+ }
26
+ export declare namespace Product {
27
+ /**
28
+ * The type of product
29
+ */
30
+ type Type = "agent" | "product" | "prepaidCreditBundle";
31
+ const Type: {
32
+ readonly Agent: "agent";
33
+ readonly Product: "product";
34
+ readonly PrepaidCreditBundle: "prepaidCreditBundle";
35
+ };
36
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Product = void 0;
7
+ var Product;
8
+ (function (Product) {
9
+ Product.Type = {
10
+ Agent: "agent",
11
+ Product: "product",
12
+ PrepaidCreditBundle: "prepaidCreditBundle",
13
+ };
14
+ })(Product || (exports.Product = Product = {}));
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Paid from "../index.js";
5
+ export interface ProductUpdate {
6
+ name?: string;
7
+ description?: string;
8
+ externalId?: string;
9
+ type?: ProductUpdate.Type;
10
+ active?: boolean;
11
+ productCode?: string;
12
+ /** Pricing attributes for this product */
13
+ ProductAttribute?: Paid.AgentAttribute[];
14
+ metadata?: Record<string, unknown>;
15
+ }
16
+ export declare namespace ProductUpdate {
17
+ type Type = "agent" | "product" | "prepaidCreditBundle";
18
+ const Type: {
19
+ readonly Agent: "agent";
20
+ readonly Product: "product";
21
+ readonly PrepaidCreditBundle: "prepaidCreditBundle";
22
+ };
23
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ProductUpdate = void 0;
7
+ var ProductUpdate;
8
+ (function (ProductUpdate) {
9
+ ProductUpdate.Type = {
10
+ Agent: "agent",
11
+ Product: "product",
12
+ PrepaidCreditBundle: "prepaidCreditBundle",
13
+ };
14
+ })(ProductUpdate || (exports.ProductUpdate = ProductUpdate = {}));
@@ -1,16 +1,21 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ /**
5
+ * DEPRECATED: Use SignalV2 instead for cleaner field names.
6
+ */
4
7
  export interface Signal {
5
8
  event_name?: string;
9
+ /** DEPRECATED: Use product_id in SignalV2 instead. */
6
10
  agent_id?: string;
11
+ /** DEPRECATED: Use external_product_id in SignalV2 instead. */
7
12
  external_agent_id?: string;
8
- /** Deprecated. The external customer id. Use `external_customer_id` or `internal_customer_id` instead. */
13
+ /** DEPRECATED: The external customer id. Use `external_customer_id` or `internal_customer_id` instead. */
9
14
  customer_id?: string;
10
15
  data?: Record<string, unknown>;
11
16
  /** A unique key to ensure idempotent signal processing */
12
17
  idempotency_key?: string;
13
- /** Paid's internal customer ID */
18
+ /** DEPRECATED: Use customer_id in SignalV2 instead. This was Paid's internal customer ID. */
14
19
  internal_customer_id?: string;
15
20
  /** Your system's customer ID */
16
21
  external_customer_id?: string;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * V2 signal schema with clean field names. Use either internal IDs (product_id, customer_id) or external IDs (external_product_id, external_customer_id).
6
+ */
7
+ export interface SignalV2 {
8
+ /** The name of the event being tracked */
9
+ event_name: string;
10
+ /** Paid's internal product ID. Use either this OR external_product_id. */
11
+ product_id?: string;
12
+ /** Your system's product ID. Use either this OR product_id. */
13
+ external_product_id?: string;
14
+ /** Paid's internal customer ID. Use either this OR external_customer_id. */
15
+ customer_id?: string;
16
+ /** Your system's customer ID. Use either this OR customer_id. */
17
+ external_customer_id?: string;
18
+ /** Optional additional data/metadata for the signal */
19
+ data?: Record<string, unknown>;
20
+ /** A unique key to ensure idempotent signal processing */
21
+ idempotency_key?: string;
22
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Paid from "../index.js";
5
+ /**
6
+ * A single cost trace record with customer and product info
7
+ */
8
+ export interface Trace {
9
+ /** The name/type of the operation (e.g., "trace.openai.agents.on_agent") */
10
+ name: string;
11
+ /** The vendor/provider (e.g., "openai", "anthropic", "mistral") */
12
+ vendor: string;
13
+ /** The model used for the operation (e.g., "gpt-4o-mini", "claude-3-sonnet") */
14
+ model: string;
15
+ cost: Paid.CostAmount;
16
+ /** Unix timestamp in nanoseconds when the operation started */
17
+ startTimeUnixNano: string;
18
+ /** Unix timestamp in nanoseconds when the operation completed */
19
+ endTimeUnixNano: string;
20
+ /** Additional metadata about the trace (e.g., tokens, etc.) */
21
+ attributes: Record<string, unknown>;
22
+ /** The internal customer ID associated with this trace */
23
+ customerId?: string;
24
+ /** The product/agent ID associated with this trace (optional) */
25
+ productId?: string;
26
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Paid from "../index.js";
5
+ /**
6
+ * Response containing cost traces and pagination metadata
7
+ */
8
+ export interface TracesResponse {
9
+ traces: Paid.Trace[];
10
+ meta: Paid.PaginationMeta;
11
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Pagination metadata for usage summaries
6
+ */
7
+ export interface UsagePaginationMeta {
8
+ /** The requested limit */
9
+ limit: number;
10
+ /** The requested offset */
11
+ offset: number;
12
+ /** Total number of usage summaries available */
13
+ total: number;
14
+ /** Whether there are more results available */
15
+ hasMore: boolean;
16
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Paid from "../index.js";
5
+ /**
6
+ * Response containing usage summaries and pagination metadata
7
+ */
8
+ export interface UsageSummariesResponse {
9
+ data: Paid.UsageSummary[];
10
+ pagination: Paid.UsagePaginationMeta;
11
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,58 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * A single usage summary record
6
+ */
7
+ export interface UsageSummary {
8
+ /** The unique identifier of the usage summary */
9
+ id: string;
10
+ /** The name of the event being tracked */
11
+ eventName: string;
12
+ /** The quantity of events in this usage period */
13
+ eventsQuantity: number;
14
+ /** The start date of the usage period */
15
+ startDate: string;
16
+ /** The end date of the usage period */
17
+ endDate: string;
18
+ /** The subtotal amount in the smallest currency unit (e.g., cents) */
19
+ subtotal: number;
20
+ /** The next billing date for this usage */
21
+ nextBillingDate: string;
22
+ /** The internal customer ID */
23
+ customerId: string;
24
+ /** The order ID associated with this usage */
25
+ orderId: string;
26
+ /** The order line ID associated with this usage */
27
+ orderLineId: string;
28
+ /** The order line attribute ID associated with this usage */
29
+ orderLineAttributeId: string;
30
+ /** The invoice ID if this usage has been invoiced */
31
+ invoiceId?: string;
32
+ /** The invoice line ID if this usage has been invoiced */
33
+ invoiceLineId?: string;
34
+ /** When the usage summary was created */
35
+ createdAt: string;
36
+ /** When the usage summary was last updated */
37
+ updatedAt: string;
38
+ /** Associated order information */
39
+ order?: UsageSummary.Order;
40
+ /** Associated order line information */
41
+ orderLine?: UsageSummary.OrderLine;
42
+ }
43
+ export declare namespace UsageSummary {
44
+ /**
45
+ * Associated order information
46
+ */
47
+ interface Order {
48
+ id?: string;
49
+ displayId?: string;
50
+ }
51
+ /**
52
+ * Associated order line information
53
+ */
54
+ interface OrderLine {
55
+ id?: string;
56
+ displayId?: string;
57
+ }
58
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -22,8 +22,22 @@ export * from "./OrderLineAttributePricing.js";
22
22
  export * from "./PricePoint.js";
23
23
  export * from "./Tier.js";
24
24
  export * from "./OrderLineCreate.js";
25
- export * from "./OrderLineAttributeCreate.js";
25
+ export * from "./OrderLineAttributeCreateOne.js";
26
26
  export * from "./Signal.js";
27
+ export * from "./SignalV2.js";
28
+ export * from "./Product.js";
29
+ export * from "./ProductUpdate.js";
27
30
  export * from "./Error_.js";
28
31
  export * from "./ApiError.js";
29
32
  export * from "./EntitlementUsage.js";
33
+ export * from "./CostTracesResponse.js";
34
+ export * from "./TracesResponse.js";
35
+ export * from "./CostTrace.js";
36
+ export * from "./Trace.js";
37
+ export * from "./CostAmount.js";
38
+ export * from "./PaginationMeta.js";
39
+ export * from "./UsageSummariesResponse.js";
40
+ export * from "./UsageSummary.js";
41
+ export * from "./UsagePaginationMeta.js";
42
+ export * from "./PlanGroup.js";
43
+ export * from "./Plan.js";
@@ -38,8 +38,22 @@ __exportStar(require("./OrderLineAttributePricing.js"), exports);
38
38
  __exportStar(require("./PricePoint.js"), exports);
39
39
  __exportStar(require("./Tier.js"), exports);
40
40
  __exportStar(require("./OrderLineCreate.js"), exports);
41
- __exportStar(require("./OrderLineAttributeCreate.js"), exports);
41
+ __exportStar(require("./OrderLineAttributeCreateOne.js"), exports);
42
42
  __exportStar(require("./Signal.js"), exports);
43
+ __exportStar(require("./SignalV2.js"), exports);
44
+ __exportStar(require("./Product.js"), exports);
45
+ __exportStar(require("./ProductUpdate.js"), exports);
43
46
  __exportStar(require("./Error_.js"), exports);
44
47
  __exportStar(require("./ApiError.js"), exports);
45
48
  __exportStar(require("./EntitlementUsage.js"), exports);
49
+ __exportStar(require("./CostTracesResponse.js"), exports);
50
+ __exportStar(require("./TracesResponse.js"), exports);
51
+ __exportStar(require("./CostTrace.js"), exports);
52
+ __exportStar(require("./Trace.js"), exports);
53
+ __exportStar(require("./CostAmount.js"), exports);
54
+ __exportStar(require("./PaginationMeta.js"), exports);
55
+ __exportStar(require("./UsageSummariesResponse.js"), exports);
56
+ __exportStar(require("./UsageSummary.js"), exports);
57
+ __exportStar(require("./UsagePaginationMeta.js"), exports);
58
+ __exportStar(require("./PlanGroup.js"), exports);
59
+ __exportStar(require("./Plan.js"), exports);
@@ -3,3 +3,4 @@ export { PaidClient } from "./Client.js";
3
3
  export { PaidEnvironment } from "./environments.js";
4
4
  export { PaidError, PaidTimeoutError } from "./errors/index.js";
5
5
  export * as PaidIntegrations from "./integrations/index.js";
6
+ export * from "./tracing/index.js";
package/dist/cjs/index.js CHANGED
@@ -32,6 +32,9 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  exports.PaidIntegrations = exports.PaidTimeoutError = exports.PaidError = exports.PaidEnvironment = exports.PaidClient = exports.Paid = void 0;
37
40
  exports.Paid = __importStar(require("./api/index.js"));
@@ -43,3 +46,4 @@ var index_js_1 = require("./errors/index.js");
43
46
  Object.defineProperty(exports, "PaidError", { enumerable: true, get: function () { return index_js_1.PaidError; } });
44
47
  Object.defineProperty(exports, "PaidTimeoutError", { enumerable: true, get: function () { return index_js_1.PaidTimeoutError; } });
45
48
  exports.PaidIntegrations = __importStar(require("./integrations/index.js"));
49
+ __exportStar(require("./tracing/index.js"), exports);
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ExpressJS adapter for Paid SDK
3
+ * Converts Express Request/Response to framework-agnostic format
4
+ */
5
+ import { Request, Response } from "express";
6
+ /**
7
+ * Handles Express Request/Response conversion to base handler format
8
+ */
9
+ export declare const expressjsAdapter: (innerHandler: Function) => (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, context?: any, config?: any) => Promise<any>;
10
+ /**
11
+ * Create response context for ExpressJS
12
+ * This converts the base handler response methods to ExpressJS/Express format
13
+ */
14
+ export declare function createExpressJSResponseContext(res: Response): {
15
+ json: (data: any, status?: number) => Response<any, Record<string, any>>;
16
+ error: (message: string, status: number) => Response<any, Record<string, any>>;
17
+ };