crbonfree 0.1.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.
- crbonfree-0.1.0/.github/workflows/ci.yml +25 -0
- crbonfree-0.1.0/.github/workflows/publish.yml +72 -0
- crbonfree-0.1.0/.github/workflows/sync-spec.yml +56 -0
- crbonfree-0.1.0/.gitignore +43 -0
- crbonfree-0.1.0/LICENSE +21 -0
- crbonfree-0.1.0/PKG-INFO +151 -0
- crbonfree-0.1.0/README.md +119 -0
- crbonfree-0.1.0/examples/quickstart.py +35 -0
- crbonfree-0.1.0/fern/fern.config.json +4 -0
- crbonfree-0.1.0/fern/generators.yml +16 -0
- crbonfree-0.1.0/fern/openapi/openapi.json +8302 -0
- crbonfree-0.1.0/pyproject.toml +57 -0
- crbonfree-0.1.0/scripts/apply_fern_extensions.py +71 -0
- crbonfree-0.1.0/src/crbonfree/.fern/metadata.json +16 -0
- crbonfree-0.1.0/src/crbonfree/CONTRIBUTING.md +125 -0
- crbonfree-0.1.0/src/crbonfree/__init__.py +520 -0
- crbonfree-0.1.0/src/crbonfree/_default_clients.py +30 -0
- crbonfree-0.1.0/src/crbonfree/apikeys/__init__.py +52 -0
- crbonfree-0.1.0/src/crbonfree/apikeys/client.py +259 -0
- crbonfree-0.1.0/src/crbonfree/apikeys/raw_client.py +616 -0
- crbonfree-0.1.0/src/crbonfree/apikeys/types/__init__.py +50 -0
- crbonfree-0.1.0/src/crbonfree/apikeys/types/api_keys_create_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/apikeys/types/api_keys_list_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/apikeys/types/api_keys_list_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/apikeys/types/api_keys_revoke_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/apikeys/types/api_keys_revoke_response_data.py +17 -0
- crbonfree-0.1.0/src/crbonfree/auth/__init__.py +61 -0
- crbonfree-0.1.0/src/crbonfree/auth/client.py +411 -0
- crbonfree-0.1.0/src/crbonfree/auth/raw_client.py +895 -0
- crbonfree-0.1.0/src/crbonfree/auth/types/__init__.py +59 -0
- crbonfree-0.1.0/src/crbonfree/auth/types/auth_me_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/auth/types/auth_me_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/auth/types/auth_register_request_account_type.py +5 -0
- crbonfree-0.1.0/src/crbonfree/auth/types/auth_register_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/auth/types/auth_register_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/auth/types/delete_account_auth_response.py +13 -0
- crbonfree-0.1.0/src/crbonfree/auth/types/update_profile_auth_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/auth/types/update_profile_auth_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/billing/__init__.py +115 -0
- crbonfree-0.1.0/src/crbonfree/billing/client.py +955 -0
- crbonfree-0.1.0/src/crbonfree/billing/raw_client.py +2565 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/__init__.py +115 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/generate_audit_pack_billing_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/generate_audit_pack_billing_response_data.py +17 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_audit_pack_billing_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_audit_pack_billing_response_data.py +17 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_current_period_billing_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_current_period_billing_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_overage_billing_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_overage_billing_response_data.py +17 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_plan_tier_billing_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_plan_tier_billing_response_data.py +17 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_plan_tier_billing_response_data_plan_tier.py +7 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_receipt_billing_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_receipt_billing_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_trust_assets_billing_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/get_trust_assets_billing_response_data.py +18 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/list_audit_packs_billing_response.py +16 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/list_overages_billing_response.py +16 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/list_periods_billing_response.py +16 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/list_receipts_billing_response.py +16 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/set_plan_tier_billing_request_tier.py +5 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/set_plan_tier_billing_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/set_plan_tier_billing_response_data.py +27 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/set_plan_tier_billing_response_data_current_tier.py +7 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/set_plan_tier_billing_response_data_previous_tier.py +7 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/set_plan_tier_billing_response_data_subscription.py +34 -0
- crbonfree-0.1.0/src/crbonfree/billing/types/set_plan_tier_billing_response_data_subscription_status.py +7 -0
- crbonfree-0.1.0/src/crbonfree/client.py +358 -0
- crbonfree-0.1.0/src/crbonfree/connections/__init__.py +91 -0
- crbonfree-0.1.0/src/crbonfree/connections/client.py +488 -0
- crbonfree-0.1.0/src/crbonfree/connections/raw_client.py +1307 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/__init__.py +91 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/connections_create_request.py +70 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/connections_create_request_anthropic.py +17 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/connections_create_request_bedrock.py +26 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/connections_create_request_openai.py +17 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/connections_create_request_openrouter.py +17 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/connections_create_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/connections_create_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/connections_get_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/connections_get_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/connections_list_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/connections_list_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/connections_sync_response.py +12 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/update_project_connections_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/connections/types/update_project_connections_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/core/__init__.py +127 -0
- crbonfree-0.1.0/src/crbonfree/core/api_error.py +23 -0
- crbonfree-0.1.0/src/crbonfree/core/client_wrapper.py +135 -0
- crbonfree-0.1.0/src/crbonfree/core/datetime_utils.py +70 -0
- crbonfree-0.1.0/src/crbonfree/core/file.py +67 -0
- crbonfree-0.1.0/src/crbonfree/core/force_multipart.py +18 -0
- crbonfree-0.1.0/src/crbonfree/core/http_client.py +839 -0
- crbonfree-0.1.0/src/crbonfree/core/http_response.py +59 -0
- crbonfree-0.1.0/src/crbonfree/core/http_sse/__init__.py +42 -0
- crbonfree-0.1.0/src/crbonfree/core/http_sse/_api.py +148 -0
- crbonfree-0.1.0/src/crbonfree/core/http_sse/_decoders.py +61 -0
- crbonfree-0.1.0/src/crbonfree/core/http_sse/_exceptions.py +7 -0
- crbonfree-0.1.0/src/crbonfree/core/http_sse/_models.py +17 -0
- crbonfree-0.1.0/src/crbonfree/core/jsonable_encoder.py +120 -0
- crbonfree-0.1.0/src/crbonfree/core/logging.py +107 -0
- crbonfree-0.1.0/src/crbonfree/core/parse_error.py +36 -0
- crbonfree-0.1.0/src/crbonfree/core/pydantic_utilities.py +508 -0
- crbonfree-0.1.0/src/crbonfree/core/query_encoder.py +58 -0
- crbonfree-0.1.0/src/crbonfree/core/remove_none_from_dict.py +11 -0
- crbonfree-0.1.0/src/crbonfree/core/request_options.py +35 -0
- crbonfree-0.1.0/src/crbonfree/core/serialization.py +347 -0
- crbonfree-0.1.0/src/crbonfree/environment.py +7 -0
- crbonfree-0.1.0/src/crbonfree/errors/__init__.py +62 -0
- crbonfree-0.1.0/src/crbonfree/errors/bad_request_error.py +11 -0
- crbonfree-0.1.0/src/crbonfree/errors/conflict_error.py +11 -0
- crbonfree-0.1.0/src/crbonfree/errors/forbidden_error.py +11 -0
- crbonfree-0.1.0/src/crbonfree/errors/internal_server_error.py +11 -0
- crbonfree-0.1.0/src/crbonfree/errors/not_found_error.py +11 -0
- crbonfree-0.1.0/src/crbonfree/errors/payment_required_error.py +11 -0
- crbonfree-0.1.0/src/crbonfree/errors/service_unavailable_error.py +10 -0
- crbonfree-0.1.0/src/crbonfree/errors/too_many_requests_error.py +11 -0
- crbonfree-0.1.0/src/crbonfree/errors/unauthorized_error.py +11 -0
- crbonfree-0.1.0/src/crbonfree/projects/__init__.py +67 -0
- crbonfree-0.1.0/src/crbonfree/projects/client.py +419 -0
- crbonfree-0.1.0/src/crbonfree/projects/raw_client.py +1131 -0
- crbonfree-0.1.0/src/crbonfree/projects/types/__init__.py +65 -0
- crbonfree-0.1.0/src/crbonfree/projects/types/projects_create_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/projects/types/projects_create_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/projects/types/projects_get_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/projects/types/projects_get_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/projects/types/projects_list_request_include.py +5 -0
- crbonfree-0.1.0/src/crbonfree/projects/types/projects_list_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/projects/types/projects_list_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/projects/types/projects_list_response_data_projects.py +8 -0
- crbonfree-0.1.0/src/crbonfree/projects/types/projects_update_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/projects/types/projects_update_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/reference.md +3429 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/__init__.py +79 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/client.py +527 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/raw_client.py +1359 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/__init__.py +77 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/create_setup_intent_subscriptions_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/create_setup_intent_subscriptions_response_data.py +16 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/get_estimate_subscriptions_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/get_estimate_subscriptions_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/get_payment_method_subscriptions_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/get_payment_method_subscriptions_response_data.py +19 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/remove_payment_method_subscriptions_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/remove_payment_method_subscriptions_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/save_payment_method_subscriptions_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/save_payment_method_subscriptions_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/subscriptions_get_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/subscriptions_get_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/update_cap_subscriptions_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/subscriptions/types/update_cap_subscriptions_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/telemetry/__init__.py +49 -0
- crbonfree-0.1.0/src/crbonfree/telemetry/client.py +326 -0
- crbonfree-0.1.0/src/crbonfree/telemetry/raw_client.py +632 -0
- crbonfree-0.1.0/src/crbonfree/telemetry/types/__init__.py +47 -0
- crbonfree-0.1.0/src/crbonfree/telemetry/types/get_summary_telemetry_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/telemetry/types/list_events_telemetry_response.py +16 -0
- crbonfree-0.1.0/src/crbonfree/telemetry/types/list_models_telemetry_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/telemetry/types/list_models_telemetry_response_data.py +13 -0
- crbonfree-0.1.0/src/crbonfree/tests/conftest.py +21 -0
- crbonfree-0.1.0/src/crbonfree/tests/test_aiohttp_autodetect.py +113 -0
- crbonfree-0.1.0/src/crbonfree/types/__init__.py +164 -0
- crbonfree-0.1.0/src/crbonfree/types/api_key_public.py +32 -0
- crbonfree-0.1.0/src/crbonfree/types/audit_pack.py +41 -0
- crbonfree-0.1.0/src/crbonfree/types/billing_period.py +65 -0
- crbonfree-0.1.0/src/crbonfree/types/billing_period_failure_reason.py +7 -0
- crbonfree-0.1.0/src/crbonfree/types/billing_period_plan_tier_at_close.py +7 -0
- crbonfree-0.1.0/src/crbonfree/types/billing_period_status.py +7 -0
- crbonfree-0.1.0/src/crbonfree/types/billing_period_totals.py +35 -0
- crbonfree-0.1.0/src/crbonfree/types/carbon_receipt.py +41 -0
- crbonfree-0.1.0/src/crbonfree/types/carbon_receipt_serial_allocations_item.py +19 -0
- crbonfree-0.1.0/src/crbonfree/types/created_api_key.py +25 -0
- crbonfree-0.1.0/src/crbonfree/types/daily_usage_export_row.py +20 -0
- crbonfree-0.1.0/src/crbonfree/types/daily_usage_row.py +32 -0
- crbonfree-0.1.0/src/crbonfree/types/error_response.py +20 -0
- crbonfree-0.1.0/src/crbonfree/types/invoice_public.py +36 -0
- crbonfree-0.1.0/src/crbonfree/types/overage_charge.py +45 -0
- crbonfree-0.1.0/src/crbonfree/types/overage_charge_plan_tier_at_close.py +7 -0
- crbonfree-0.1.0/src/crbonfree/types/overage_charge_status.py +5 -0
- crbonfree-0.1.0/src/crbonfree/types/pagination_meta.py +17 -0
- crbonfree-0.1.0/src/crbonfree/types/payment_method_public.py +21 -0
- crbonfree-0.1.0/src/crbonfree/types/project_public.py +23 -0
- crbonfree-0.1.0/src/crbonfree/types/project_with_usage.py +19 -0
- crbonfree-0.1.0/src/crbonfree/types/provider_connection.py +42 -0
- crbonfree-0.1.0/src/crbonfree/types/provider_connection_provider.py +5 -0
- crbonfree-0.1.0/src/crbonfree/types/provider_connection_status.py +7 -0
- crbonfree-0.1.0/src/crbonfree/types/subscription.py +34 -0
- crbonfree-0.1.0/src/crbonfree/types/subscription_estimate.py +23 -0
- crbonfree-0.1.0/src/crbonfree/types/subscription_status.py +7 -0
- crbonfree-0.1.0/src/crbonfree/types/telemetry_event.py +37 -0
- crbonfree-0.1.0/src/crbonfree/types/telemetry_event_calculation.py +17 -0
- crbonfree-0.1.0/src/crbonfree/types/telemetry_model.py +22 -0
- crbonfree-0.1.0/src/crbonfree/types/telemetry_summary.py +32 -0
- crbonfree-0.1.0/src/crbonfree/types/telemetry_summary_cached_vs_uncached.py +19 -0
- crbonfree-0.1.0/src/crbonfree/types/telemetry_summary_daily_chart_item.py +16 -0
- crbonfree-0.1.0/src/crbonfree/types/telemetry_summary_per_model_item.py +17 -0
- crbonfree-0.1.0/src/crbonfree/types/telemetry_summary_period.py +13 -0
- crbonfree-0.1.0/src/crbonfree/types/usage_breakdown_item.py +35 -0
- crbonfree-0.1.0/src/crbonfree/types/usage_summary.py +17 -0
- crbonfree-0.1.0/src/crbonfree/types/usage_summary_chart.py +14 -0
- crbonfree-0.1.0/src/crbonfree/types/usage_summary_chart_datasets_item.py +13 -0
- crbonfree-0.1.0/src/crbonfree/types/usage_summary_range.py +13 -0
- crbonfree-0.1.0/src/crbonfree/types/usage_summary_totals.py +35 -0
- crbonfree-0.1.0/src/crbonfree/types/user_public.py +27 -0
- crbonfree-0.1.0/src/crbonfree/types/user_public_account_type.py +5 -0
- crbonfree-0.1.0/src/crbonfree/usage/__init__.py +61 -0
- crbonfree-0.1.0/src/crbonfree/usage/client.py +458 -0
- crbonfree-0.1.0/src/crbonfree/usage/raw_client.py +860 -0
- crbonfree-0.1.0/src/crbonfree/usage/types/__init__.py +59 -0
- crbonfree-0.1.0/src/crbonfree/usage/types/export_daily_usage_request_format.py +5 -0
- crbonfree-0.1.0/src/crbonfree/usage/types/export_daily_usage_request_range.py +5 -0
- crbonfree-0.1.0/src/crbonfree/usage/types/get_breakdown_usage_request_range.py +5 -0
- crbonfree-0.1.0/src/crbonfree/usage/types/get_breakdown_usage_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/usage/types/get_daily_usage_request_range.py +5 -0
- crbonfree-0.1.0/src/crbonfree/usage/types/get_daily_usage_response.py +14 -0
- crbonfree-0.1.0/src/crbonfree/usage/types/get_summary_usage_request_range.py +5 -0
- crbonfree-0.1.0/src/crbonfree/usage/types/get_summary_usage_response.py +14 -0
- crbonfree-0.1.0/tests/__init__.py +0 -0
- crbonfree-0.1.0/tests/test_smoke.py +47 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- uses: actions/setup-python@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: '3.x'
|
|
17
|
+
|
|
18
|
+
- name: Install package with dev extras
|
|
19
|
+
run: pip install -e ".[dev]"
|
|
20
|
+
|
|
21
|
+
- name: Lint
|
|
22
|
+
run: python -m ruff check
|
|
23
|
+
|
|
24
|
+
- name: Test
|
|
25
|
+
run: python -m pytest
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ['v*']
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
id-token: write # required for PyPI Trusted Publishing (OIDC)
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: '3.x'
|
|
22
|
+
|
|
23
|
+
- name: Guard — generated client must be present
|
|
24
|
+
# src/crbonfree/__init__.py ships as a placeholder before the first
|
|
25
|
+
# generation, so an empty-dir check isn't enough — require real
|
|
26
|
+
# generated modules (any .py beyond __init__.py) before publishing.
|
|
27
|
+
run: |
|
|
28
|
+
generated=$(find src/crbonfree -name '*.py' ! -name '__init__.py' | head -1)
|
|
29
|
+
if [ -z "$generated" ]; then
|
|
30
|
+
echo "::error::src/crbonfree/ contains only the placeholder __init__.py. The generated client is produced by sync-spec.yml and merged before tagging a release. Refusing to publish an empty package."
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
- name: Install build dependencies
|
|
35
|
+
run: pip install build
|
|
36
|
+
|
|
37
|
+
- name: Install package with dev extras
|
|
38
|
+
run: pip install -e ".[dev]"
|
|
39
|
+
|
|
40
|
+
- name: Set version from tag
|
|
41
|
+
run: |
|
|
42
|
+
VERSION="${GITHUB_REF#refs/tags/v}"
|
|
43
|
+
python - "$VERSION" <<'EOF'
|
|
44
|
+
import re, sys
|
|
45
|
+
version = sys.argv[1]
|
|
46
|
+
path = "pyproject.toml"
|
|
47
|
+
with open(path, "r", encoding="utf-8") as f:
|
|
48
|
+
content = f.read()
|
|
49
|
+
new_content, count = re.subn(
|
|
50
|
+
r'(?m)^(version\s*=\s*)"[^"]*"',
|
|
51
|
+
r'\g<1>"%s"' % version,
|
|
52
|
+
content,
|
|
53
|
+
count=1,
|
|
54
|
+
)
|
|
55
|
+
if count == 0:
|
|
56
|
+
sys.exit(
|
|
57
|
+
"Could not find a `version = \"...\"` line under [project] in "
|
|
58
|
+
"pyproject.toml. The version field must be a static string."
|
|
59
|
+
)
|
|
60
|
+
with open(path, "w", encoding="utf-8") as f:
|
|
61
|
+
f.write(new_content)
|
|
62
|
+
print("Set version to %s" % version)
|
|
63
|
+
EOF
|
|
64
|
+
|
|
65
|
+
- name: Build distribution
|
|
66
|
+
run: python -m build
|
|
67
|
+
|
|
68
|
+
- name: Test
|
|
69
|
+
run: python -m pytest
|
|
70
|
+
|
|
71
|
+
- name: Publish to PyPI
|
|
72
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Sync OpenAPI spec
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: '0 6 * * *' # daily 06:00 UTC
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
sync:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
pull-requests: write
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: '3.x'
|
|
20
|
+
|
|
21
|
+
- uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: '22'
|
|
24
|
+
|
|
25
|
+
- name: Download latest backend spec
|
|
26
|
+
# carbon-offset-backend is a PRIVATE repo, so the default GITHUB_TOKEN
|
|
27
|
+
# (scoped to THIS repo) can't read its releases. Use a dedicated
|
|
28
|
+
# fine-grained PAT with read access to that repo's contents, stored as
|
|
29
|
+
# the BACKEND_SPEC_TOKEN secret. `gh release download` handles the
|
|
30
|
+
# asset redirect + auth correctly (no token leaked into argv).
|
|
31
|
+
env:
|
|
32
|
+
GH_TOKEN: ${{ secrets.BACKEND_SPEC_TOKEN }}
|
|
33
|
+
run: |
|
|
34
|
+
gh release download openapi-latest \
|
|
35
|
+
--repo Crbon-Labs-Inc/carbon-offset-backend \
|
|
36
|
+
--pattern 'openapi.json' \
|
|
37
|
+
--output fern/openapi/openapi.json \
|
|
38
|
+
--clobber
|
|
39
|
+
|
|
40
|
+
- name: Re-apply Fern SDK extensions
|
|
41
|
+
run: python scripts/apply_fern_extensions.py
|
|
42
|
+
|
|
43
|
+
- name: Install Fern CLI
|
|
44
|
+
run: npm install -g fern-api@5.37.0
|
|
45
|
+
|
|
46
|
+
- name: Regenerate SDK
|
|
47
|
+
run: fern generate --group python-sdk --local
|
|
48
|
+
|
|
49
|
+
- name: Open PR if changed
|
|
50
|
+
uses: peter-evans/create-pull-request@v6
|
|
51
|
+
with:
|
|
52
|
+
title: 'chore: sync OpenAPI spec from backend'
|
|
53
|
+
branch: spec-sync/${{ github.run_id }}
|
|
54
|
+
commit-message: 'chore: regenerate SDK from latest backend spec'
|
|
55
|
+
body: 'Automated daily spec sync. Review the diff and merge if CI passes.'
|
|
56
|
+
delete-branch: true
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Byte-compiled / optimized / cache
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Distribution / packaging
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
*.egg
|
|
11
|
+
.eggs/
|
|
12
|
+
wheels/
|
|
13
|
+
|
|
14
|
+
# Virtual environments
|
|
15
|
+
.venv/
|
|
16
|
+
venv/
|
|
17
|
+
env/
|
|
18
|
+
|
|
19
|
+
# Tooling caches
|
|
20
|
+
.pytest_cache/
|
|
21
|
+
.ruff_cache/
|
|
22
|
+
.mypy_cache/
|
|
23
|
+
.tox/
|
|
24
|
+
.cache/
|
|
25
|
+
|
|
26
|
+
# Coverage
|
|
27
|
+
.coverage
|
|
28
|
+
.coverage.*
|
|
29
|
+
htmlcov/
|
|
30
|
+
coverage.xml
|
|
31
|
+
|
|
32
|
+
# Editors / OS
|
|
33
|
+
.idea/
|
|
34
|
+
.vscode/
|
|
35
|
+
*.swp
|
|
36
|
+
.DS_Store
|
|
37
|
+
|
|
38
|
+
# NOTE: src/crbonfree/ is Fern-generated but COMMITTED — do not ignore it.
|
|
39
|
+
# Fern's local-file-system output drops package-level metadata (its own
|
|
40
|
+
# pyproject/README) alongside the client; our root pyproject.toml is
|
|
41
|
+
# authoritative, so don't commit the generated duplicates.
|
|
42
|
+
src/crbonfree/pyproject.toml
|
|
43
|
+
src/crbonfree/README.md
|
crbonfree-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Crbon Labs Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
crbonfree-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: crbonfree
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for the CrbonFree carbon-offset API
|
|
5
|
+
Project-URL: Homepage, https://crbonfree.com
|
|
6
|
+
Project-URL: Repository, https://github.com/Crbon-Labs-Inc/crbonfree-python-sdk
|
|
7
|
+
Project-URL: Issues, https://github.com/Crbon-Labs-Inc/crbonfree-python-sdk/issues
|
|
8
|
+
Author: Crbon Labs Inc.
|
|
9
|
+
Author-email: CrbonFree <support@crbonfree.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: ai,carbon,crbonfree,emissions,offset,sdk
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Requires-Dist: httpx>=0.23
|
|
26
|
+
Requires-Dist: pydantic>=2
|
|
27
|
+
Requires-Dist: typing-extensions>=4.0.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
<p align="center">
|
|
34
|
+
<strong>crbonfree</strong>
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
Measure and offset the carbon footprint of your AI workloads.<br />
|
|
39
|
+
One SDK. Every major provider. Verified retirement receipts.
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
<p align="center">
|
|
43
|
+
<a href="https://pypi.org/project/crbonfree/"><img src="https://img.shields.io/pypi/v/crbonfree.svg?style=flat-square" alt="PyPI" /></a>
|
|
44
|
+
<a href="https://github.com/Crbon-Labs-Inc/crbonfree-python-sdk/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="MIT" /></a>
|
|
45
|
+
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/Python-3.8+-3776ab.svg?style=flat-square&logo=python&logoColor=white" alt="Python" /></a>
|
|
46
|
+
<a href="https://beta.crbonfree.com"><img src="https://img.shields.io/badge/CrbonFree-beta-047857.svg?style=flat-square" alt="CrbonFree" /></a>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
<br />
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install crbonfree
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## What is CrbonFree?
|
|
56
|
+
|
|
57
|
+
CrbonFree meters the carbon emissions of your AI inference and turns them into
|
|
58
|
+
verifiable offsets. Connect your provider accounts, and we measure the
|
|
59
|
+
inference, give you the emissions data, and issue signed carbon retirement
|
|
60
|
+
receipts you can hand to auditors.
|
|
61
|
+
|
|
62
|
+
Works with **OpenAI, Anthropic, OpenRouter, AWS Bedrock, and growing.**
|
|
63
|
+
|
|
64
|
+
## Quickstart
|
|
65
|
+
|
|
66
|
+
### Authenticate with an API key
|
|
67
|
+
|
|
68
|
+
Pass your key directly to the client:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from crbonfree import CrbonFree
|
|
72
|
+
|
|
73
|
+
crbon = CrbonFree(api_key="ck_live_...")
|
|
74
|
+
|
|
75
|
+
summary = crbon.telemetry.get_summary()
|
|
76
|
+
print(f"{summary.data.total_co2_kg} kg CO2 from your AI usage")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Or read it from the environment
|
|
80
|
+
|
|
81
|
+
Keep the key out of your source by reading it from `CRBONFREE_API_KEY`:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
export CRBONFREE_API_KEY="ck_live_..."
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
import os
|
|
89
|
+
from crbonfree import CrbonFree
|
|
90
|
+
|
|
91
|
+
crbon = CrbonFree(api_key=os.environ["CRBONFREE_API_KEY"])
|
|
92
|
+
|
|
93
|
+
summary = crbon.telemetry.get_summary()
|
|
94
|
+
print(f"{summary.data.total_co2_kg} kg CO2 from your AI usage")
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The API key is sent on every request as the `X-API-Key` header.
|
|
98
|
+
|
|
99
|
+
### Async
|
|
100
|
+
|
|
101
|
+
An async client ships alongside the sync one:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
import asyncio
|
|
105
|
+
from crbonfree import AsyncCrbonFree
|
|
106
|
+
|
|
107
|
+
async def main():
|
|
108
|
+
crbon = AsyncCrbonFree(api_key="ck_live_...")
|
|
109
|
+
summary = await crbon.telemetry.get_summary()
|
|
110
|
+
print(f"{summary.data.total_co2_kg} kg CO2 from your AI usage")
|
|
111
|
+
|
|
112
|
+
asyncio.run(main())
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## What you can do
|
|
116
|
+
|
|
117
|
+
| | Method | What it returns |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| **Measure** | `crbon.telemetry.get_summary()` | Total CO2, per-model rollups, daily chart |
|
|
120
|
+
| **Analyze** | `crbon.usage.get_breakdown()` | Which models cost the most carbon |
|
|
121
|
+
| **Organize** | `crbon.projects.list()` | Track emissions by project / team |
|
|
122
|
+
| **Prove** | `crbon.billing.list_receipts()` | Signed carbon retirement receipts |
|
|
123
|
+
| **Audit** | `crbon.billing.list_audit_packs()` | CSRD-ready compliance artifacts |
|
|
124
|
+
| **Manage** | `crbon.apikeys.create()` | Programmatic API key management |
|
|
125
|
+
|
|
126
|
+
## Pagination
|
|
127
|
+
|
|
128
|
+
Listing endpoints accept `page` and `limit` parameters directly:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
receipts = crbon.billing.list_receipts(page=1, limit=20)
|
|
132
|
+
for receipt in receipts.data:
|
|
133
|
+
print(receipt.serial_number)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## What's next
|
|
137
|
+
|
|
138
|
+
Ergonomic auto-pagination helpers and a `crbonfree login` CLI for
|
|
139
|
+
zero-config, browser-based authentication are coming in a fast-follow release.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
<p align="center">
|
|
144
|
+
<a href="https://beta.crbonfree.com">Dashboard</a> ·
|
|
145
|
+
<a href="https://github.com/Crbon-Labs-Inc/crbonfree-python-sdk/issues">Issues</a> ·
|
|
146
|
+
<a href="https://crbonfree.com">Website</a>
|
|
147
|
+
</p>
|
|
148
|
+
|
|
149
|
+
<p align="center">
|
|
150
|
+
<sub>MIT — Crbon Labs Inc.</sub>
|
|
151
|
+
</p>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<strong>crbonfree</strong>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
Measure and offset the carbon footprint of your AI workloads.<br />
|
|
7
|
+
One SDK. Every major provider. Verified retirement receipts.
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<a href="https://pypi.org/project/crbonfree/"><img src="https://img.shields.io/pypi/v/crbonfree.svg?style=flat-square" alt="PyPI" /></a>
|
|
12
|
+
<a href="https://github.com/Crbon-Labs-Inc/crbonfree-python-sdk/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="MIT" /></a>
|
|
13
|
+
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/Python-3.8+-3776ab.svg?style=flat-square&logo=python&logoColor=white" alt="Python" /></a>
|
|
14
|
+
<a href="https://beta.crbonfree.com"><img src="https://img.shields.io/badge/CrbonFree-beta-047857.svg?style=flat-square" alt="CrbonFree" /></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<br />
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install crbonfree
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## What is CrbonFree?
|
|
24
|
+
|
|
25
|
+
CrbonFree meters the carbon emissions of your AI inference and turns them into
|
|
26
|
+
verifiable offsets. Connect your provider accounts, and we measure the
|
|
27
|
+
inference, give you the emissions data, and issue signed carbon retirement
|
|
28
|
+
receipts you can hand to auditors.
|
|
29
|
+
|
|
30
|
+
Works with **OpenAI, Anthropic, OpenRouter, AWS Bedrock, and growing.**
|
|
31
|
+
|
|
32
|
+
## Quickstart
|
|
33
|
+
|
|
34
|
+
### Authenticate with an API key
|
|
35
|
+
|
|
36
|
+
Pass your key directly to the client:
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from crbonfree import CrbonFree
|
|
40
|
+
|
|
41
|
+
crbon = CrbonFree(api_key="ck_live_...")
|
|
42
|
+
|
|
43
|
+
summary = crbon.telemetry.get_summary()
|
|
44
|
+
print(f"{summary.data.total_co2_kg} kg CO2 from your AI usage")
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Or read it from the environment
|
|
48
|
+
|
|
49
|
+
Keep the key out of your source by reading it from `CRBONFREE_API_KEY`:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
export CRBONFREE_API_KEY="ck_live_..."
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import os
|
|
57
|
+
from crbonfree import CrbonFree
|
|
58
|
+
|
|
59
|
+
crbon = CrbonFree(api_key=os.environ["CRBONFREE_API_KEY"])
|
|
60
|
+
|
|
61
|
+
summary = crbon.telemetry.get_summary()
|
|
62
|
+
print(f"{summary.data.total_co2_kg} kg CO2 from your AI usage")
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The API key is sent on every request as the `X-API-Key` header.
|
|
66
|
+
|
|
67
|
+
### Async
|
|
68
|
+
|
|
69
|
+
An async client ships alongside the sync one:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
import asyncio
|
|
73
|
+
from crbonfree import AsyncCrbonFree
|
|
74
|
+
|
|
75
|
+
async def main():
|
|
76
|
+
crbon = AsyncCrbonFree(api_key="ck_live_...")
|
|
77
|
+
summary = await crbon.telemetry.get_summary()
|
|
78
|
+
print(f"{summary.data.total_co2_kg} kg CO2 from your AI usage")
|
|
79
|
+
|
|
80
|
+
asyncio.run(main())
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## What you can do
|
|
84
|
+
|
|
85
|
+
| | Method | What it returns |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| **Measure** | `crbon.telemetry.get_summary()` | Total CO2, per-model rollups, daily chart |
|
|
88
|
+
| **Analyze** | `crbon.usage.get_breakdown()` | Which models cost the most carbon |
|
|
89
|
+
| **Organize** | `crbon.projects.list()` | Track emissions by project / team |
|
|
90
|
+
| **Prove** | `crbon.billing.list_receipts()` | Signed carbon retirement receipts |
|
|
91
|
+
| **Audit** | `crbon.billing.list_audit_packs()` | CSRD-ready compliance artifacts |
|
|
92
|
+
| **Manage** | `crbon.apikeys.create()` | Programmatic API key management |
|
|
93
|
+
|
|
94
|
+
## Pagination
|
|
95
|
+
|
|
96
|
+
Listing endpoints accept `page` and `limit` parameters directly:
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
receipts = crbon.billing.list_receipts(page=1, limit=20)
|
|
100
|
+
for receipt in receipts.data:
|
|
101
|
+
print(receipt.serial_number)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## What's next
|
|
105
|
+
|
|
106
|
+
Ergonomic auto-pagination helpers and a `crbonfree login` CLI for
|
|
107
|
+
zero-config, browser-based authentication are coming in a fast-follow release.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
<p align="center">
|
|
112
|
+
<a href="https://beta.crbonfree.com">Dashboard</a> ·
|
|
113
|
+
<a href="https://github.com/Crbon-Labs-Inc/crbonfree-python-sdk/issues">Issues</a> ·
|
|
114
|
+
<a href="https://crbonfree.com">Website</a>
|
|
115
|
+
</p>
|
|
116
|
+
|
|
117
|
+
<p align="center">
|
|
118
|
+
<sub>MIT — Crbon Labs Inc.</sub>
|
|
119
|
+
</p>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Minimal CrbonFree quickstart.
|
|
2
|
+
|
|
3
|
+
Run with an API key in the environment:
|
|
4
|
+
|
|
5
|
+
export CRBONFREE_API_KEY="ck_live_..."
|
|
6
|
+
python examples/quickstart.py
|
|
7
|
+
|
|
8
|
+
or pass it explicitly to the client below.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import asyncio
|
|
12
|
+
import os
|
|
13
|
+
|
|
14
|
+
from crbonfree import AsyncCrbonFree, CrbonFree
|
|
15
|
+
|
|
16
|
+
API_KEY = os.environ.get("CRBONFREE_API_KEY", "ck_live_...")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def sync_example() -> None:
|
|
20
|
+
crbon = CrbonFree(api_key=API_KEY)
|
|
21
|
+
|
|
22
|
+
summary = crbon.telemetry.get_summary()
|
|
23
|
+
print(f"{summary.data.total_co2_kg} kg CO2 from your AI usage")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
async def async_example() -> None:
|
|
27
|
+
crbon = AsyncCrbonFree(api_key=API_KEY)
|
|
28
|
+
|
|
29
|
+
summary = await crbon.telemetry.get_summary()
|
|
30
|
+
print(f"{summary.data.total_co2_kg} kg CO2 from your AI usage")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
if __name__ == "__main__":
|
|
34
|
+
sync_example()
|
|
35
|
+
asyncio.run(async_example())
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
api:
|
|
2
|
+
specs:
|
|
3
|
+
- openapi: ./openapi/openapi.json
|
|
4
|
+
groups:
|
|
5
|
+
python-sdk:
|
|
6
|
+
generators:
|
|
7
|
+
- name: fernapi/fern-python-sdk
|
|
8
|
+
version: 5.14.6
|
|
9
|
+
output:
|
|
10
|
+
location: local-file-system
|
|
11
|
+
path: ../src/crbonfree
|
|
12
|
+
config:
|
|
13
|
+
package_name: crbonfree
|
|
14
|
+
client_class_name: CrbonFree
|
|
15
|
+
pydantic_config:
|
|
16
|
+
version: v2
|