LogoLogo
  • Developers
    • Macrocosmos SDK
      • Get Started
      • API Keys
      • Subnet 1 Apex API
      • Subnet 13 Gravity API
    • Tools
      • Macrocosmos MCP
  • SUBNETS
    • Subnet 1 Apex
      • Subnet 1 Getting Started
      • Subnet 1 Mining Setup Guide
      • Subnet 1 Incentive Mechanism
    • Subnet 9 IOTA
      • Subnet 9 Incentive Mechanism
      • Subnet 9 Mining Setup Guide
      • Subnet 9 Validating
    • Subnet 13 Data Universe
      • Subnet 13 Getting Started
      • Subnet 13 Data Universe API
      • Subnet 13 Incentive Mechanism
    • Subnet 25 Mainframe
      • Subnet 25 Getting Started
      • Subnet 25 Mainframe API
        • API Keys
        • Folding API
          • Running Folding API Server
          • Endpoints
        • Organic API
          • Endpoints
      • Subnet 25 Incentive Mechanism
  • Subnet 37 Finetuning
    • Subnet 37 Getting Started
    • Subnet 37 Mining Setup Guide
    • Subnet 37 Validating Setup Guide
    • Subnet 37 Incentive Mechanism
    • Subnet 37 Competitions
  • CONSTELLATION - USER GUIDES
    • Apex User Guide
      • Navigating Apex
      • FAQs
    • Gravity User Guide
      • Scraping data
      • Managing and Collecting your data
      • FAQs
    • Nebula User Guide
      • Explore Nebula
      • Analyzing data
  • About us
    • About Macrocosmos
    • Bittensor
      • DTAO
    • News and updates
    • Macromedia
    • Subnet Status Update
Powered by GitBook
On this page
  • Install the Macrocosmos SDK using pip or npm
  • Client Setup
  • Watch the Demo here
  1. Developers
  2. Macrocosmos SDK

Get Started

PreviousMacrocosmos SDKNextAPI Keys

Last updated 9 days ago

To get started using Macrocosmos Software Development Kit (SDK) you should:

  1. Generate your API key using the instruction from the page

  2. Ensure that you are using Python 3.9+ or Typescript

How to setup a simple project to run SDK using python in Cursor
  1. Install - the basic version is free

  2. From the top menu choose File -> Open and create a new folder for your project.

  3. In your new project folder type at the Chat menu asking to setup a new project:

    Cursor is a great tool for the development! It can follow human language instructions helping to setup the project, make it functional and secure, find issues with the code and provide instructions in case of challenges.

  4. I have got the next instructions and accepted the files.

    I'll help you set up a new empty project. First, let me check what's currently in the workspace directory.Listed 0 items in current directoryGreat, I see the directory is empty. I'll help you set up a basic project structure. I'll create:

    1. A README.md file with project information

    2. A .gitignore file for common files to ignore

    3. A basic project structure

  5. In the next message ask to create a virtual environment

  6. I have accepted the changes and got the result: Perfect! Your virtual environment is now set up and ready to use. Here's what has been done:

  1. Created a new virtual environment in the venv directory

  2. Activated the virtual environment

  3. Verified Python 3.9.6 and pip 21.2.4 are installed

You can now:

  • Install packages using pip install <package-name>

  • Run Python scripts in an isolated environment

  • When you're done working, you can deactivate the virtual environment by typing deactivate

  1. From the top menu choose File -> New Terminal

  2. Activate the virtual environment directory

    #activate the virtual environment directory
    source venv/bin/activate
    #activate python
    python

Congratulations! 🎉 You have setup the basic project and now can start to use Macrocosmos SDK through the terminal starting from pip install macrocosmos and activating clients for Apex and Gravity, as it described in the document below.

Install the Macrocosmos SDK using pip or npm

pip install macrocosmos
npm install macrocosmos

Client Setup

The Client classes — such as ApexClient and GravityClient , serve as the primary interface between your application and a specific Macrocosmos subnet.

# Import the client
import macrocosmos as mc

# Initialize the client
client = mc.ApexClient(api_key="")
// Import the client
import { ApexClient } from 'macrocosmos';

// Initialize the client
const client = new ApexClient({ apiKey: 'your-api-key' });

When you initialize a client - ApexClient or GravityClient, you're creating a scoped connection to that subnet. This setup manages authentication via your API key.

Watch the Demo here

API Keys
Cursor