Expand description
IICP Rust client SDK — ADR-016 §1 (SDK-01..SDK-06)
§Quickstart
use iicp_client::{ChatMessage, ChatOptions, ClientConfig, IicpClient};
#[tokio::main]
async fn main() -> iicp_client::Result<()> {
let client = IicpClient::new(ClientConfig::default())?;
let reply = client.chat(
vec![ChatMessage { role: "user".into(), content: "What is IICP?".into() }],
None,
).await?;
println!("{}", reply.choices[0].message.content);
Ok(())
}Re-exports§
pub use node::IicpNode;pub use node::NodeConfig;
Modules§
- availability
- Time-based availability windows — operator capacity shaping by time-of-day.
- backends
- Drop-in backend handlers for iicp-client.
- cip_
policy - CIP-W01/CIP-W02 provider-side policy gate — S.12, ADR-012.
- concurrency
- Unified concurrency gate for the hybrid client.
- confidentiality
- IICP-CX S.16 Tier-1 confidentiality: X25519-HKDF-SHA256 + AES-256-GCM.
- conformance
- Self-conformance probes — operator-side health verification.
- idempotency
- Idempotency guard — task_id dedup with TTL eviction (parity Block E, #340).
- identity
- Persistent on-disk identity for the IICP Rust SDK CLI.
- node
- IICP provider node — registration, heartbeats, and task serving.
- peer_
manager - Phase 2 mesh layer — peer discovery, gossip, and relay support (parity Block F, #340).
- pricing
- ADR-019 declarative pricing + HMAC-SHA256 signing — provider-side.
- scheduler
- QoS-aware admission policy for the provider serve path (parity Block C, #340).
- token_
validator - Constant-time bearer-token validation (parity Block E, #340).
- trust_
auditor - Trust auditor — cross-node declaration consistency check (parity Block E, #340).
Structs§
- Chat
Choice - A single choice in a chat response.
- Chat
Message - A single chat message (role + content).
- Chat
Options - Options for
chat()calls. - Chat
Response - OpenAI-compatible chat completion response.
- Chat
Usage - Token usage from a chat completion.
- Client
Config - Client configuration (SDK-04: timeout_ms enforced at construction time).
- Discover
Options - Options for
discover()calls. - Iicp
Client - IICP client — discover → select → submit (ADR-016 §1).
- Node
- A single IICP node returned by
/v1/discover. - Node
List - Response from
/v1/discover. - Task
Auth - Auth block for a task request.
- Task
Constraints - Constraints block for a task request.
- Task
Request - IICP task request body.
- Task
Response - Response from
POST /v1/task.
Enums§
- Iicp
Error - All errors emitted by the IICP client SDK.
Functions§
- make_
traceparent - Generate a W3C traceparent header value (SDK-06).
Format:
00-<32hex>-<16hex>-01