paid-python 0.4.1a0__tar.gz → 0.6.0__tar.gz

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 (156) hide show
  1. {paid_python-0.4.1a0 → paid_python-0.6.0}/PKG-INFO +20 -20
  2. {paid_python-0.4.1a0 → paid_python-0.6.0}/README.md +19 -19
  3. {paid_python-0.4.1a0 → paid_python-0.6.0}/pyproject.toml +1 -1
  4. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/__init__.py +44 -4
  5. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/agents/client.py +32 -0
  6. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/agents/raw_client.py +32 -0
  7. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/client.py +25 -2
  8. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/client_wrapper.py +2 -3
  9. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/customers/client.py +168 -36
  10. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/customers/raw_client.py +217 -36
  11. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/errors/__init__.py +2 -1
  12. paid_python-0.6.0/src/paid/errors/internal_server_error.py +11 -0
  13. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/orders/client.py +10 -0
  14. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/orders/lines/client.py +0 -4
  15. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/orders/raw_client.py +10 -0
  16. paid_python-0.6.0/src/paid/plans/client.py +332 -0
  17. paid_python-0.6.0/src/paid/plans/raw_client.py +464 -0
  18. paid_python-0.6.0/src/paid/products/__init__.py +7 -0
  19. paid_python-0.6.0/src/paid/products/client.py +788 -0
  20. paid_python-0.6.0/src/paid/products/raw_client.py +807 -0
  21. paid_python-0.6.0/src/paid/products/types/__init__.py +7 -0
  22. paid_python-0.6.0/src/paid/products/types/product_create_type.py +5 -0
  23. paid_python-0.6.0/src/paid/traces/__init__.py +4 -0
  24. paid_python-0.6.0/src/paid/traces/client.py +218 -0
  25. paid_python-0.6.0/src/paid/traces/raw_client.py +226 -0
  26. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/context_manager.py +9 -4
  27. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/__init__.py +34 -2
  28. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/cost_trace.py +6 -1
  29. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/customer.py +4 -3
  30. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/customer_update.py +4 -2
  31. paid_python-0.6.0/src/paid/types/order_line_attribute_create_one.py +5 -0
  32. paid_python-0.6.0/src/paid/types/order_line_create.py +72 -0
  33. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/pagination_meta.py +26 -0
  34. paid_python-0.6.0/src/paid/types/plan.py +81 -0
  35. paid_python-0.6.0/src/paid/types/plan_group.py +60 -0
  36. paid_python-0.6.0/src/paid/types/plan_plan_products_item.py +35 -0
  37. paid_python-0.6.0/src/paid/types/plan_plan_products_item_plan_product_attribute_item.py +34 -0
  38. paid_python-0.6.0/src/paid/types/product.py +56 -0
  39. paid_python-0.6.0/src/paid/types/product_type.py +5 -0
  40. paid_python-0.6.0/src/paid/types/product_update.py +36 -0
  41. paid_python-0.6.0/src/paid/types/product_update_type.py +5 -0
  42. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/signal.py +17 -5
  43. paid_python-0.6.0/src/paid/types/signal_v_2.py +56 -0
  44. paid_python-0.6.0/src/paid/types/trace.py +69 -0
  45. paid_python-0.6.0/src/paid/types/traces_response.py +26 -0
  46. paid_python-0.4.1a0/src/paid/types/order_line_attribute_create.py → paid_python-0.6.0/src/paid/types/usage_pagination_meta.py +16 -8
  47. paid_python-0.6.0/src/paid/types/usage_summaries_response.py +26 -0
  48. paid_python-0.6.0/src/paid/types/usage_summary.py +121 -0
  49. paid_python-0.6.0/src/paid/types/usage_summary_order.py +26 -0
  50. paid_python-0.6.0/src/paid/types/usage_summary_order_line.py +26 -0
  51. paid_python-0.6.0/src/paid/usage/__init__.py +7 -0
  52. paid_python-0.6.0/src/paid/usage/client.py +321 -0
  53. paid_python-0.6.0/src/paid/usage/raw_client.py +387 -0
  54. paid_python-0.6.0/src/paid/usage/types/__init__.py +7 -0
  55. paid_python-0.6.0/src/paid/usage/types/usage_check_usage_response.py +53 -0
  56. paid_python-0.4.1a0/src/paid/types/order_line_create.py +0 -51
  57. paid_python-0.4.1a0/src/paid/usage/client.py +0 -115
  58. paid_python-0.4.1a0/src/paid/usage/raw_client.py +0 -104
  59. {paid_python-0.4.1a0 → paid_python-0.6.0}/LICENSE +0 -0
  60. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/agents/__init__.py +0 -0
  61. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/contacts/__init__.py +0 -0
  62. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/contacts/client.py +0 -0
  63. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/contacts/raw_client.py +0 -0
  64. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/__init__.py +0 -0
  65. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/api_error.py +0 -0
  66. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/datetime_utils.py +0 -0
  67. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/file.py +0 -0
  68. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/force_multipart.py +0 -0
  69. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/http_client.py +0 -0
  70. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/http_response.py +0 -0
  71. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/jsonable_encoder.py +0 -0
  72. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/pydantic_utilities.py +0 -0
  73. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/query_encoder.py +0 -0
  74. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/remove_none_from_dict.py +0 -0
  75. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/request_options.py +0 -0
  76. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/core/serialization.py +0 -0
  77. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/customers/__init__.py +0 -0
  78. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/environment.py +0 -0
  79. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/errors/bad_request_error.py +0 -0
  80. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/errors/forbidden_error.py +0 -0
  81. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/errors/not_found_error.py +0 -0
  82. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/logger.py +0 -0
  83. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/orders/__init__.py +0 -0
  84. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/orders/lines/__init__.py +0 -0
  85. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/orders/lines/raw_client.py +0 -0
  86. {paid_python-0.4.1a0/src/paid/usage → paid_python-0.6.0/src/paid/plans}/__init__.py +0 -0
  87. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/py.typed +0 -0
  88. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/__init__.py +0 -0
  89. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/autoinstrumentation.py +0 -0
  90. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/context_data.py +0 -0
  91. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/distributed_tracing.py +0 -0
  92. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/signal.py +0 -0
  93. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/tracing.py +0 -0
  94. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/__init__.py +0 -0
  95. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/anthropic/__init__.py +0 -0
  96. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/anthropic/anthropicWrapper.py +0 -0
  97. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/bedrock/__init__.py +0 -0
  98. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/bedrock/bedrockWrapper.py +0 -0
  99. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/gemini/__init__.py +0 -0
  100. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/gemini/geminiWrapper.py +0 -0
  101. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/langchain/__init__.py +0 -0
  102. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/langchain/paidLangChainCallback.py +0 -0
  103. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/llamaindex/__init__.py +0 -0
  104. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/llamaindex/llamaIndexWrapper.py +0 -0
  105. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/mistral/__init__.py +0 -0
  106. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/mistral/mistralWrapper.py +0 -0
  107. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/openai/__init__.py +0 -0
  108. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/openai/openAiWrapper.py +0 -0
  109. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/openai_agents/__init__.py +0 -0
  110. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +0 -0
  111. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/tracing/wrappers/utils.py +0 -0
  112. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/address.py +0 -0
  113. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/agent.py +0 -0
  114. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/agent_attribute.py +0 -0
  115. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/agent_price_point.py +0 -0
  116. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/agent_price_point_tiers.py +0 -0
  117. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/agent_update.py +0 -0
  118. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/api_error.py +0 -0
  119. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/billing_frequency.py +0 -0
  120. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/charge_type.py +0 -0
  121. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/contact.py +0 -0
  122. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/cost_amount.py +0 -0
  123. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/cost_traces_response.py +0 -0
  124. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/creation_source.py +0 -0
  125. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/creation_state.py +0 -0
  126. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/entitlement_usage.py +0 -0
  127. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/error.py +0 -0
  128. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/order.py +0 -0
  129. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/order_line.py +0 -0
  130. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/order_line_attribute.py +0 -0
  131. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/order_line_attribute_pricing.py +0 -0
  132. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/price_point.py +0 -0
  133. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/pricing.py +0 -0
  134. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/pricing_model_type.py +0 -0
  135. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/salutation.py +0 -0
  136. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/tax_exempt_status.py +0 -0
  137. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/types/tier.py +0 -0
  138. {paid_python-0.4.1a0 → paid_python-0.6.0}/src/paid/version.py +0 -0
  139. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/__init__.py +0 -0
  140. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/__init__.py +0 -0
  141. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/audio_wrappers.py +0 -0
  142. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/chat_wrappers.py +0 -0
  143. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/completion_wrappers.py +0 -0
  144. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/config.py +0 -0
  145. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/embeddings_wrappers.py +0 -0
  146. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/event_emitter.py +0 -0
  147. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/event_models.py +0 -0
  148. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/image_gen_wrappers.py +0 -0
  149. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/span_utils.py +0 -0
  150. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/utils.py +0 -0
  151. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/v0/__init__.py +0 -0
  152. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/v1/__init__.py +0 -0
  153. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/v1/assistant_wrappers.py +0 -0
  154. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py +0 -0
  155. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/v1/responses_wrappers.py +0 -0
  156. {paid_python-0.4.1a0 → paid_python-0.6.0}/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: paid-python
