paid-python 0.6.0__tar.gz → 1.0.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 (189) hide show
  1. {paid_python-0.6.0 → paid_python-1.0.0}/PKG-INFO +43 -26
  2. {paid_python-0.6.0 → paid_python-1.0.0}/README.md +36 -22
  3. {paid_python-0.6.0 → paid_python-1.0.0}/pyproject.toml +20 -46
  4. paid_python-1.0.0/src/paid/__init__.py +102 -0
  5. paid_python-1.0.0/src/paid/client.py +158 -0
  6. paid_python-1.0.0/src/paid/contacts/client.py +828 -0
  7. paid_python-1.0.0/src/paid/contacts/raw_client.py +1462 -0
  8. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/client_wrapper.py +9 -10
  9. paid_python-1.0.0/src/paid/customers/client.py +912 -0
  10. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/customers/raw_client.py +731 -537
  11. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/environment.py +1 -1
  12. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/errors/bad_request_error.py +2 -2
  13. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/errors/forbidden_error.py +2 -2
  14. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/errors/internal_server_error.py +2 -2
  15. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/errors/not_found_error.py +2 -2
  16. paid_python-1.0.0/src/paid/invoices/client.py +369 -0
  17. paid_python-1.0.0/src/paid/invoices/raw_client.py +694 -0
  18. paid_python-1.0.0/src/paid/orders/client.py +702 -0
  19. paid_python-1.0.0/src/paid/orders/raw_client.py +1169 -0
  20. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/products/client.py +129 -265
  21. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/products/raw_client.py +565 -233
  22. paid_python-1.0.0/src/paid/signals/client.py +130 -0
  23. paid_python-1.0.0/src/paid/signals/raw_client.py +190 -0
  24. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/__init__.py +13 -2
  25. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/autoinstrumentation.py +38 -9
  26. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/context_manager.py +2 -6
  27. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/distributed_tracing.py +3 -3
  28. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/signal.py +3 -3
  29. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/tracing.py +218 -1
  30. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/__init__.py +0 -4
  31. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
  32. paid_python-1.0.0/src/paid/types/__init__.py +81 -0
  33. paid_python-1.0.0/src/paid/types/attribution.py +8 -0
  34. paid_python-0.6.0/src/paid/types/agent_attribute.py → paid_python-1.0.0/src/paid/types/bulk_signals_response.py +4 -5
  35. paid_python-1.0.0/src/paid/types/contact.py +34 -0
  36. paid_python-0.6.0/src/paid/types/address.py → paid_python-1.0.0/src/paid/types/contact_billing_address.py +6 -7
  37. paid_python-0.6.0/src/paid/types/cost_amount.py → paid_python-1.0.0/src/paid/types/contact_list_response.py +5 -14
  38. paid_python-1.0.0/src/paid/types/customer.py +39 -0
  39. paid_python-1.0.0/src/paid/types/customer_attribution.py +8 -0
  40. paid_python-1.0.0/src/paid/types/customer_billing_address.py +26 -0
  41. paid_python-0.6.0/src/paid/types/usage_summary_order.py → paid_python-1.0.0/src/paid/types/customer_by_external_id.py +3 -5
  42. paid_python-0.6.0/src/paid/types/usage_summary_order_line.py → paid_python-1.0.0/src/paid/types/customer_by_id.py +3 -5
  43. paid_python-1.0.0/src/paid/types/customer_creation_state.py +5 -0
  44. paid_python-1.0.0/src/paid/types/customer_list_response.py +22 -0
  45. paid_python-1.0.0/src/paid/types/empty_response.py +17 -0
  46. paid_python-0.6.0/src/paid/types/error.py → paid_python-1.0.0/src/paid/types/error_response.py +4 -7
  47. paid_python-1.0.0/src/paid/types/invoice.py +57 -0
  48. paid_python-1.0.0/src/paid/types/invoice_line.py +42 -0
  49. paid_python-1.0.0/src/paid/types/invoice_line_payment_status.py +7 -0
  50. paid_python-1.0.0/src/paid/types/invoice_lines_response.py +22 -0
  51. paid_python-1.0.0/src/paid/types/invoice_list_response.py +22 -0
  52. paid_python-1.0.0/src/paid/types/invoice_payment_status.py +5 -0
  53. paid_python-1.0.0/src/paid/types/invoice_source.py +5 -0
  54. paid_python-1.0.0/src/paid/types/invoice_status.py +7 -0
  55. paid_python-1.0.0/src/paid/types/invoice_tax_status.py +7 -0
  56. paid_python-1.0.0/src/paid/types/order.py +50 -0
  57. paid_python-1.0.0/src/paid/types/order_creation_state.py +5 -0
  58. paid_python-0.6.0/src/paid/types/order_line_attribute.py → paid_python-1.0.0/src/paid/types/order_line.py +8 -8
  59. paid_python-1.0.0/src/paid/types/order_lines_response.py +22 -0
  60. paid_python-1.0.0/src/paid/types/order_list_response.py +22 -0
  61. paid_python-1.0.0/src/paid/types/pagination.py +24 -0
  62. paid_python-0.6.0/src/paid/types/agent.py → paid_python-1.0.0/src/paid/types/product.py +8 -8
  63. paid_python-0.6.0/src/paid/types/tier.py → paid_python-1.0.0/src/paid/types/product_by_external_id.py +5 -4
  64. paid_python-0.6.0/src/paid/types/traces_response.py → paid_python-1.0.0/src/paid/types/product_by_id.py +5 -7
  65. paid_python-1.0.0/src/paid/types/product_list_response.py +22 -0
  66. paid_python-0.6.0/src/paid/types/agent_price_point_tiers.py → paid_python-1.0.0/src/paid/types/signal.py +8 -4
  67. paid_python-0.6.0/src/paid/types/contact.py → paid_python-1.0.0/src/paid/types/update_contact_request.py +5 -17
  68. paid_python-1.0.0/src/paid/types/update_customer_request.py +38 -0
  69. paid_python-0.6.0/src/paid/types/product_update.py → paid_python-1.0.0/src/paid/types/update_product_request.py +2 -12
  70. paid_python-0.6.0/src/paid/__init__.py +0 -132
  71. paid_python-0.6.0/src/paid/agents/client.py +0 -880
  72. paid_python-0.6.0/src/paid/agents/raw_client.py +0 -785
  73. paid_python-0.6.0/src/paid/client.py +0 -635
  74. paid_python-0.6.0/src/paid/contacts/client.py +0 -544
  75. paid_python-0.6.0/src/paid/contacts/raw_client.py +0 -532
  76. paid_python-0.6.0/src/paid/customers/client.py +0 -1206
  77. paid_python-0.6.0/src/paid/orders/__init__.py +0 -7
  78. paid_python-0.6.0/src/paid/orders/client.py +0 -457
  79. paid_python-0.6.0/src/paid/orders/lines/client.py +0 -144
  80. paid_python-0.6.0/src/paid/orders/lines/raw_client.py +0 -129
  81. paid_python-0.6.0/src/paid/orders/raw_client.py +0 -459
  82. paid_python-0.6.0/src/paid/plans/client.py +0 -332
  83. paid_python-0.6.0/src/paid/plans/raw_client.py +0 -464
  84. paid_python-0.6.0/src/paid/products/__init__.py +0 -7
  85. paid_python-0.6.0/src/paid/products/types/__init__.py +0 -7
  86. paid_python-0.6.0/src/paid/products/types/product_create_type.py +0 -5
  87. paid_python-0.6.0/src/paid/traces/client.py +0 -218
  88. paid_python-0.6.0/src/paid/traces/raw_client.py +0 -226
  89. paid_python-0.6.0/src/paid/tracing/wrappers/llamaindex/__init__.py +0 -3
  90. paid_python-0.6.0/src/paid/tracing/wrappers/llamaindex/llamaIndexWrapper.py +0 -77
  91. paid_python-0.6.0/src/paid/types/__init__.py +0 -105
  92. paid_python-0.6.0/src/paid/types/agent_price_point.py +0 -27
  93. paid_python-0.6.0/src/paid/types/agent_update.py +0 -29
  94. paid_python-0.6.0/src/paid/types/api_error.py +0 -29
  95. paid_python-0.6.0/src/paid/types/billing_frequency.py +0 -5
  96. paid_python-0.6.0/src/paid/types/charge_type.py +0 -5
  97. paid_python-0.6.0/src/paid/types/cost_trace.py +0 -55
  98. paid_python-0.6.0/src/paid/types/cost_traces_response.py +0 -26
  99. paid_python-0.6.0/src/paid/types/creation_source.py +0 -5
  100. paid_python-0.6.0/src/paid/types/creation_state.py +0 -5
  101. paid_python-0.6.0/src/paid/types/customer.py +0 -46
  102. paid_python-0.6.0/src/paid/types/customer_update.py +0 -40
  103. paid_python-0.6.0/src/paid/types/entitlement_usage.py +0 -48
  104. paid_python-0.6.0/src/paid/types/order.py +0 -49
  105. paid_python-0.6.0/src/paid/types/order_line.py +0 -45
  106. paid_python-0.6.0/src/paid/types/order_line_attribute_create_one.py +0 -5
  107. paid_python-0.6.0/src/paid/types/order_line_attribute_pricing.py +0 -33
  108. paid_python-0.6.0/src/paid/types/order_line_create.py +0 -72
  109. paid_python-0.6.0/src/paid/types/pagination_meta.py +0 -84
  110. paid_python-0.6.0/src/paid/types/plan.py +0 -81
  111. paid_python-0.6.0/src/paid/types/plan_group.py +0 -60
  112. paid_python-0.6.0/src/paid/types/plan_plan_products_item.py +0 -35
  113. paid_python-0.6.0/src/paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
  114. paid_python-0.6.0/src/paid/types/price_point.py +0 -25
  115. paid_python-0.6.0/src/paid/types/pricing.py +0 -31
  116. paid_python-0.6.0/src/paid/types/pricing_model_type.py +0 -7
  117. paid_python-0.6.0/src/paid/types/product.py +0 -56
  118. paid_python-0.6.0/src/paid/types/product_type.py +0 -5
  119. paid_python-0.6.0/src/paid/types/product_update_type.py +0 -5
  120. paid_python-0.6.0/src/paid/types/salutation.py +0 -5
  121. paid_python-0.6.0/src/paid/types/signal.py +0 -53
  122. paid_python-0.6.0/src/paid/types/signal_v_2.py +0 -56
  123. paid_python-0.6.0/src/paid/types/tax_exempt_status.py +0 -5
  124. paid_python-0.6.0/src/paid/types/trace.py +0 -69
  125. paid_python-0.6.0/src/paid/types/usage_pagination_meta.py +0 -43
  126. paid_python-0.6.0/src/paid/types/usage_summaries_response.py +0 -26
  127. paid_python-0.6.0/src/paid/types/usage_summary.py +0 -121
  128. paid_python-0.6.0/src/paid/usage/__init__.py +0 -7
  129. paid_python-0.6.0/src/paid/usage/client.py +0 -321
  130. paid_python-0.6.0/src/paid/usage/raw_client.py +0 -387
  131. paid_python-0.6.0/src/paid/usage/types/__init__.py +0 -7
  132. paid_python-0.6.0/src/paid/usage/types/usage_check_usage_response.py +0 -53
  133. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/__init__.py +0 -54
  134. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/__init__.py +0 -399
  135. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/audio_wrappers.py +0 -247
  136. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/chat_wrappers.py +0 -1192
  137. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/completion_wrappers.py +0 -292
  138. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/config.py +0 -15
  139. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/embeddings_wrappers.py +0 -311
  140. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/event_emitter.py +0 -108
  141. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/event_models.py +0 -41
  142. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/image_gen_wrappers.py +0 -68
  143. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/span_utils.py +0 -0
  144. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/utils.py +0 -213
  145. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/v0/__init__.py +0 -176
  146. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/v1/__init__.py +0 -394
  147. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/v1/assistant_wrappers.py +0 -329
  148. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py +0 -134
  149. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/v1/responses_wrappers.py +0 -1113
  150. paid_python-0.6.0/vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/version.py +0 -1
  151. {paid_python-0.6.0 → paid_python-1.0.0}/LICENSE +0 -0
  152. {paid_python-0.6.0/src/paid/agents → paid_python-1.0.0/src/paid/contacts}/__init__.py +0 -0
  153. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/__init__.py +0 -0
  154. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/api_error.py +0 -0
  155. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/datetime_utils.py +0 -0
  156. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/file.py +0 -0
  157. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/force_multipart.py +0 -0
  158. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/http_client.py +0 -0
  159. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/http_response.py +0 -0
  160. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/jsonable_encoder.py +0 -0
  161. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/pydantic_utilities.py +0 -0
  162. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/query_encoder.py +0 -0
  163. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/remove_none_from_dict.py +0 -0
  164. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/request_options.py +0 -0
  165. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/core/serialization.py +0 -0
  166. {paid_python-0.6.0/src/paid/contacts → paid_python-1.0.0/src/paid/customers}/__init__.py +0 -0
  167. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/errors/__init__.py +0 -0
  168. {paid_python-0.6.0/src/paid/customers → paid_python-1.0.0/src/paid/invoices}/__init__.py +0 -0
  169. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/logger.py +0 -0
  170. {paid_python-0.6.0/src/paid/orders/lines → paid_python-1.0.0/src/paid/orders}/__init__.py +0 -0
  171. {paid_python-0.6.0/src/paid/plans → paid_python-1.0.0/src/paid/products}/__init__.py +0 -0
  172. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/py.typed +0 -0
  173. {paid_python-0.6.0/src/paid/traces → paid_python-1.0.0/src/paid/signals}/__init__.py +0 -0
  174. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/context_data.py +0 -0
  175. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/anthropic/__init__.py +0 -0
  176. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/anthropic/anthropicWrapper.py +0 -0
  177. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/bedrock/__init__.py +0 -0
  178. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/bedrock/bedrockWrapper.py +0 -0
  179. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/gemini/__init__.py +0 -0
  180. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/gemini/geminiWrapper.py +0 -0
  181. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/langchain/__init__.py +0 -0
  182. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/langchain/paidLangChainCallback.py +0 -0
  183. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/mistral/__init__.py +0 -0
  184. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/mistral/mistralWrapper.py +0 -0
  185. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/openai/__init__.py +0 -0
  186. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/openai/openAiWrapper.py +0 -0
  187. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/openai_agents/__init__.py +0 -0
  188. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/tracing/wrappers/utils.py +0 -0
  189. {paid_python-0.6.0 → paid_python-1.0.0}/src/paid/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: paid-python
