> ## Documentation Index
> Fetch the complete documentation index at: https://docs.near.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK

> Call NEAR AI Cloud inference and verify responses in JavaScript, Python, Rust, and Go.

Use the NEAR AI Inference SDK to call models, verify attestation evidence, and check response signatures.

> [card] [JavaScript](https://docs.near.ai/cloud/inference-sdk/javascript.md)
>
> Requires Node.js 24.22.1 or later.

> [card] [Python](https://docs.near.ai/cloud/inference-sdk/python.md)
>
> Requires Python 3.12 or later.

> [card] [Rust](https://docs.near.ai/cloud/inference-sdk/rust.md)
>
> Use Rust stable and Cargo.

> [card] [Go](https://docs.near.ai/cloud/inference-sdk/go.md)
>
> Requires Go 1.26.10 or later.

## Widget

Use the [Embedded](https://docs.near.ai/cloud/inference-sdk/widget/embedded.md) guide to add the Verification Center to your web application.

## Install

```bash JavaScript theme={"dark"}
npm install @nearai/inference-sdk
```

```bash Python theme={"dark"}
pip install nearai-inference-sdk
```

```bash Rust theme={"dark"}
cargo add nearai-inference-sdk
```

```bash Go theme={"dark"}
go get github.com/nearai/inference-sdk/go
```

## Supported APIs

Choose the API listed on your model's page in the [model catalog](https://docs.near.ai/cloud/models.md), then open its example in your language guide. All four languages support the APIs below; Chat Completions, Responses, and Messages also support streaming.

| API | Encryption |
| - | - |
| Chat Completions | Optional E2EE and OHTTP |
| Responses | Optional OHTTP |
| Messages | Optional OHTTP |
| System One | HTTPS |

## E2EE

End-to-end encryption (E2EE) is off by default. Enable it for Chat Completions with a supported NEAR TEE model. The SDK encrypts each supported field to a verified model key and binds it to a fresh reply key using the [v3 encryption protocol](https://docs.near.ai/cloud/guides/e2ee-chat-completions.md#encryption-protocol).

## Verification

Follow [Verify with the SDK](https://docs.near.ai/cloud/verification/verify-with-sdk.md) for a complete request-to-verification walkthrough and an explanation of its results.

The SDK verifies Gateway attestation before sending a request and model attestation where supported. After receiving the answer, call `verifyResponse()` or your language's equivalent before using the output. For streaming, consume the entire stream first.

| API | ID to verify |
| - | - |
| Chat Completions | Completion `id`, including an ID from the stream |
| Responses | Response `id`; for streaming, `event.response.id` from `response.created` |
| Messages | Message `id`; for streaming, `event.message.id` from `message_start` |
| System One | `decisionId` in JavaScript, `decision_id` in Python/Rust, `DecisionID` in Go; captured from `X-Generation-Id` |

System One's receipt ID is separate from the upstream request ID. If a receipt is temporarily unavailable, retry verification on the same client with the same ID.

After successful verification, the client releases its copies of the request and response bodies and caches the result. Response records expire 60 minutes after the response finishes by default. Verify before expiry or closing the client.

Check the returned signature kind:

* `provider_tee`: the signer selected before the request signed the request and response bytes. The result includes every verified model report that matches that signer.
* `gateway`: the verified Gateway signed those bytes.

Responses and Messages use Gateway signatures. See [Verification](https://docs.near.ai/cloud/verification) for custom policies and evidence requirements.

## OHTTP

OHTTP adds encryption between the client and the attested Gateway for Chat Completions, Responses, and Messages. It is optional, disabled by default, and requires Ed25519. See the [JavaScript](https://docs.near.ai/cloud/inference-sdk/javascript.md#ohttp), [Python](https://docs.near.ai/cloud/inference-sdk/python.md#ohttp), [Rust](https://docs.near.ai/cloud/inference-sdk/rust.md#ohttp), or [Go](https://docs.near.ai/cloud/inference-sdk/go.md#ohttp) configuration.

## Examples

* [SDK examples](https://github.com/nearai/inference-sdk/tree/main/examples): complete projects for each language.
* [Image provenance](https://docs.near.ai/cloud/verification/cloud-api/image-provenance.md): configure checks for selected image builds and Compose Manager deployments.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.