Overview

Turn HuggingFace models into revenue-generating assets on Kyne’s decentralized AI marketplace. This integration enables:
  • Secure model distribution with verifiable usage tracking
  • Token-based monetization of HuggingFace models
  • Efficient storage using Walrus’s Red Stuff encoding
  • Automated rewards for model creators and data contributors

Key Benefits

For Model Creators

  • • Monetize your HuggingFace models
  • • Track usage and earn rewards
  • • Verifiable compute metrics
  • • Built-in revenue sharing

For Model Users

  • • Access popular models with token payments
  • • Guaranteed model availability
  • • Pay only for storage used
  • • Verifiable model authenticity

Getting Started

Prerequisites

  1. HuggingFace Setup Get your HuggingFace access token from HuggingFace
  2. SUI Wallet Connect a SUI wallet for marketplace transactions
  3. SDK Installation
    pip install kyne-sdk
    

Quick Start

from kyne.integrations import HuggingFaceMarket
from kyne.wallet import SUIWallet

# Initialize with your wallet
market = HuggingFaceMarket(
    wallet=SUIWallet.from_private_key("0x..."),
    hf_token="your_hf_token"
)

# List a model on the marketplace
listing = await market.list_model(
    model_id="bert-base-uncased",
    price=1000,  # Price in SUI tokens
    config={
        "revenue_share": 0.1,  # Share for data contributors
        "storage_epochs": 12    # Storage duration
    }
)

# Track model usage and earnings
stats = await market.get_model_stats(listing.id)
print(f"Total earnings: {stats.earnings} SUI")
print(f"Total uses: {stats.usage_count}")

Model Management

Publishing Models

  1. Import Model
    # Import model from HuggingFace
    model = await market.import_model(
        "bert-base-uncased",
        verify_integrity=True
    )
    
  2. Configure Storage
    # Set storage parameters
    storage = await model.configure_storage(
        min_nodes=7,     # 2f+1 for fault tolerance
        epochs=12,       # Storage duration
        redundancy=2     # Red Stuff encoding level
    )
    
  3. Create Listing
    # List on marketplace
    listing = await model.create_listing(
        price=1000,              # Base price in SUI
        usage_fee=10,            # Per-use fee
        revenue_share=0.1        # Share for contributors
    )
    

Monetization Settings

Pricing Models

# Configure flexible pricing
await model.set_pricing({
    "base_price": 1000,    # One-time access
    "subscription": {      # Subscription pricing
        "monthly": 500,
        "yearly": 5000
    },
    "usage_fees": {       # Pay-per-use
        "inference": 1,
        "training": 10
    }
})

Revenue Sharing

# Set revenue distribution
await model.set_revenue_sharing({
    "creator": 0.7,       # Model creator
    "contributors": 0.2,  # Data contributors
    "platform": 0.1       # Platform fee
})

Storage & Distribution

Efficient Storage

Kyne uses Walrus’s Red Stuff encoding to store models efficiently:
# Configure storage with Byzantine fault tolerance
await model.optimize_storage(
    chunk_size=64*1024*1024,  # 64MB chunks
    min_nodes=7,              # 2f+1 nodes
    redundancy=2              # Red Stuff encoding level
)

# Monitor storage health
health = await model.check_storage_health()
print(f"Storage nodes: {health.active_nodes}")
print(f"Availability: {health.availability_score}")

Access Control

Token Gating

# Set access requirements
await model.set_access_control({
    "min_stake": 1000,    # Min SUI stake
    "whitelist": ["0x.."] # Allowed addresses
})

Usage Tracking

# Monitor model usage
stats = await model.get_usage_stats(
    timeframe="7d"
)
print(f"Revenue: {stats.revenue} SUI")

Best Practices

Security

Always verify model integrity after import
Use appropriate Byzantine fault tolerance settings
Monitor storage proofs and challenges
Implement proper access controls

Performance

  1. Optimize Storage
    • Use recommended chunk sizes
    • Configure proper redundancy levels
    • Monitor storage node health
  2. Manage Access
    • Implement token gating
    • Track usage metrics
    • Monitor revenue distribution
  3. Monitor Health
    • Check storage proofs
    • Verify node availability
    • Track marketplace performance

Next Up

Kyne provides powerful search capabilities and desktop development tools to create seamless AI applications.