Skip to content

Feature: Pricing Services #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Feature: Pricing Services #226

wants to merge 6 commits into from

Conversation

1yam
Copy link
Member

@1yam 1yam commented Aug 12, 2025

This Pr adds a new Pricing Services to allow user to fetch price of services direcly from SDK.

Related ClickUp, GitHub or Jira tickets : ALEPH-541

Self proofreading checklist

  • The new code clear, easy to read and well commented.
  • New code does not duplicate the functions of builtin or popular libraries.
  • An LLM was used to review the new code and look for simplifications.
  • New classes and functions contain docstrings explaining what they provide.
  • All new code is covered by relevant tests.

Changes

This pull request introduces a new Pricing service to the SDK, enabling programmatic access to pricing information for various Aleph services. It also adds GPU information helpers to the CRN service, utility functions for compute unit calculation, and comprehensive unit tests for the pricing logic. The changes are grouped as follows:

New Pricing Service:

  • Added a new Pricing service (src/aleph/sdk/client/services/pricing.py) with models for pricing entities, groups, and methods to fetch and filter pricing information for different Aleph services. This includes support for GPU, confidential, and persistent program pricing.
  • Integrated the Pricing service into the main HTTP client (src/aleph/sdk/client/http.py) by importing and initializing it in the client context. [1] [2]

GPU Information Enhancements:

  • Introduced GPU and NetworkGPUS models to the CRN service and added a helper method fetch_gpu_on_network for aggregating GPU availability and compatibility across the network. [1] [2] [3]

Utility Improvements:

  • Added a utility function _get_nb_compute_units in src/aleph/sdk/utils.py to calculate the number of compute units required for a given service specification, leveraging the new ComputeUnit model. [1] [2] [3]

Testing:

  • Added comprehensive unit tests for the Pricing service in tests/unit/services/test_pricing.py, covering aggregate fetching, service-specific pricing, GPU pricing, and group constants.

These changes collectively improve the SDK's support for pricing and resource management, especially for compute and GPU-enabled services.

Notes

exemple usage :

pricing = await client.pricing.get_pricing_aggregate()
tier = pricing[PricingEntity.INSTANCE].tiers
cu = pricing[PricingEntity.INSTANCE].compute_unit

@aleph-im aleph-im deleted a comment from github-actions bot Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants