Verify TEE attestations, validate signed inference responses, and download attestation reports from 0G Compute providers.
0G Compute providers that advertise verifiability == "TeeML" run inside a Trusted Execution Environment (TEE) and sign every response they produce. The SDK gives you three tools to verify the integrity of a provider and its responses:
verify_service — comprehensive provider attestation check before you use it
process_response — validate a specific response’s TEE signature
Attestation download helpers — fetch raw quotes and signatures for custom verification
verify_service performs a full attestation check and returns a typed
VerificationResult dataclass. It is silent by default — pass an
on_log callback to stream progress, or iterate result.steps after the
call to replay the verification trace.
result = broker.inference.verify_service( provider_address = "0xProvider...", output_dir = "./reports", # optional — save JSON report)print(f"Success: {result.success}")print(f"Model: {result.model}")print(f"Verifiability: {result.verifiability}")print(f"TEE signer: {result.tee_signer}")print(f"Signer match: {result.signer_match}")print(f"Attestation: {result.attestation_verified}")if result.reports_generated: print(f"Report saved to: {result.reports_generated[0]}")
on_log fires once per verification step with a VerificationStep
(type, message):
result = broker.inference.verify_service( provider_address, on_log = lambda step: print(f"[{step.type}] {step.message}"),)
Or replay the same trace after the fact — result.steps always carries
the full sequence, even when on_log is None:
result = broker.inference.verify_service(provider_address)for step in result.steps: print(f"[{step.type}] {step.message}")
The SDK never writes to stdout from verify_service itself — matching the TypeScript SDK’s behaviour. If you want terminal output, opt in via on_log (or result.steps). This makes the method safe to use inside web servers, notebooks, and background workers without polluting their logs.
Whether the provider is acknowledged on-chain by the caller
reports_generated
list[str]
Paths to JSON reports written when output_dir was set
output_directory
str | None
The output_dir argument as supplied
errors
list[str]
Non-fatal issues encountered during verification
timestamp
int
Milliseconds since epoch
Each VerificationStep has type ("info", "success", "error", "warning", or "step") and message.
verify_service never raises on verification failure — it returns success=False with errors populated. It only raises ServiceNotFoundError if the provider isn’t registered at all.
process_response looks up the service’s verifiability. For "TeeML" providers it:
Fetches the TEE-generated signature for this specific chat_id from <provider_url>/v1/proxy/signature/<chat_id>
Extracts the signer’s public key from the service’s additional_info (which may include a TargetTeeAddress override for separated architectures)
Validates the ECDSA signature over the response content
chat_id is required for verifiable services. Without it, process_response raises InvalidResponseError. For non-verifiable services, chat_id can be omitted — the method returns True regardless.
The expected_signer / signer_match check only works for providers you’ve acknowledged on-chain. Acknowledgement records the provider’s TEE signer to your account:
# First time per providerbroker.inference.acknowledge_provider_signer(provider_address)# Now verify_service can compare extracted vs expected signerresult = broker.inference.verify_service(provider_address)
if broker.inference.acknowledged(provider_address): print("Already acknowledged")
For a structured snapshot of the provider’s signer state, including whether
the account exists and the on-chain TEE signer address, use
check_provider_signer_status: