404. Do not use direct response signatures as a production verification gate.
Use DirectInferenceClient only when maintaining an existing direct integration.
Install
The package requires Node.js 24 or later.Send and verify an E2EE Chat Completion
verifyResponse() is explicit. For a streaming completion, consume the entire stream first, then call it with the completion ID so the SDK can verify the exact response bytes.Add OHTTP
Setohttp: true to encapsulate Chat requests and responses with OHTTP. OHTTP uses the SDK’s default Ed25519 signing algorithm; it is not compatible with signingAlgo: 'ecdsa'.
verifyResponse() calls stay the same. The SDK verifies the direct endpoint’s signed OHTTP configuration before sending Chat; a missing or invalid configuration blocks the request. For a direct endpoint, both OHTTP and E2EE are scoped to the model service.
OHTTP applies only to Chat. Attestation and signature requests remain regular HTTPS. The configured endpoint or proxy must expose
/ohttp at the same origin. Authorization and custom headers sent on the outer request, along with the client’s network address, are not hidden by OHTTP.Node, browser, and proxy integrations
The example uses@nearai/inference-sdk/node. Direct endpoint TLS binding is not currently enabled; normal HTTPS certificate validation still applies.
For a browser or an application proxy, import from @nearai/inference-sdk. Configure the same explicit baseUrl for the endpoint your application uses.
Examples
See the Inference SDK examples and setup instructions for runnable direct-endpoint projects.- DirectInferenceClient: streaming and non-streaming Chat with E2EE and response verification.
- OpenAI SDK integration: use
DirectInferenceClient.fetchwith the OpenAI client. - Manual verification: verify model attestations and response signatures directly. This example sends plaintext Chat bodies over HTTPS without E2EE.
Next steps
Verification
Understand the attestation and response-signature checks behind this flow.
E2EE Chat
Learn the protocol when you need to manage encryption yourself.