Authentication
Every API request needs an authentication token. The SDK handles this through a getToken function you provide to any hook that makes API requests.
type GetToken = () => Promise<string | null>;The SDK calls this function before each request to get a fresh token. Return null if the user is not authenticated.
User Authentication with Privy
Use Privy for client-side applications where users authenticate with their own wallet and pay for inference directly. Users pay using USDC from their wallet, which means no inference costs for you as the developer. Privy supports embedded wallets, so users don’t need a browser extension.
import { useIdentityToken } from "@privy-io/react-auth";
function Chat() {
const { identityToken } = useIdentityToken();
const { sendMessage } = useChat({
getToken: async () => identityToken,
});
}See the Next.js Example for a complete Privy implementation.
API Key Authentication (coming soon)
Use API keys for server-side applications or when you as the developer pay for inference costs. API keys are passed via the Authorization header:
Authorization: Bearer <your-api-key>import { useChat } from "@reverbia/sdk/react";
const { sendMessage } = useChat({
getToken: async () => process.env.ANUMA_API_KEY,
});A developer dashboard is coming soon where you’ll be able to generate API keys and top up your balance with USDC or Stripe.