Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.usewraith.xyz/llms.txt

Use this file to discover all available pages before exploring further.

By default, Wraith agents use a hosted Gemini model. You can replace it with OpenAI, Claude, or your own Gemini key to reduce cost or use a specific model.

Configuration

Pass the ai option when creating the Wraith client:
import { Wraith, Chain } from "@wraith-protocol/sdk";

const wraith = new Wraith({
  apiKey: "wraith_live_abc123",
  ai: {
    provider: "openai",
    apiKey: "sk-...",
  },
});
All agents created from this client use your specified AI provider.

Supported Providers

Providerai.providerAPI Key Format
Google Gemini"gemini"Gemini API key
OpenAI"openai"sk-...
Anthropic Claude"claude"Anthropic API key

OpenAI

const wraith = new Wraith({
  apiKey: "wraith_live_abc123",
  ai: {
    provider: "openai",
    apiKey: "sk-proj-...",
  },
});

const agent = await wraith.createAgent({
  name: "alice",
  chain: Chain.Horizen,
  wallet: "0x...",
  signature: "0x...",
});

// Chat uses your OpenAI key
const res = await agent.chat("send 0.1 ETH to bob.wraith");

Claude

const wraith = new Wraith({
  apiKey: "wraith_live_abc123",
  ai: {
    provider: "claude",
    apiKey: "sk-ant-...",
  },
});

Your Own Gemini Key

const wraith = new Wraith({
  apiKey: "wraith_live_abc123",
  ai: {
    provider: "gemini",
    apiKey: "AIza...",
  },
});

How It Works

The AI configuration is passed to the TEE server via HTTP headers on every request:
HeaderValue
AuthorizationBearer wraith_... (your Wraith API key)
X-AI-Provideropenai, claude, or gemini
X-AI-KeyYour AI provider API key
The TEE server:
  1. Receives your chat message
  2. Builds the system prompt with agent identity and tools
  3. Sends the conversation to your specified AI provider
  4. Executes any tool calls via the chain connector
  5. Returns the final response
Your AI key is only used server-side in the TEE. It’s never stored — used for the duration of the request only.

Default vs. BYOM

AspectDefault (Gemini)Bring Your Own
CostIncluded in Wraith API usageYou pay your AI provider directly
ModelWraith’s chosen Gemini modelYour choice
ConfigurationNonePass ai option

Tool Compatibility

All tools work identically regardless of the AI provider. The tool declarations are adapted to each provider’s function-calling format by the TEE server. Your code doesn’t change.
// Works the same with Gemini, OpenAI, or Claude
const res = await agent.chat("send 0.1 ETH to bob.wraith");
const res = await agent.chat("run a privacy check");
const res = await agent.chat("create an invoice for 1 ETH");