openclaw/docs/providers/nearai.md
2026-01-29 17:26:29 +08:00

4.2 KiB

summary read_when
Use NEAR AI private inference in Clawdbot
You want private inference with Intel TDX/NVIDIA TEE
You want NEAR AI setup guidance

NEAR AI

NEAR AI provides privacy-focused AI inference using confidential computing. All inference runs inside Intel TDX (Trust Domain Extensions) and NVIDIA TEE (Trusted Execution Environment), ensuring your prompts and responses are never logged or exposed to the host system.

Why NEAR AI in Clawdbot

  • Private inference - all computation happens inside secure enclaves.
  • Cryptographic verification - outputs are signed inside TEE before leaving.
  • No logging - prompts and responses are never stored.
  • OpenAI-compatible /v1 endpoints.

Privacy Technology

NEAR AI uses two layers of hardware-based security:

Technology Purpose
Intel TDX Isolates AI workloads in confidential VMs
NVIDIA TEE GPU-level isolation for model weights and computations

All AI outputs are cryptographically signed inside the TEE before leaving the secure environment, ensuring authenticity and integrity of responses.

Features

  • OpenAI-compatible API: Standard /v1/chat/completions endpoint
  • Streaming: Supported on all models
  • Function calling: Supported
  • Vision: Supported on vision-capable models

Setup

1. Get API Key

  1. Sign up at cloud.near.ai
  2. Go to your dashboard and generate an API key
  3. Copy your API key

2. Configure Clawdbot

Option A: Environment Variable

export NEARAI_API_KEY="your-api-key"

Option B: Interactive Setup (Recommended)

clawdbot onboard --auth-choice nearai-api-key

This will:

  1. Prompt for your API key (or use existing NEARAI_API_KEY)
  2. Configure the provider automatically
  3. Set NEAR AI as your default model

Option C: Non-interactive

clawdbot onboard --non-interactive \
  --auth-choice nearai-api-key \
  --nearai-api-key "your-api-key"

3. Verify Setup

clawdbot chat --model nearai/zai-org/GLM-4.7 "Hello, are you working?"

Model Selection

After setup, you can use any available NEAR AI model:

clawdbot models set nearai/zai-org/GLM-4.7
clawdbot models set nearai/deepseek-ai/DeepSeek-V3.1

List all available models:

clawdbot models list | grep nearai

Available Models

Note: The model list may change. See the latest available models at cloud.near.ai/models.

Model ID Name Context Cost ($/M tokens)
deepseek-ai/DeepSeek-V3.1 DeepSeek V3.1 128K $1.05 in / $3.10 out
openai/gpt-oss-120b GPT OSS 120B 131K $0.15 in / $0.55 out
Qwen/Qwen3-30B-A3B-Instruct-2507 Qwen3 30B 262K $0.15 in / $0.55 out
zai-org/GLM-4.7 GLM 4.7 (default) 131K $0.85 in / $3.30 out

Configure via clawdbot configure

  1. Run clawdbot configure
  2. Select Model/auth
  3. Choose NEAR AI

Usage Examples

# Use default model (GLM 4.7)
clawdbot chat --model nearai/zai-org/GLM-4.7

# Use DeepSeek for reasoning tasks
clawdbot chat --model nearai/deepseek-ai/DeepSeek-V3.1

# Use Qwen for long context (262K!)
clawdbot chat --model nearai/Qwen/Qwen3-30B-A3B-Instruct-2507

# Send a message
clawdbot agent --message "Explain quantum computing" --model nearai/zai-org/GLM-4.7

Troubleshooting

API key not recognized

echo $NEARAI_API_KEY
clawdbot models list | grep nearai

Ensure the environment variable is set correctly.

Connection issues

NEAR AI API is at https://cloud-api.near.ai/v1. Ensure your network allows HTTPS connections.

Config file example

{
  env: { NEARAI_API_KEY: "..." },
  agents: { defaults: { model: { primary: "nearai/zai-org/GLM-4.7" } } },
  models: {
    mode: "merge",
    providers: {
      "nearai": {
        baseUrl: "https://cloud-api.near.ai/v1",
        apiKey: "${NEARAI_API_KEY}",
        api: "openai-completions"
        // Models are auto-discovered from the built-in catalog
      }
    }
  }
}