The model registry module manages AI model hosting, versioning, access control, and an inference marketplace on ClawChain. Model owners can register models with metadata, publish new versions, set pricing, and earn revenue from queries. Inference providers run the models and earn fees for completing jobs.
Key Features
Model registration with framework, architecture, parameter count, tags, and storage URI
Version history -- publish new versions while preserving the full changelog
Access control -- four access types: free, per_query, subscription, one_time
Subscription management -- time-limited access with renewal and automatic expiry
Inference marketplace -- submit jobs, match with providers, escrow payment, settle on completion
Provider heartbeats -- inference providers prove liveness; stale providers marked offline after 50 blocks
Rating system -- users rate models 0-5 stars (stored as 0-500); self-rating prohibited
Revenue tracking -- per-model total revenue and download counts
Concepts
Model Lifecycle
Register Model (name, framework, storage URI, access type)
|
v
Active Model ---> Publish New Version
| |
| Version History Updated
|
+--> Set Pricing (per-token, per-query, min payment)
|
+--> Users Purchase Access / Submit Inference Jobs
|
+--> Rate Model (1-5 stars, no self-rating)
|
+--> Delist Model (owner only, marks inactive)
Supported Frameworks
Models must specify one of the following frameworks:
Framework
Description
pytorch
PyTorch models
tensorflow
TensorFlow / Keras models
onnx
ONNX Runtime models
gguf
GGML/GGUF quantized models (llama.cpp)
safetensors
HuggingFace safetensors format
jax
Google JAX models
other
Other frameworks
Access Types
Type
Payment
Duration
free
None
Permanent
per_query
Charged per inference query
Permanent access, pay-per-use
one_time
Single upfront payment
Permanent
subscription
Recurring per-period payment
Expires after subscription_period_blocks (default ~3 days)
Subscription access can be extended before expiry. If a buyer already has active access, the renewal period is added to the existing expiry block.
Inference Job Lifecycle
Requester submits job (payment escrowed to module account)
|
v
Pending ---> Provider matched (online, has capacity, serves model)
|
v
Running ---> Provider executes inference
|
v
Completed ---> Payment settled:
| actual_cost = max(price_per_query, price_per_token * tokens_used)
| Provider receives min(actual_cost, escrowed_payment)
| Requester refunded excess
|
+--> Failed ---> Full refund to requester
|
+--> Timeout (100 blocks) ---> Full refund to requester (EndBlock)
Inference Providers
Providers register with:
Address -- Cosmos account
Model IDs -- which models they serve
Max concurrent jobs -- capacity limit (default 1)
Endpoint -- inference API URL
Providers must send heartbeats to stay online. After 50 blocks without a heartbeat, providers are marked offline and will not receive new jobs. Provider stats track total jobs, earnings, and average latency.
Messages
Message
Description
RegisterModel
Register a new AI model with metadata and storage URI
UpdateModel
Update model metadata (owner only)
PublishVersion
Publish a new version with updated storage URI and checksum
DelistModel
Deactivate a model (owner only)
PurchaseAccess
Purchase access to a paid model (payment sent to owner)
RenewSubscription
Extend a subscription-based model access
RecordUsage
Record a query and charge per-query fee if applicable
RateModel
Rate a model 0-500 (0.0-5.0 stars); no self-rating
RegisterInferenceProvider
Register as an inference provider for specific models
SetInferencePricing
Set per-token, per-query, and minimum payment pricing (owner only)
SubmitInferenceJob
Submit an inference job with payment escrow
StartInferenceJob
Mark a job as running (assigned provider only)
CompleteInferenceJob
Deliver results and settle payment
FailInferenceJob
Mark job as failed and refund requester
ProviderHeartbeat
Update provider liveness status
Queries
Query
Description
QueryModel
Get a single model by ID
QueryModels
List models with optional filters (framework, tags, free-only)
QueryModelVersions
Get all versions for a model
QueryModelAccess
Check if an address has access to a model
QueryInferenceJob
Get inference job details by ID
QueryInferenceJobs
List jobs with optional model ID and status filters
QueryInferenceProvider
Get provider details by address
QueryInferenceProviders
List providers, optionally filtered by model ID
QueryInferencePricing
Get inference pricing for a model
State Keys
All state is managed via cosmossdk.io/collections: