NEAR AI Cloud
Use the NEAR AI Cloud OpenAI compatible API with the AI SDK.
NEAR AI Cloud provides TEE-backed inference through an OpenAI-compatible API. You can use it with the AI SDK through the @ai-sdk/openai-compatible module.
Setup
The NEAR AI Cloud provider is available via the @ai-sdk/openai-compatible module as it is compatible with the OpenAI API. You can install it with:
$ pnpm add @ai-sdk/openai-compatible
$ npm install @ai-sdk/openai-compatible
$ yarn add @ai-sdk/openai-compatible
$ bun add @ai-sdk/openai-compatible
Provider Instance
To use NEAR AI Cloud, you can create a custom provider instance with the createOpenAICompatible function from @ai-sdk/openai-compatible:
You can create an API key in NEAR AI Cloud. Make sure
to set the NEARAI_API_KEY environment variable with your API key.
Language Models
You can create NEAR AI Cloud models using a provider instance. The first argument is the model ID from the public model catalog, e.g. zai-org/GLM-5.1-FP8.
Example
You can use NEAR AI Cloud language models to generate text with the generateText function:
NEAR AI Cloud language models can also generate text in a streaming fashion with the streamText function:
You can use any supported modelId from the NEAR AI Cloud model catalog. Model metadata includes context length, modalities, and whether TEE attestation is supported for that model.