/v1/chat/completions. Tier 4 also uses /v1/handshake for ephemeral key exchange before the encrypted request is transmitted.
The z.infer() function is the equivalent interface available to smart contracts on the host EVM chain. Z Trade and Z Lend use this path to compose inference with on-chain actions. The REST interface is the primary path for application developers; the contract-callable path is the primary path for on-chain finance activities.
Call Format for REST API
A standard request mirrors OpenAI’s Chat Completions:z_metadata event is emitted after the final encrypted chunk, carrying a silicon-signed completion summary that the gateway reads to finalize billing. The Z TypeScript SDK handles both the decryption and the metadata verification transparently.
Tier selection
Tier is selected by suffixing the model identifier (deepseek-v3:tee) or by setting the X-Z-Tier header. The two are equivalent and either is sufficient. See Trust tiers for the operational meaning of each tier.
Privacy mode
For Tiers 1 through 3, the gateway is the trust boundary: prompts arrive at the gateway in plaintext, are routed to the selected upstream, and the response is relayed back. Z does not retain content on any tier as a matter of policy. For Tier 4, the trust boundary is the TEE node itself. Before issuing the request, the client performs a handshake against/v1/handshake, receives a long-term TEE identity key and an ephemeral session public key, validates the attestation chain on the long-term key, and encrypts the prompt to the ephemeral session key under AES-256-GCM with a fresh random nonce. The gateway relays the ciphertext without inspection and holds no decryption key.
On-chain invocation
z.infer() is callable from Solidity contracts. The call format from a contract is structurally similar to the REST call: a model identifier (optionally tier-suffixed), a payload, and a callback for receiving the response. The contract pays from its own balance and acts on the response when it returns.