Skip to content

Conversation

@1yam
Copy link
Member

@1yam 1yam commented Sep 2, 2025

This PR add a new commands:
aleph credits buy that redirect to payment gateway

Related ClickUp, GitHub or Jira tickets : ALEPH-621

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 major improvements to the Aleph CLI, focusing on supporting a new credits-based payment system for instances, enhancing GPU and CRN selection logic, and refactoring pricing and payment flows. The changes also add a new credits command group and update dependencies to support these features.

Credits System Integration & CLI Enhancements

  • Added a new credits command group (src/aleph_client/commands/credit.py) to the CLI, allowing users to view, list, and buy Aleph credits directly from the command line. This includes commands to display credit balances, list credit holders, and provide purchase instructions. [1] [2] [3]

  • Updated the account balance command to display the user's credits alongside other balances, fetching this information via the new credits API. Includes error handling for nodes that do not support credits yet. [1] [2]

Instance Creation Flow & Payment Refactor

  • Refactored the instance creation logic to support credits as a payment method. This includes checking for sufficient credit balance, integrating credit price calculations, and handling credit-specific errors. The payment logic now distinguishes between hold, superfluid, and credit payments, with appropriate checks for each.

  • Improved pricing and tier selection: switched to using fetch_pricing_aggregate and refactored how tiers/specs are selected and validated, including better handling for GPU and confidential instances. The code now ensures the correct specs are used based on the chosen tier and payment type.

CRN & GPU Selection Refactor

  • Refactored CRN (Compute Resource Node) and GPU selection: replaced older fetch and filter logic with new methods (call_program_crn_list, filter_crn, find_gpu_on_network). Improved user prompts and validation for selecting CRNs and GPUs, and enhanced the display of CRN specs. [1] [2] [3] [4]

Dependency Updates

  • Updated dependencies in pyproject.toml to support the credits system, including pinning aleph-message to a newer version and using a specific branch of aleph-sdk-python with credits support.

Miscellaneous Refactoring

  • Cleaned up imports and type annotations across several files to support new features and improve code clarity. [1] [2] [3] [4]

Encoded references:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]

How to test

aleph credits buy

Print screen / video

image

Notes

There isn't a Payment gateway url yet so i'm using a fake one

@1yam 1yam changed the base branch from master to 1yam-credits-handling September 2, 2025 12:46
@aleph-im aleph-im deleted a comment from github-actions bot Sep 3, 2025
@1yam 1yam marked this pull request as draft September 16, 2025 09:43
@1yam 1yam force-pushed the 1yam-credits-handling branch from 7ca29a2 to cac3e45 Compare September 16, 2025 09:50
@1yam 1yam force-pushed the 1yam-credits-handling branch from 3ef8b7b to 5f93d05 Compare September 30, 2025 11:42
Base automatically changed from 1yam-credits-handling to 1yam-pricing-refactor September 30, 2025 14:46
Base automatically changed from 1yam-pricing-refactor to master September 30, 2025 14:57
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