3
- Version: 0.4.1a0
3
+ Version: 0.6.0
4
4
  Summary:
5
5
  Requires-Python: >=3.9,<3.14
6
6
  Classifier: Intended Audience :: Developers
@@ -183,7 +183,7 @@ The easiest way to add cost tracking is using the `@paid_tracing` decorator or c
183
183
  ```python
184
184
  from paid.tracing import paid_tracing
185
185
 
186
- @paid_tracing("<external_customer_id>", external_agent_id="<optional_external_agent_id>")
186
+ @paid_tracing("<external_customer_id>", external_product_id="<optional_external_product_id>")
187
187
  def some_agent_workflow(): # your function
188
188
  # Your logic - use any AI providers with Paid wrappers or send signals with signal().
189
189
  # This function is typically an event processor that should lead to AI calls or events emitted as Paid signals
@@ -197,11 +197,11 @@ You can also use `paid_tracing` as a context manager with `with` statements:
197
197
  from paid.tracing import paid_tracing
198
198
 
199
199
  # Synchronous
200
- with paid_tracing("customer_123", external_agent_id="agent_456"):
200
+ with paid_tracing("customer_123", external_product_id="product_456"):
201
201
  result = workflow()
202
202
 
203
203
  # Asynchronous
204
- async with paid_tracing("customer_123", external_agent_id="agent_456"):
204
+ async with paid_tracing("customer_123", external_product_id="product_456"):
205
205
  result = await workflow()
206
206
  ```
