Skip to main content

Unified Compute API

Every Hive job goes through one endpoint. The steps array defines what needs to happen. Steps can reference outputs of previous steps via depends_on.

Endpoint: POST /v1/compute

Request format

{
"requester_pk": "<Ed25519 public key>",
"h3_cell": "871e9a0ecffffff",
"steps": [
{
"id": "ask",
"type": "inference",
"model": "llama-3.3-70b-versatile",
"messages": [
{"role": "user", "content": "What are the best restaurants near me?"}
],
"context": {
"h3_cell": "871e9a0ecffffff"
}
}
],
"budget_gns": 0.01,
"signature": "<Ed25519 signature of canonical JSON>"
}

Fields

FieldTypeRequiredDescription
requester_pkstringYesEd25519 public key of the requester
h3_cellstringNoH3 cell for job routing (default: Rome)
stepsarrayYesArray of compute steps
budget_gnsnumberNoMaximum GNS to spend (default: 0.1)
signaturestringNoEd25519 signature for authenticated requests

Step fields

FieldTypeRequiredDescription
idstringYesUnique step identifier
typestringYesinference, tile_render, image_process, sensor_fusion
depends_onstringNoID of a step whose output feeds into this one
modelstringNoModel for inference (default: llama-3.3-70b-versatile)
messagesarrayNoChat messages for inference steps
operationstringNoOperation for image_process (e.g. ndvi)
center_cellstringNoH3 cell for tile_render center
zoomnumberNoZoom level for tile_render (0-20)
stylestringNoTile style: osm-bright, dark, satellite, terrain
contextobjectNoAdditional context (h3_cell, epoch, date_from, date_to)

Response format

{
"job_id": "596f5a7c-ed12-4061-ad8c-8893f811dddc",
"worker_pk": "groq-backbone",
"h3_cell": "871e9a0ecffffff",
"epoch": 2337,
"steps": [
{
"id": "ask",
"type": "inference",
"status": "complete",
"output": {
"text": "Here are 3 great restaurants...",
"locations": [
{"name": "Da Enzo", "address": "Via dei Vascellari, 29"}
],
"model": "groq/llama-3.3-70b-versatile",
"provider": "groq",
"tokens_in": 42,
"tokens_out": 187,
"latency_ms": 340,
"proof_job_id": "f50c0e8a-..."
},
"latency_ms": 340
}
],
"settlement": {
"stellar_tx": null,
"total_gns": 0.0043,
"breakdown": {
"ask": 0.0043
}
},
"proof": {
"job_hash": "d3ae5772bca226fa...",
"verify_url": "https://mobydb.com/proof/871e9a0ecffffff/2337/groq-backbone"
}
}

Step dependencies (DAG)

Steps execute in dependency order. A step can reference the output of a previous step via depends_on. The executor performs a topological sort to resolve the correct execution order.

step "scan" (image_process) ──→ step "analyze" (inference)


step "map" (tile_render)

Circular dependencies are rejected with an error.

Common patterns

Inference only (current @hai behavior)

{
"steps": [{"id": "ask", "type": "inference", "messages": [...]}]
}

AI + Map (the killer combo)

{
"steps": [
{"id": "think", "type": "inference", "messages": [...]},
{"id": "show", "type": "tile_render", "depends_on": "think",
"center_cell": "871e9a0ecffffff", "zoom": 15, "style": "osm-bright"}
]
}

Satellite + AI + Map (agricultural monitoring)

{
"steps": [
{"id": "scan", "type": "image_process", "operation": "ndvi",
"context": {"h3_cell": "871e9a0ecffffff"}},
{"id": "analyze", "type": "inference", "depends_on": "scan",
"messages": [{"role": "user", "content": "Analyze this NDVI data"}]},
{"id": "map", "type": "tile_render", "depends_on": "analyze",
"center_cell": "871e9a0ecffffff", "zoom": 14, "style": "satellite"}
]
}

Tested result: 1.9 seconds, 0.0011 GNS, one Merkle proof covering all three steps.

Pricing

Step TypeUnitPrice (GNS)
Inference (Hive worker)Per token0.00001
Inference (Groq backbone)Per token0 (subsidized)
Tile render (cache hit)Per tile0.00001
Tile render (cache miss)Per tile0.0001
Image processingPer megapixel0.001
Sensor fusionPer cell-epoch0.0005

Compound job cost = sum of step costs. One Stellar settlement per job.

Other endpoints

GET /v1/compute/:jobId

Retrieve a completed job by ID.

GET /v1/compute/recent?limit=50

List recent compute jobs (for dashboard).