Test credit and test token

@angerona/sdk

A small TypeScript package: an OpenAI client set up for you, helpers for models and presets, and the end-to-end encrypted TEE flow.

This package is optional, since the plain OpenAI SDK does the job (see Developer API). On top of it you get three extras:

  • a client set up for Angerona
  • model and preset helpers
  • the full end-to-end encrypted TEE flow
npm install @angerona/sdk openai

The client is a standard OpenAI client

createAngeronaClient hands you an ordinary OpenAI client aimed at https://api.angerona.chat/v1 through baseURL, with the whole OpenAI SDK available.

import { createAngeronaClient } from "@angerona/sdk";

const angerona = createAngeronaClient({ apiKey: process.env.ANGERONA_API_KEY! });

const r = await angerona.chat.completions.create({
  model: "deepseek-v4.1-flash",
  messages: [{ role: "user", content: "Hi!" }],
});

Helpers read models and presets

import { listModels, presetModel } from "@angerona/sdk";

const { data } = await listModels({ apiKey: process.env.ANGERONA_API_KEY, type: "text" });
for (const m of data) {
  console.log(m.id, m.pricingKind, m.listPrice.inputPer1MUsd, m.marketPrice?.inputPer1MUsd);
}

const smart = await presetModel("Smart"); // e.g. "claude-sonnet-5.5"

The SDK carries the TEE flow

TEE runs in the app. With an API key, createTeeSession throws TeeNotAvailableError, so wrap it as shown:

import { createTeeSession, TeeNotAvailableError } from "@angerona/sdk";

try {
  const session = await createTeeSession({ apiKey: process.env.ANGERONA_API_KEY!, model: "e2ee-glm-5-3-p" });
  let id = "";
  for await (const part of session.chatStream([{ role: "user", content: "Something private" }])) {
    if (part.content) process.stdout.write(part.content); // decrypted on your machine
    if (part.id) id = part.id;
  }
  console.log("\nsigned by the attested enclave:", await session.verifyResponse(id));
} catch (e) {
  if (e instanceof TeeNotAvailableError) console.log("TEE runs in the app only.");
  else throw e;
}

createTeeSession works in five steps:

  • Attestation: a new attestation is fetched using a random 32-byte nonce. It must show a hardware pass, your nonce echoed back, and both the enclave's signing key and that nonce tied into the hardware report (TDX REPORTDATA).
  • Session key: a single-use key pair appears, kept in memory alone.
  • Encryption: each message is sealed to the enclave's key (ECDH secp256k1, then HKDF-SHA256, then AES-256-GCM), out of Angerona's reach and everyone else's.
  • Decryption: the streamed reply opens on your machine.
  • Signature: verifyResponse(id) tests the enclave's signature on that reply.

Lower-level helpers are exported as well: encryptForModel, decryptFromModel, checkAttestation and verifyResponseSignature.

Errors match the OpenAI classes

OpenAI's error classes apply here too. API errors lists the codes.