207
207
 
@@ -210,7 +210,7 @@ Both approaches:
210
210
  - Initialize tracing using your API key you provided to the Paid client, falls back to `PAID_API_KEY` environment variable.
211
211
  - Handle both sync and async functions/code blocks
212
212
  - Gracefully fall back to normal execution if tracing fails
213
- - Support the same parameters: `external_customer_id`, `external_agent_id`, `tracing_token`, `store_prompt`, `metadata`
213
+ - Support the same parameters: `external_customer_id`, `external_product_id`, `tracing_token`, `store_prompt`, `metadata`
214
214
 
215
215
  * Note - if it happens that you're calling `paid_tracing` from non-main thread, then it's advised to initialize from main thread:
216
216
  ```python
@@ -249,7 +249,7 @@ openAIClient = PaidOpenAI(OpenAI(
249
249
  api_key="<OPENAI_API_KEY>",
250
250
  ))
251
251
 
252
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
252
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
253
253
  def image_generate():
254
254
  response = openAIClient.images.generate(
255
255
  model="dall-e-3",
@@ -281,7 +281,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
281
281
 
282
282
  @paid_tracing(
283
283
  "customer_123",
284
- "agent_123",
284
+ external_product_id="product_123",
285
285
  metadata={
286
286
  "campaign_id": "campaign_456",
287
287
  "environment": "production",
@@ -325,7 +325,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
325
325
  # Pass metadata to context manager
326
326
  with paid_tracing(
327
327
  "customer_123",
328
- external_agent_id="agent_123",
328
+ external_product_id="product_123",
329
329
  metadata={
330
330
  "campaign_id": "campaign_456",
331
331
  "environment": "production",
@@ -380,7 +380,7 @@ paid_autoinstrument() # instruments all available: anthropic, gemini, openai, o
380
380
  # Now all OpenAI calls will be automatically traced
381
381
  openai_client = OpenAI(api_key="<OPENAI_API_KEY>")
382
382
 
383
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
383
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
384
384
  def chat_with_gpt():
385
385
  response = openai_client.chat.completions.create(
386
386
  model="gpt-4",
@@ -433,7 +433,7 @@ Here's an example of how to use it:
433
433
  ```python
