Skip to main content

veil_sdk/
lib.rs

1//! # veil-sdk
2//!
3//! Rust client for the Mugen Veil verifiable inference gateway.
4//!
5//! ## Quick start
6//!
7//! ```rust,no_run
8//! use veil_sdk::VeilClient;
9//!
10//! #[tokio::main]
11//! async fn main() -> veil_sdk::error::Result<()> {
12//!     let client = VeilClient::builder()
13//!         .base_url("http://localhost:8080")
14//!         .build()?;
15//!
16//!     // High-level: submit + wait
17//!     let result = client
18//!         .verify_inference("tiny_mlp_v1", vec![vec![0.1, 0.2, 0.3, 0.4]])
19//!         .await?;
20//!
21//!     println!("status:          {}", result.status);
22//!     println!("tx_hash:         {:?}", result.tx_hash);
23//!     println!("attestation:     {:?}", result.attestation_hash);
24//!     println!("elapsed:         {}ms", result.elapsed_ms);
25//!     Ok(())
26//! }
27//! ```
28//!
29//! ## Primitives
30//!
31//! For finer control, use the primitive methods directly:
32//!
33//! ```rust,no_run
34//! use veil_sdk::VeilClient;
35//!
36//! #[tokio::main]
37//! async fn main() -> veil_sdk::error::Result<()> {
38//!     let client = VeilClient::builder()
39//!         .base_url("http://localhost:8080")
40//!         .build()?;
41//!
42//!     // Health check
43//!     let health = client.health_check().await?;
44//!     assert!(health.is_healthy());
45//!
46//!     // Submit and poll manually
47//!     let job_id = client
48//!         .submit_job("tiny_mlp_v1", vec![vec![0.5, 0.3, 0.8, 0.1]])
49//!         .await?;
50//!
51//!     loop {
52//!         let job = client.get_job(&job_id).await?;
53//!         if job.status.is_terminal() { break; }
54//!         tokio::time::sleep(std::time::Duration::from_secs(2)).await;
55//!     }
56//!
57//!     // Fetch raw proof bytes
58//!     let proof = client.get_proof(&job_id).await?;
59//!     println!("proof size: {} bytes", proof.size_bytes);
60//!     Ok(())
61//! }
62//! ```
63
64pub mod client;
65pub mod error;
66pub mod types;
67
68pub use client::{VeilClient, VeilClientBuilder};
69pub use error::{Result, VeilError};
70pub use types::{
71    Health, Job, JobStatus, Proof, RegisterModelRequest, RegisterModelResponse, VerifyResult,
72};