NEAR AI Cloud: SDK
Use the JavaScript, Python, Rust, and Go SDKs for verified, encrypted Chat Completions.
NEAR AI Inference SDK is available for JavaScript, Python, Rust, and Go. All four provide an OpenAI-compatible Chat Completions client, attestation verification, optional encryption, and explicit response-signature verification.
Install from npm and get started with Node.js 24 or later.
Install from PyPI and get started with Python 3.12 or later.
Install from crates.io and get started with Rust stable and Cargo.
Install with go get and get started with Go 1.25.8 or later.
Install
npm install @nearai/inference-sdk
pip install nearai-inference-sdk
[dependencies]
nearai-inference-sdk = "0.1"
go get github.com/nearai/inference-sdk/[email protected]
Packages: npm · PyPI · crates.io · Go release.
E2EE
End-to-end encryption is disabled by default. Enable it with e2ee: true in JavaScript and Rust, e2ee=True in Python, or E2EE: true in Go to encrypt supported Chat fields to a verified model key. E2EE requires a supported NEAR TEE model and rejects models without supported model attestation.
Verification
The clients verify Gateway evidence before sending Chat and verify model evidence where supported. In Python, Rust, and Go, model verification requires a NEAR vLLM deployment with attestation enabled; other providers use Gateway-only verification. The JavaScript SDK also supports Chutes model attestation.
After receiving a completion, call verifyResponse(completion.id) in JavaScript, await client.verify_response(completion.id) in Python, client.verify_response(id).await? in Rust, or client.VerifyResponse(ctx, id) in Go before using the answer as verified. For streaming, consume the entire stream first. Deployment verification alone does not verify a particular response.
A provider_tee signature binds the exact request and response bytes to a verified model signer. A gateway signature binds those bytes to a verified Gateway signer; it does not prove that an attested model generated them.
See Verification for evidence, policies, and verification limits, or follow the JavaScript, Python, Rust, and Go guides.
OHTTP
All four SDKs support optional OHTTP to encapsulate the Chat HTTP exchange to the attested Gateway. It is disabled by default and requires Ed25519. E2EE protects supported fields to the model independently. See the JavaScript, Python, Rust, or Go configuration.
Examples
See the language guides for runnable examples, or explore the SDK source and examples.