3
- Version: 0.6.0
3
+ Version: 1.0.0
4
4
  Summary:
5
5
  Requires-Python: >=3.9,<3.14
6
6
  Classifier: Intended Audience :: Developers
@@ -15,20 +15,23 @@ Classifier: Programming Language :: Python :: 3.9
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.8
18
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
20
  Classifier: Typing :: Typed
20
- Requires-Dist: httpx (>=0.21.0)
21
+ Requires-Dist: httpx (>=0.21.2)
21
22
  Requires-Dist: mutagen (>=1.47.0)
22
23
  Requires-Dist: openinference-instrumentation-bedrock (>=0.1.0)
23
24
  Requires-Dist: openinference-instrumentation-google-genai (>=0.1.8)
25
+ Requires-Dist: openinference-instrumentation-instructor (>=0.1.0)
24
26
  Requires-Dist: openinference-instrumentation-langchain (>=0.1.55)
27
+ Requires-Dist: openinference-instrumentation-openai (>=0.1.40)
25
28
  Requires-Dist: openinference-instrumentation-openai-agents (>=1.0.0)
26
29
  Requires-Dist: opentelemetry-api (>=1.23.0)
27
30
  Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.23.0)
28
31
  Requires-Dist: opentelemetry-instrumentation-anthropic (>=0.47.0)
