Authentication
Every API request requires authentication. Anuma supports two methods: API keys and user authentication with Privy. Both require an app on dashboard.anuma.ai .
API Key Authentication
Use API keys for server-side applications, backends, scripts, or when you as the developer pay for inference costs. This is the simplest way to get started.
Setup
- Create an app on dashboard.anuma.ai
- Go to the Auth tab and add an API key
- Copy the secret — it’s only shown once
API keys use the anuma_live_ prefix (or anuma_test_ for test keys).
Usage
API keys are sent via the X-API-KEY header:
X-API-KEY: <your-api-key>When to use
API keys are a good fit when your application runs on a server or in an environment where you control the credentials. You pay for all inference costs from your app’s balance. Typical use cases include backends, internal tools, and prototyping.
User Authentication with Privy
Use Privy for client-side applications where each user authenticates with their own wallet. Privy supports embedded wallets, so users don’t need a browser extension.
Setup
- Create an app on dashboard.anuma.ai
- Create a Privy app at privy.io
- In the Privy dashboard, go to Configuration → App Settings → Basics. Copy your App ID and click “Verify with key instead” to get the verification key.
- In the Privy dashboard, go to Authentication → Advanced and enable “Return user data in an identity token”.
- In the Anuma dashboard, go to your app’s Auth tab, add Privy as an auth method, and paste the App ID and verification key.
Usage
Privy tokens are sent via the Authorization: Bearer header. Use the useIdentityToken hook from Privy to get the token:
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.
When to use
Privy is a good fit for user-facing applications where each user has their own identity and wallet. This works well for consumer apps, community tools, and any product where users need individual accounts.