434
434
  from paid.tracing import paid_tracing, signal
435
435
 
436
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
436
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
437
437
  def do_work():
438
438
  # ...do some work...
439
439
  signal(
@@ -457,7 +457,7 @@ def do_work():
457
457
  )
458
458
 
459
459
  # Use context manager instead
460
- with paid_tracing("your_external_customer_id", "your_external_agent_id"):
460
+ with paid_tracing("your_external_customer_id", external_product_id="your_external_product_id"):
461
461
  do_work()
462
462
  ```
463
463
 
@@ -472,7 +472,7 @@ This will look something like this:
472
472
  ```python
473
473
  from paid.tracing import paid_tracing, signal
474
474
 
475
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
475
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
476
476
  def do_work():
477
477
  # ... your workflow logic
478
478
  # ... your AI calls made through Paid wrappers or hooks
@@ -516,7 +516,7 @@ print(f"Tracing token: {token}")
516
516
  # Store token for other processes (e.g., in Redis, database, message queue)
517
517
  save_to_storage("workflow_123", token)
518
518
 
519
- @paid_tracing("customer_123", tracing_token=token, external_agent_id="agent_123")
519
+ @paid_tracing("customer_123", tracing_token=token, external_product_id="product_123")
520
520
  def process_part_1():
521
521
  # AI calls here will be traced