29
32
  Requires-Dist: opentelemetry-sdk (>=1.23.0)
30
- Requires-Dist: pydantic (>=1.9.0)
31
- Requires-Dist: pydantic-core (>=2.18.0)
33
+ Requires-Dist: pydantic (>=1.9.2)
34
+ Requires-Dist: pydantic-core (>=2.18.2,<3.0.0)
32
35
  Requires-Dist: python-dotenv (>=0.15.0)
33
36
  Requires-Dist: typing_extensions (>=4.0.0)
34
37
  Description-Content-Type: text/markdown
@@ -76,7 +79,7 @@ from paid import Paid
76
79
 
77
80
  client = Paid(token="API_KEY")
78
81
 
79
- client.customers.create(
82
+ client.customers.create_customer(
80
83
  name="name"
81
84
  )
82
85
  ```
@@ -87,7 +90,7 @@ The SDK provides Python classes for all request and response types. These are au
87
90
 
88
91
  ```python
89
92
  # Example of creating a customer
90
- response = client.customers.create(
93
+ response = client.customers.create_customer(
91
94
  name="John Doe",
92
95
  )
93
96
 
@@ -101,13 +104,21 @@ print(response.email)
101
104
  When the API returns a non-success status code (4xx or 5xx response), the SDK will raise an appropriate error.
102
105
 
103
106
  ```python
107
+ from paid import BadRequestError, NotFoundError
108
+ from paid.core.api_error import ApiError
109
+
104
110
  try:
105
- client.customers.create(...)
106
- except paid.Error as e:
111
+ client.customers.create_customer(name="John Doe")
112
+ except BadRequestError as e:
113
+ print(e.status_code) # 400
114
+ print(e.body) # ErrorResponse with error details
115
+ except NotFoundError as e:
116
+ print(e.status_code) # 404
117
+ print(e.body)
118
+ except ApiError as e:
119
+ # Catch-all for other API errors
107
120
  print(e.status_code)
108
- print(e.message)
109
121
  print(e.body)
110
- print(e.raw_response)
111
122
  ```
112
123
 
113
124
  ## Logging
@@ -152,6 +163,7 @@ export PAID_ENABLED=false
152
163
  ```
153
164
 
154
165
  This is useful for:
166
+
155
167
  - Development/testing environments where tracing isn't needed
156
168
  - Temporarily disabling tracing without modifying code
157
169
  - Feature flagging in different deployment environments
@@ -213,11 +225,13 @@ Both approaches:
213
225
  - Support the same parameters: `external_customer_id`, `external_product_id`, `tracing_token`, `store_prompt`, `metadata`
214
226
 
215
227
  * Note - if it happens that you're calling `paid_tracing` from non-main thread, then it's advised to initialize from main thread:
228
+
216
229
  ```python
217
230
  from paid.tracing import initialize_tracing
218
231
  initialize_tracing()
219
232
  ```
220
- * `initialize_tracing` also accepts optional arguments like OTEL collector endpoint and api key if you want to reroute your tracing somewhere else :)
233
+
234
+ - `initialize_tracing` also accepts optional arguments like OTEL collector endpoint and api key if you want to reroute your tracing somewhere else :)
221
235
 
222
236
  ### Using the Paid wrappers
223
237
 
@@ -229,7 +243,6 @@ openai
229
243
  openai-agents (as a hook)
230
244
  anthropic
231
245
  langchain (as a hook)
232
- llamaindex
233
246
  bedrock (boto3)
234
247
  mistral
235
248
  gemini (google-genai)
@@ -300,6 +313,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
300
313
 
301
314
  process_event(incoming_event)
302
315
  ```
316
+
303
317
  </Tab>
304
318
 
305
319
  <Tab title="Python - Context Manager">
@@ -334,6 +348,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
334
348
  ):
335
349
  process_event(incoming_event)
336
350
  ```
351
+
337
352
  </Tab>
338
353
 
339
354
  <Tab title="Node.js">
@@ -375,7 +390,7 @@ from openai import OpenAI
375
390
  client = Paid(token="PAID_API_KEY")
376
391
  initialize_tracing()
377
392
 
378
- paid_autoinstrument() # instruments all available: anthropic, gemini, openai, openai-agents, bedrock, langchain
393
+ paid_autoinstrument() # instruments all available: anthropic, gemini, openai, openai-agents, bedrock, langchain, instructor
379
394
 
380
395
  # Now all OpenAI calls will be automatically traced
381
396
  openai_client = OpenAI(api_key="<OPENAI_API_KEY>")
@@ -402,6 +417,7 @@ openai - OpenAI Python SDK
402
417
  openai-agents - OpenAI Agents SDK
403
418
  bedrock - AWS Bedrock (boto3)
404
419
  langchain - LangChain framework
420
+ instructor - Instructor
405
421
  ```
406
422
 
407
423
  #### Selective Instrumentation
@@ -585,17 +601,17 @@ If you would prefer to not use Paid to track your costs automatically but you wa
585
601
  then you can use manual cost tracking mechanism. Just attach the cost information in the following format to a signal payload:
586
602
 
587
603
  ```python
588
- from paid import Paid, Signal
604
+ from paid import Paid, Signal, CustomerByExternalId, ProductByExternalId
589
605
 
590
606
  client = Paid(token="<PAID_API_KEY>")
591
607
 
592
608
  signal = Signal(
593
609
  event_name="<your_signal_name>",
594
- agent_id="<your_agent_id>",
595
- external_customer_id="<your_external_customer_id>",
596
- data = {
610
+ customer=CustomerByExternalId(external_customer_id="<your_external_customer_id>"),
611
+ attribution=ProductByExternalId(external_product_id="<your_external_product_id>"),
612
+ data={
597
613
  "costData": {
598
- "vendor": "<any_vendor_name>", # can be anything, traces are grouped by vendors in the UI
614
+ "vendor": "<any_vendor_name>", # can be anything, traces are grouped by vendors in the UI
599
615
  "cost": {
600
616
  "amount": 0.002,
601
617
  "currency": "USD"
@@ -605,7 +621,7 @@ signal = Signal(
605
621
  }
606
622
  )
607
623
 
608
- client.usage.record_bulk(signals=[signal])
624
+ client.signals.create_signals(signals=[signal])
609
625
  ```
610
626
 
611
627
  Alternatively the same `costData` payload can be passed to OTLP signaling mechanism:
@@ -638,17 +654,17 @@ do_work()
638
654
  If you would prefer to send us raw usage manually (without wrappers) and have us compute the cost, you can attach usage data in the following format:
639
655
 
640
656
  ```python
641
- from paid import Paid, Signal
657
+ from paid import Paid, Signal, CustomerByExternalId, ProductByExternalId
642
658
 
643
659
  client = Paid(token="<PAID_API_KEY>")
644
660
 
645
661
  signal = Signal(
646
662
  event_name="<your_signal_name>",
647
- agent_id="<your_agent_id>",
648
- external_customer_id="<your_external_customer_id>",
649
- data = {
663
+ customer=CustomerByExternalId(external_customer_id="<your_external_customer_id>"),
664
+ attribution=ProductByExternalId(external_product_id="<your_external_product_id>"),
665
+ data={
650
666
  "costData": {
651
- "vendor": "<any_vendor_name>", # can be anything, traces are grouped by vendors in the UI
667
+ "vendor": "<any_vendor_name>", # can be anything, traces are grouped by vendors in the UI
652
668
  "attributes": {
653
669
  "gen_ai.response.model": "gpt-4.1-mini",
654
670
  "gen_ai.usage.input_tokens": 100,
@@ -659,7 +675,7 @@ signal = Signal(
659
675
  }
660
676
  )
661
677
 
662
- client.usage.record_bulk(signals=[signal])
678
+ client.signals.create_signals(signals=[signal])
663
679
  ```
664
680
 
665
681
  Same but via OTEL signaling:
@@ -702,7 +718,7 @@ from paid import AsyncPaid
702
718
  client = AsyncPaid(token="API_KEY")
703
719
 
704
720
  # Async API calls
705
- customer = await client.customers.create(name="John Doe")
721
+ customer = await client.customers.create_customer(name="John Doe")
706
722
  ```
707
723
 
708
724
  ### Async Cost Tracking with Decorator
@@ -770,6 +786,7 @@ await do_work()
770
786
  ### Paid OTEL Tracer Provider
771
787
 
772
788
  If you would like to use the Paid OTEL tracer provider:
789
+
773
790
  ```python
774
791
  from paid.tracing import get_paid_tracer_provider
775
792
  paid_tracer_provider = get_paid_tracer_provider()
@@ -41,7 +41,7 @@ from paid import Paid
41
41
 
42
42
  client = Paid(token="API_KEY")
43
43
 
44
- client.customers.create(
44
+ client.customers.create_customer(
45
45
  name="name"
46
46
  )
47
47
  ```
@@ -52,7 +52,7 @@ The SDK provides Python classes for all request and response types. These are au
52
52
 
53
53
  ```python
54
54
  # Example of creating a customer
55
- response = client.customers.create(
55
+ response = client.customers.create_customer(
56
56
  name="John Doe",
57
57
  )
58
58
 
@@ -66,13 +66,21 @@ print(response.email)
66
66
  When the API returns a non-success status code (4xx or 5xx response), the SDK will raise an appropriate error.
67
67
 
68
68
  ```python
69
+ from paid import BadRequestError, NotFoundError
70
+ from paid.core.api_error import ApiError
71
+
69
72
  try:
70
- client.customers.create(...)
71
- except paid.Error as e:
73
+ client.customers.create_customer(name="John Doe")
74
+ except BadRequestError as e:
75
+ print(e.status_code) # 400
76
+ print(e.body) # ErrorResponse with error details
77
+ except NotFoundError as e:
78
+ print(e.status_code) # 404
79
+ print(e.body)
80
+ except ApiError as e:
81
+ # Catch-all for other API errors
72
82
  print(e.status_code)
73
- print(e.message)
74
83
  print(e.body)
75
- print(e.raw_response)
76
84
  ```
77
85
 
78
86
  ## Logging
@@ -117,6 +125,7 @@ export PAID_ENABLED=false
117
125
  ```
118
126
 
119
127
  This is useful for:
128
+
120
129
  - Development/testing environments where tracing isn't needed
121
130
  - Temporarily disabling tracing without modifying code
122
131
  - Feature flagging in different deployment environments
@@ -178,11 +187,13 @@ Both approaches:
178
187
  - Support the same parameters: `external_customer_id`, `external_product_id`, `tracing_token`, `store_prompt`, `metadata`
179
188
 
180
189
  * Note - if it happens that you're calling `paid_tracing` from non-main thread, then it's advised to initialize from main thread:
190
+
181
191
  ```python
182
192
  from paid.tracing import initialize_tracing
183
193
  initialize_tracing()
184
194
  ```
185
- * `initialize_tracing` also accepts optional arguments like OTEL collector endpoint and api key if you want to reroute your tracing somewhere else :)
195
+
196
+ - `initialize_tracing` also accepts optional arguments like OTEL collector endpoint and api key if you want to reroute your tracing somewhere else :)
186
197
 
187
198
  ### Using the Paid wrappers
188
199
 
@@ -194,7 +205,6 @@ openai
194
205
  openai-agents (as a hook)
195
206
  anthropic
196
207
  langchain (as a hook)
197
- llamaindex
198
208
  bedrock (boto3)
199
209
  mistral
200
210
  gemini (google-genai)
@@ -265,6 +275,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
265
275
 
266
276
  process_event(incoming_event)
267
277
  ```
278
+
268
279
  </Tab>
269
280
 
270
281
  <Tab title="Python - Context Manager">
@@ -299,6 +310,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
299
310
  ):
300
311
  process_event(incoming_event)
301
312
  ```
313
+
302
314
  </Tab>
303
315
 
304
316
  <Tab title="Node.js">
@@ -340,7 +352,7 @@ from openai import OpenAI
340
352
  client = Paid(token="PAID_API_KEY")
341
353
  initialize_tracing()
342
354
 
343
- paid_autoinstrument() # instruments all available: anthropic, gemini, openai, openai-agents, bedrock, langchain
355
+ paid_autoinstrument() # instruments all available: anthropic, gemini, openai, openai-agents, bedrock, langchain, instructor
344
356
 
345
357
  # Now all OpenAI calls will be automatically traced
346
358
  openai_client = OpenAI(api_key="<OPENAI_API_KEY>")
@@ -367,6 +379,7 @@ openai - OpenAI Python SDK
367
379
  openai-agents - OpenAI Agents SDK
368
380
  bedrock - AWS Bedrock (boto3)
369
381
  langchain - LangChain framework
382
+ instructor - Instructor
370
383
  ```
371
384
 
372
385
  #### Selective Instrumentation
@@ -550,17 +563,17 @@ If you would prefer to not use Paid to track your costs automatically but you wa
550
563
  then you can use manual cost tracking mechanism. Just attach the cost information in the following format to a signal payload:
551
564
 
552
565
  ```python
553
- from paid import Paid, Signal
566
+ from paid import Paid, Signal, CustomerByExternalId, ProductByExternalId
554
567
 
555
568
  client = Paid(token="<PAID_API_KEY>")
556
569
 
557
570
  signal = Signal(
558
571
  event_name="<your_signal_name>",
559
- agent_id="<your_agent_id>",
560
- external_customer_id="<your_external_customer_id>",
561
- data = {
572
+ customer=CustomerByExternalId(external_customer_id="<your_external_customer_id>"),
573
+ attribution=ProductByExternalId(external_product_id="<your_external_product_id>"),
574
+ data={
562
575
  "costData": {
563
- "vendor": "<any_vendor_name>", # can be anything, traces are grouped by vendors in the UI
576
+ "vendor": "<any_vendor_name>", # can be anything, traces are grouped by vendors in the UI
564
577
  "cost": {
565
578
  "amount": 0.002,
566
579
  "currency": "USD"
@@ -570,7 +583,7 @@ signal = Signal(
570
583
  }
571
584
  )
572
585
 
573
- client.usage.record_bulk(signals=[signal])
586
+ client.signals.create_signals(signals=[signal])
574
587
  ```
575
588
 
576
589
  Alternatively the same `costData` payload can be passed to OTLP signaling mechanism:
@@ -603,17 +616,17 @@ do_work()
603
616
  If you would prefer to send us raw usage manually (without wrappers) and have us compute the cost, you can attach usage data in the following format:
604
617
 
605
618
  ```python
606
- from paid import Paid, Signal
619
+ from paid import Paid, Signal, CustomerByExternalId, ProductByExternalId
607
620
 
608
621
  client = Paid(token="<PAID_API_KEY>")
609
622
 
610
623
  signal = Signal(
611
624
  event_name="<your_signal_name>",
612
- agent_id="<your_agent_id>",
613
- external_customer_id="<your_external_customer_id>",
614
- data = {
625
+ customer=CustomerByExternalId(external_customer_id="<your_external_customer_id>"),
626
+ attribution=ProductByExternalId(external_product_id="<your_external_product_id>"),
627
+ data={
615
628
  "costData": {
616
- "vendor": "<any_vendor_name>", # can be anything, traces are grouped by vendors in the UI
629
+ "vendor": "<any_vendor_name>", # can be anything, traces are grouped by vendors in the UI
617
630
  "attributes": {
618
631
  "gen_ai.response.model": "gpt-4.1-mini",
619
632
  "gen_ai.usage.input_tokens": 100,
@@ -624,7 +637,7 @@ signal = Signal(
624
637
  }
625
638
  )
626
639
 
627
- client.usage.record_bulk(signals=[signal])
640
+ client.signals.create_signals(signals=[signal])
628
641
  ```
629
642
 
630
643
  Same but via OTEL signaling:
@@ -667,7 +680,7 @@ from paid import AsyncPaid
667
680
  client = AsyncPaid(token="API_KEY")
668
681
 
669
682
  # Async API calls
670
- customer = await client.customers.create(name="John Doe")
683
+ customer = await client.customers.create_customer(name="John Doe")
671
684
  ```
672
685
 
673
686
  ### Async Cost Tracking with Decorator
@@ -735,6 +748,7 @@ await do_work()
735
748
  ### Paid OTEL Tracer Provider
736
749
 
737
750
  If you would like to use the Paid OTEL tracer provider:
751
+
738
752
  ```python
739
753
  from paid.tracing import get_paid_tracer_provider
740
754
  paid_tracer_provider = get_paid_tracer_provider()
@@ -3,7 +3,7 @@ name = "paid-python"
3
3
 
4
4
  [tool.poetry]
5
5
  name = "paid-python"
6
- version = "0.6.0"
6
+ version = "1.0.0"
7
7
  description = ""
8
8
  readme = "README.md"
9
9
  authors = []
@@ -13,6 +13,7 @@ classifiers = [
13
13
  "Intended Audience :: Developers",
14
14
  "Programming Language :: Python",
15
15
  "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.8",
16
17
  "Programming Language :: Python :: 3.9",
17
18
  "Programming Language :: Python :: 3.10",
18
19
  "Programming Language :: Python :: 3.11",
@@ -26,8 +27,7 @@ classifiers = [
26
27
  "Typing :: Typed"
27
28
  ]
28
29
  packages = [
29
- { include = "paid", from = "src"},
30
- { include = "opentelemetry", from = "vendor/patched-instrumentation-openllmetry/packages/opentelemetry-instrumentation-openai" },
30
+ { include = "paid", from = "src"}
31
31
  ]
32
32
 
33
33
  [project.urls]
@@ -35,21 +35,22 @@ Repository = 'https://github.com/paid-ai/paid-python'
35
35
 
36
36
  [tool.poetry.dependencies]
37
37
  python = ">=3.9,<3.14"
38
- httpx = ">=0.21.0"
39
- pydantic = ">=1.9.0"
40
- pydantic-core = ">=2.18.0"
41
- typing_extensions = ">= 4.0.0"
42
- opentelemetry-api = ">=1.23.0"
43
- opentelemetry-sdk = ">=1.23.0"
44
- opentelemetry-exporter-otlp-proto-http = ">=1.23.0"
38
+ httpx = ">=0.21.2"
45
39
  mutagen = ">=1.47.0"
46
- python-dotenv = ">=0.15.0"
47
- opentelemetry-instrumentation-anthropic = ">=0.47.0"
48
- # opentelemetry-instrumentation-openai is vendored from git a submodule under vendor/patched-instrumentation-openllmetry
49
- openinference-instrumentation-langchain = ">=0.1.55"
50
- openinference-instrumentation-openai-agents = ">=1.0.0"
51
40
  openinference-instrumentation-bedrock = ">=0.1.0"
52
41
  openinference-instrumentation-google-genai = ">=0.1.8"
42
+ openinference-instrumentation-instructor = ">=0.1.0"
43
+ openinference-instrumentation-langchain = ">=0.1.55"
44
+ openinference-instrumentation-openai = ">=0.1.40"
45
+ openinference-instrumentation-openai-agents = ">=1.0.0"
46
+ opentelemetry-api = ">=1.23.0"
47
+ opentelemetry-exporter-otlp-proto-http = ">=1.23.0"
48
+ opentelemetry-instrumentation-anthropic = ">=0.47.0"
49
+ opentelemetry-sdk = ">=1.23.0"
50
+ pydantic = ">= 1.9.2"
51
+ pydantic-core = "^2.18.2"
52
+ python-dotenv = ">=0.15.0"
53
+ typing_extensions = ">= 4.0.0"
53
54
 
54
55
  [tool.poetry.group.dev.dependencies]
55
56
  mypy = "==1.13.0"
@@ -57,48 +58,21 @@ pytest = "^7.4.0"
57
58
  pytest-asyncio = "^0.23.5"
58
59
  python-dateutil = "^2.9.0"
59
60
  types-python-dateutil = "^2.9.0.20240316"
60
- ruff = "==0.11.5"
61
-
62
- # Peer-dependencies, but useful to have for development
63
- mistralai = ">=1.9.0"
64
61
  anthropic = ">=0.57.0"
65
- llama-index-core = ">=0.13.0"
66
- llama-index-llms-openai = ">=0.5.0"
67
62
  google-genai = ">=1.19.0"
68
- openai-agents = ">=0.2.0"
63
+ instructor = ">=1.0.0"
69
64
  langchain-core = ">=0.1.0"
65
+ mistralai = ">=1.9.0"
70
66
  openai = ">=1.12.0"
67
+ openai-agents = ">=0.2.0"
68
+ ruff = "==0.11.5"
71
69
 
72
70
  [tool.pytest.ini_options]
73
71
  testpaths = [ "tests" ]
74
72
  asyncio_mode = "auto"
75
- # TODO(Ata): remove this once the openai instrumentation isn't vendored anymore
76
- norecursedirs = ["vendor/patched-instrumentation-openllmetry"]
77
73
 
78
74
  [tool.mypy]
79
75
  plugins = ["pydantic.mypy"]
80
- exclude = [
81
- # TODO(Ata): remove this once the openai instrumentation isn't vendored anymore
82
- "^vendor/patched-instrumentation-openllmetry/",
83
- ]
84
-
85
- [[tool.mypy.overrides]]
86
- module = [
87
- "anthropic",
88
- "anthropic.*",
89
- "openai",
90
- "mistralai",
91
- "mistralai.*",
92
- "llama_index.*",
93
- "google.*",
94
- "agents",
95
- "agents.*",
96
- "langchain_core.*",
97
- "opentelemetry.instrumentation.openai", # TODO(Ata): remove this once the openai instrumentation isn't vendored anymore
98
- "opentelemetry.instrumentation.openai.*",
99
- ]
100
- ignore_missing_imports = true
101
- ignore_errors = true # remove once openai instrumentor is upstream
102
76
 
103
77
  [tool.ruff]
104
78
  line-length = 120
@@ -0,0 +1,102 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .types import (
6
+ Attribution,
7
+ BulkSignalsResponse,
8
+ Contact,
9
+ ContactBillingAddress,
10
+ ContactListResponse,
11
+ Customer,
12
+ CustomerAttribution,
13
+ CustomerBillingAddress,
14
+ CustomerByExternalId,
15
+ CustomerById,
16
+ CustomerCreationState,
17
+ CustomerListResponse,
18
+ EmptyResponse,
19
+ ErrorResponse,
20
+ Invoice,
21
+ InvoiceLine,
22
+ InvoiceLinePaymentStatus,
23
+ InvoiceLinesResponse,
24
+ InvoiceListResponse,
25
+ InvoicePaymentStatus,
26
+ InvoiceSource,
27
+ InvoiceStatus,
28
+ InvoiceTaxStatus,
29
+ Order,
30
+ OrderCreationState,
31
+ OrderLine,
32
+ OrderLinesResponse,
33
+ OrderListResponse,
34
+ Pagination,
35
+ Product,
36
+ ProductByExternalId,
37
+ ProductById,
38
+ ProductListResponse,
39
+ Signal,
40
+ UpdateContactRequest,
41
+ UpdateCustomerRequest,
42
+ UpdateProductRequest,
43
+ )
44
+ from .errors import BadRequestError, ForbiddenError, InternalServerError, NotFoundError
45
+ from . import contacts, customers, invoices, orders, products, signals
46
+ from .client import AsyncPaid, Paid
47
+ from .environment import PaidEnvironment
48
+ from .version import __version__
49
+
50
+ __all__ = [
51
+ "AsyncPaid",
52
+ "Attribution",
53
+ "BadRequestError",
54
+ "BulkSignalsResponse",
55
+ "Contact",
56
+ "ContactBillingAddress",
57
+ "ContactListResponse",
58
+ "Customer",
59
+ "CustomerAttribution",
60
+ "CustomerBillingAddress",
61
+ "CustomerByExternalId",
62
+ "CustomerById",
63
+ "CustomerCreationState",
64
+ "CustomerListResponse",
65
+ "EmptyResponse",
66
+ "ErrorResponse",
67
+ "ForbiddenError",
68
+ "InternalServerError",
69
+ "Invoice",
70
+ "InvoiceLine",
71
+ "InvoiceLinePaymentStatus",
72
+ "InvoiceLinesResponse",
73
+ "InvoiceListResponse",
74
+ "InvoicePaymentStatus",
75
+ "InvoiceSource",
76
+ "InvoiceStatus",
77
+ "InvoiceTaxStatus",
78
+ "NotFoundError",
79
+ "Order",
80
+ "OrderCreationState",
81
+ "OrderLine",
82
+ "OrderLinesResponse",
83
+ "OrderListResponse",
84
+ "Pagination",
85
+ "Paid",
86
+ "PaidEnvironment",
87
+ "Product",
88
+ "ProductByExternalId",
89
+ "ProductById",
90
+ "ProductListResponse",
91
+ "Signal",
92
+ "UpdateContactRequest",
93
+ "UpdateCustomerRequest",
94
+ "UpdateProductRequest",
95
+ "__version__",
96
+ "contacts",
97
+ "customers",
98
+ "invoices",
99
+ "orders",
100
+ "products",
101
+ "signals",
102
+ ]