Learn how to interact with MatterGen using the Ouro SDK or REST API.
API access requires an API key. Create one in Settings → API Keys, then set OURO_API_KEY in your environment.
Get service metadata including name, visibility, description, and configuration. You can retrieve by service ID or identifier.
Retrieve the OpenAPI specification for this service to understand available endpoints and their parameters.
Get all routes for this service and use them programmatically.
Click on an endpoint to view its detailed documentation.
/mattergen/generate/magnetic-densityGenerate crystal structures with MatterGen and magnetic density conditioning
/mattergen/generate/magnetic-density-hhi-scoreGenerate crystal structures with MatterGen, magnetic density, and HHI score conditioning
/mattergen/generate/singleGenerate a crystal structure with MatterGen
/mattergen/generateGenerate crystal structures with MatterGen
import os
from ouro import Ouro
# Set OURO_API_KEY in your environment or replace os.environ.get("OURO_API_KEY")
ouro = Ouro(api_key=os.environ.get("OURO_API_KEY"))
# Option 1: Retrieve by service ID
service_id = "4f0a3b52-e66e-4144-95b9-c7cf0a456470"
service = ouro.services.retrieve(service_id)
# Option 2: Retrieve by service identifier (username/service-name)
service_identifier = "mmoderwell/mattergen"
service = ouro.services.retrieve(service_identifier)
print(service.name, service.visibility)
print(service.metadata)# Retrieve the service
service = ouro.services.retrieve("mmoderwell/mattergen")
# Read the OpenAPI spec
spec = ouro.services.read_spec(service.id)
print(spec.get("openapi"))
print(spec.get("info"))# Retrieve the service
service = ouro.services.retrieve("mmoderwell/mattergen")
# Get all routes for this service
routes = ouro.services.read_routes(service.id)
for route in routes:
print(f"{route.route.method} {route.route.path}")
print(f" Summary: {route.route.summary}")MatterGen generates candidate inorganic crystal structures with diffusion-based property conditioning. Use it to sample materials within a target chemical system or steer generations toward target magnetic density and supply-concentration preferences (HHI score). Batch routes return ZIP archives of CIF files, while the single-structure route returns one CIF directly.
This week I added two new services for crystal (CIF) generation. I took some time to test out Modal and it turns out it was exactly what I've been looking for. Many of these models are GPU intensive a