522
522
  response = openai_client.chat.completions.create(
@@ -531,7 +531,7 @@ process_part_1()
531
531
  # Process 2 (different machine/process): Retrieve and use token
532
532
  token = load_from_storage("workflow_123")
533
533
 
534
- @paid_tracing("customer_123", tracing_token=token, external_agent_id="agent_123")
534
+ @paid_tracing("customer_123", tracing_token=token, external_product_id="product_123")
535
535
  def process_part_2():
536
536
  # AI calls here will be linked to the same trace
537
537
  response = openai_client.chat.completions.create(
@@ -561,7 +561,7 @@ openai_client = PaidOpenAI(OpenAI(api_key="<OPENAI_API_KEY>"))
561
561
  token = generate_tracing_token()
562
562
  save_to_storage("workflow_123", token)
563
563
 
564
- with paid_tracing("customer_123", external_agent_id="agent_123", tracing_token=token):
564
+ with paid_tracing("customer_123", external_product_id="product_123", tracing_token=token):
565
565
  response = openai_client.chat.completions.create(
566
566
  model="gpt-4",
567
567
  messages=[{"role": "user", "content": "Analyze data"}]
@@ -571,7 +571,7 @@ with paid_tracing("customer_123", external_agent_id="agent_123", tracing_token=t
571
571
  # Process 2: Retrieve and use the same token
572
572
  token = load_from_storage("workflow_123")
573
573
 
574
- with paid_tracing("customer_123", external_agent_id="agent_123", tracing_token=token):
574
+ with paid_tracing("customer_123", external_product_id="product_123", tracing_token=token):
575
575
  response = openai_client.chat.completions.create(
576
576
  model="gpt-4",
577
577
  messages=[{"role": "user", "content": "Generate response"}]
@@ -613,7 +613,7 @@ Alternatively the same `costData` payload can be passed to OTLP signaling mechan
613
613
  ```python
614
614
  from paid.tracing import paid_tracing, signal
615
615
 
616
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
616
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
617
617
  def do_work():
618
618
  # ...do some work...
619
619
  signal(
@@ -667,7 +667,7 @@ Same but via OTEL signaling:
667
667
  ```python
668
668
  from paid.tracing import paid_tracing, signal
669
669
 
670
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
670
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
671
671
  def do_work():
672
672
  # ...do some work...
673
673
  signal(
@@ -719,7 +719,7 @@ initialize_tracing()
719
719
  # Wrap the async OpenAI client
720
720
  openai_client = PaidAsyncOpenAI(AsyncOpenAI(api_key="<OPENAI_API_KEY>"))
721
721
 
722
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
722
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
723
723
  async def generate_image():
724
724
  response = await openai_client.images.generate(
725
725
  model="dall-e-3",
@@ -747,7 +747,7 @@ initialize_tracing()
747
747
 
748
748
  openai_client = PaidAsyncOpenAI(AsyncOpenAI(api_key="<OPENAI_API_KEY>"))
749
749
 
750
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
750
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
751
751
  async def do_work():
752
752
  # Perform async AI operations
753
753
  response = await openai_client.chat.completions.create(
@@ -148,7 +148,7 @@ The easiest way to add cost tracking is using the `@paid_tracing` decorator or c
148
148
  ```python
149
149
  from paid.tracing import paid_tracing
150
150
 
151
- @paid_tracing("<external_customer_id>", external_agent_id="<optional_external_agent_id>")
151
+ @paid_tracing("<external_customer_id>", external_product_id="<optional_external_product_id>")
152
152
  def some_agent_workflow(): # your function
153
153
  # Your logic - use any AI providers with Paid wrappers or send signals with signal().
154
154
  # This function is typically an event processor that should lead to AI calls or events emitted as Paid signals
@@ -162,11 +162,11 @@ You can also use `paid_tracing` as a context manager with `with` statements:
162
162
  from paid.tracing import paid_tracing
163
163
 
164
164
  # Synchronous
165
- with paid_tracing("customer_123", external_agent_id="agent_456"):
165
+ with paid_tracing("customer_123", external_product_id="product_456"):
166
166
  result = workflow()
167
167
 
168
168
  # Asynchronous
169
- async with paid_tracing("customer_123", external_agent_id="agent_456"):
169
+ async with paid_tracing("customer_123", external_product_id="product_456"):
170
170
  result = await workflow()
171
171
  ```
172
172
 
@@ -175,7 +175,7 @@ Both approaches:
175
175
  - Initialize tracing using your API key you provided to the Paid client, falls back to `PAID_API_KEY` environment variable.
176
176
  - Handle both sync and async functions/code blocks
177
177
  - Gracefully fall back to normal execution if tracing fails
178
- - Support the same parameters: `external_customer_id`, `external_agent_id`, `tracing_token`, `store_prompt`, `metadata`
178
+ - Support the same parameters: `external_customer_id`, `external_product_id`, `tracing_token`, `store_prompt`, `metadata`
179
179
 
180
180
  * Note - if it happens that you're calling `paid_tracing` from non-main thread, then it's advised to initialize from main thread:
181
181
  ```python
@@ -214,7 +214,7 @@ openAIClient = PaidOpenAI(OpenAI(
214
214
  api_key="<OPENAI_API_KEY>",
215
215
  ))
216
216
 
217
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
217
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
218
218
  def image_generate():
219
219
  response = openAIClient.images.generate(
220
220
  model="dall-e-3",
@@ -246,7 +246,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
246
246
 
247
247
  @paid_tracing(
248
248
  "customer_123",
249
- "agent_123",
249
+ external_product_id="product_123",
250
250
  metadata={
251
251
  "campaign_id": "campaign_456",
252
252
  "environment": "production",
@@ -290,7 +290,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
290
290
  # Pass metadata to context manager
291
291
  with paid_tracing(
292
292
  "customer_123",
293
- external_agent_id="agent_123",
293
+ external_product_id="product_123",
294
294
  metadata={
295
295
  "campaign_id": "campaign_456",
296
296
  "environment": "production",
@@ -345,7 +345,7 @@ paid_autoinstrument() # instruments all available: anthropic, gemini, openai, o
345
345
  # Now all OpenAI calls will be automatically traced
346
346
  openai_client = OpenAI(api_key="<OPENAI_API_KEY>")
347
347
 
348
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
348
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
349
349
  def chat_with_gpt():
350
350
  response = openai_client.chat.completions.create(
351
351
  model="gpt-4",
@@ -398,7 +398,7 @@ Here's an example of how to use it:
398
398
  ```python
399
399
  from paid.tracing import paid_tracing, signal
400
400
 
401
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
401
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
402
402
  def do_work():
403
403
  # ...do some work...
404
404
  signal(
@@ -422,7 +422,7 @@ def do_work():
422
422
  )
423
423
 
424
424
  # Use context manager instead
425
- with paid_tracing("your_external_customer_id", "your_external_agent_id"):
425
+ with paid_tracing("your_external_customer_id", external_product_id="your_external_product_id"):
426
426
  do_work()
427
427
  ```
428
428
 
@@ -437,7 +437,7 @@ This will look something like this:
437
437
  ```python
438
438
  from paid.tracing import paid_tracing, signal
439
439
 
440
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
440
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
441
441
  def do_work():
442
442
  # ... your workflow logic
443
443
  # ... your AI calls made through Paid wrappers or hooks
@@ -481,7 +481,7 @@ print(f"Tracing token: {token}")
481
481
  # Store token for other processes (e.g., in Redis, database, message queue)
482
482
  save_to_storage("workflow_123", token)
483
483
 
484
- @paid_tracing("customer_123", tracing_token=token, external_agent_id="agent_123")
484
+ @paid_tracing("customer_123", tracing_token=token, external_product_id="product_123")
485
485
  def process_part_1():
486
486
  # AI calls here will be traced
487
487
  response = openai_client.chat.completions.create(
@@ -496,7 +496,7 @@ process_part_1()
496
496
  # Process 2 (different machine/process): Retrieve and use token
497
497
  token = load_from_storage("workflow_123")
498
498
 
499
- @paid_tracing("customer_123", tracing_token=token, external_agent_id="agent_123")
499
+ @paid_tracing("customer_123", tracing_token=token, external_product_id="product_123")
500
500
  def process_part_2():
501
501
  # AI calls here will be linked to the same trace
502
502
  response = openai_client.chat.completions.create(
@@ -526,7 +526,7 @@ openai_client = PaidOpenAI(OpenAI(api_key="<OPENAI_API_KEY>"))
526
526
  token = generate_tracing_token()
527
527
  save_to_storage("workflow_123", token)
528
528
 
529
- with paid_tracing("customer_123", external_agent_id="agent_123", tracing_token=token):
529
+ with paid_tracing("customer_123", external_product_id="product_123", tracing_token=token):
530
530
  response = openai_client.chat.completions.create(
531
531
  model="gpt-4",
532
532
  messages=[{"role": "user", "content": "Analyze data"}]
@@ -536,7 +536,7 @@ with paid_tracing("customer_123", external_agent_id="agent_123", tracing_token=t
536
536
  # Process 2: Retrieve and use the same token
537
537
  token = load_from_storage("workflow_123")
538
538
 
539
- with paid_tracing("customer_123", external_agent_id="agent_123", tracing_token=token):
539
+ with paid_tracing("customer_123", external_product_id="product_123", tracing_token=token):
540
540
  response = openai_client.chat.completions.create(
541
541
  model="gpt-4",
542
542
  messages=[{"role": "user", "content": "Generate response"}]
@@ -578,7 +578,7 @@ Alternatively the same `costData` payload can be passed to OTLP signaling mechan
578
578
  ```python
579
579
  from paid.tracing import paid_tracing, signal
580
580
 
581
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
581
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
582
582
  def do_work():
583
583
  # ...do some work...
584
584
  signal(
@@ -632,7 +632,7 @@ Same but via OTEL signaling:
632
632
  ```python
633
633
  from paid.tracing import paid_tracing, signal
634
634
 
635
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
635
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
636
636
  def do_work():
637
637
  # ...do some work...
638
638
  signal(
@@ -684,7 +684,7 @@ initialize_tracing()
684
684
  # Wrap the async OpenAI client
685
685
  openai_client = PaidAsyncOpenAI(AsyncOpenAI(api_key="<OPENAI_API_KEY>"))
686
686
 
687
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
687
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
688
688
  async def generate_image():
689
689
  response = await openai_client.images.generate(
690
690
  model="dall-e-3",
@@ -712,7 +712,7 @@ initialize_tracing()
712
712
 
713
713
  openai_client = PaidAsyncOpenAI(AsyncOpenAI(api_key="<OPENAI_API_KEY>"))
714
714
 
715
- @paid_tracing("your_external_customer_id", "your_external_agent_id")
715
+ @paid_tracing("your_external_customer_id", external_product_id="your_external_product_id")
716
716
  async def do_work():
717
717
  # Perform async AI operations
718
718
  response = await openai_client.chat.completions.create(
@@ -3,7 +3,7 @@ name = "paid-python"
3
3
 
4
4
  [tool.poetry]
5
5
  name = "paid-python"
6
- version = "0.4.1-alpha0"
6
+ version = "0.6.0"
7
7
  description = ""
8
8
  readme = "README.md"
9
9
  authors = []
@@ -25,22 +25,40 @@ from .types import (
25
25
  Order,
26
26
  OrderLine,
27
27
  OrderLineAttribute,
28
- OrderLineAttributeCreate,
28
+ OrderLineAttributeCreateOne,
29
29
  OrderLineAttributePricing,
30
30
  OrderLineCreate,
31
31
  PaginationMeta,
32
+ Plan,
33
+ PlanGroup,
34
+ PlanPlanProductsItem,
35
+ PlanPlanProductsItemPlanProductAttributeItem,
32
36
  PricePoint,
33
37
  Pricing,
34
38
  PricingModelType,
39
+ Product,
40
+ ProductType,
41
+ ProductUpdate,
42
+ ProductUpdateType,
35
43
  Salutation,
36
44
  Signal,
45
+ SignalV2,
37
46
  TaxExemptStatus,
38
47
  Tier,
48
+ Trace,
49
+ TracesResponse,
50
+ UsagePaginationMeta,
51
+ UsageSummariesResponse,
52
+ UsageSummary,
53
+ UsageSummaryOrder,
54
+ UsageSummaryOrderLine,
39
55
  )
40
- from .errors import BadRequestError, ForbiddenError, NotFoundError
41
- from . import agents, contacts, customers, orders, usage
56
+ from .errors import BadRequestError, ForbiddenError, InternalServerError, NotFoundError
57
+ from . import agents, contacts, customers, orders, plans, products, traces, usage
42
58
  from .client import AsyncPaid, Paid
43
59
  from .environment import PaidEnvironment
60
+ from .products import ProductCreateType
61
+ from .usage import UsageCheckUsageResponse
44
62
  from .version import __version__
45
63
 
46
64
  __all__ = [
@@ -66,27 +84,49 @@ __all__ = [
66
84
  "EntitlementUsage",
67
85
  "Error",
68
86
  "ForbiddenError",
87
+ "InternalServerError",
69
88
  "NotFoundError",
70
89
  "Order",
71
90
  "OrderLine",
72
91
  "OrderLineAttribute",
73
- "OrderLineAttributeCreate",
92
+ "OrderLineAttributeCreateOne",
74
93
  "OrderLineAttributePricing",
75
94
  "OrderLineCreate",
76
95
  "PaginationMeta",
77
96
  "Paid",
78
97
  "PaidEnvironment",
98
+ "Plan",
99
+ "PlanGroup",
100
+ "PlanPlanProductsItem",
101
+ "PlanPlanProductsItemPlanProductAttributeItem",
79
102
  "PricePoint",
80
103
  "Pricing",
81
104
  "PricingModelType",
105
+ "Product",
106
+ "ProductCreateType",
107
+ "ProductType",
108
+ "ProductUpdate",
109
+ "ProductUpdateType",
82
110
  "Salutation",
83
111
  "Signal",
112
+ "SignalV2",
84
113
  "TaxExemptStatus",
85
114
  "Tier",
115
+ "Trace",
116
+ "TracesResponse",
117
+ "UsageCheckUsageResponse",
118
+ "UsagePaginationMeta",
119
+ "UsageSummariesResponse",
120
+ "UsageSummary",
121
+ "UsageSummaryOrder",
122
+ "UsageSummaryOrderLine",
86
123
  "__version__",
87
124
  "agents",
88
125
  "contacts",
89
126
  "customers",
90
127
  "orders",
128
+ "plans",
129
+ "products",
130
+ "traces",
91
131
  "usage",
92
132
  ]
@@ -29,6 +29,8 @@ class AgentsClient:
29
29
 
30
30
  def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Agent]:
31
31
  """
32
+ DEPRECATED: Use /products instead. Agents are now products with type='agent'.
33
+
32
34
  Parameters
33
35
  ----------
34
36
  request_options : typing.Optional[RequestOptions]
@@ -62,6 +64,8 @@ class AgentsClient:
62
64
  request_options: typing.Optional[RequestOptions] = None,
63
65
  ) -> Agent:
64
66
  """
67
+ DEPRECATED: Use POST /products instead.
68
+
65
69
  Parameters
66
70
  ----------
67
71
  name : str
@@ -107,6 +111,8 @@ class AgentsClient:
107
111
 
108
112
  def get(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Agent:
109
113
  """
114
+ DEPRECATED: Use GET /products/{productId} instead.
115
+
110
116
  Parameters
111
117
  ----------
112
118
  agent_id : str
@@ -146,6 +152,8 @@ class AgentsClient:
146
152
  request_options: typing.Optional[RequestOptions] = None,
147
153
  ) -> Agent:
148
154
  """
155
+ DEPRECATED: Use PUT /products/{productId} instead.
156
+
149
157
  Parameters
150
158
  ----------
151
159
  agent_id : str
@@ -235,6 +243,8 @@ class AgentsClient:
235
243
 
236
244
  def delete(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
237
245
  """
246
+ DEPRECATED: Use DELETE /products/{productId} instead.
247
+
238
248
  Parameters
239
249
  ----------
240
250
  agent_id : str
@@ -262,6 +272,8 @@ class AgentsClient:
262
272
 
263
273
  def get_by_external_id(self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Agent:
264
274
  """
275
+ DEPRECATED: Use GET /products/external/{externalId} instead.
276
+
265
277
  Parameters
266
278
  ----------
267
279
  external_id : str
@@ -301,6 +313,8 @@ class AgentsClient:
301
313
  request_options: typing.Optional[RequestOptions] = None,
302
314
  ) -> Agent:
303
315
  """
316
+ DEPRECATED: Use PUT /products/external/{externalId} instead.
317
+
304
318
  Parameters
305
319
  ----------
306
320
  external_id_ : str
@@ -371,6 +385,8 @@ class AgentsClient:
371
385
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
372
386
  ) -> None:
373
387
  """
388
+ DEPRECATED: Use DELETE /products/external/{externalId} instead.
389
+
374
390
  Parameters
375
391
  ----------
376
392
  external_id : str
@@ -414,6 +430,8 @@ class AsyncAgentsClient:
414
430
 
415
431
  async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Agent]:
416
432
  """
433
+ DEPRECATED: Use /products instead. Agents are now products with type='agent'.
434
+
417
435
  Parameters
418
436
  ----------
419
437
  request_options : typing.Optional[RequestOptions]
@@ -455,6 +473,8 @@ class AsyncAgentsClient:
455
473
  request_options: typing.Optional[RequestOptions] = None,
456
474
  ) -> Agent:
457
475
  """
476
+ DEPRECATED: Use POST /products instead.
477
+
458
478
  Parameters
459
479
  ----------
460
480
  name : str
@@ -508,6 +528,8 @@ class AsyncAgentsClient:
508
528
 
509
529
  async def get(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Agent:
510
530
  """
531
+ DEPRECATED: Use GET /products/{productId} instead.
532
+
511
533
  Parameters
512
534
  ----------
513
535
  agent_id : str
@@ -555,6 +577,8 @@ class AsyncAgentsClient:
555
577
  request_options: typing.Optional[RequestOptions] = None,
556
578
  ) -> Agent:
557
579
  """
580
+ DEPRECATED: Use PUT /products/{productId} instead.
581
+
558
582
  Parameters
559
583
  ----------
560
584
  agent_id : str
@@ -652,6 +676,8 @@ class AsyncAgentsClient:
652
676
 
653
677
  async def delete(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
654
678
  """
679
+ DEPRECATED: Use DELETE /products/{productId} instead.
680
+
655
681
  Parameters
656
682
  ----------
657
683
  agent_id : str
@@ -689,6 +715,8 @@ class AsyncAgentsClient:
689
715
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
690
716
  ) -> Agent:
691
717
  """
718
+ DEPRECATED: Use GET /products/external/{externalId} instead.
719
+
692
720
  Parameters
693
721
  ----------
694
722
  external_id : str
@@ -736,6 +764,8 @@ class AsyncAgentsClient:
736
764
  request_options: typing.Optional[RequestOptions] = None,
737
765
  ) -> Agent:
738
766
  """
767
+ DEPRECATED: Use PUT /products/external/{externalId} instead.
768
+
739
769
  Parameters
740
770
  ----------
741
771
  external_id_ : str
@@ -814,6 +844,8 @@ class AsyncAgentsClient:
814
844
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
815
845
  ) -> None:
816
846
  """
847
+ DEPRECATED: Use DELETE /products/external/{externalId} instead.
848
+
817
849
  Parameters
818
850
  ----------
819
851
  external_id : str