- I'll write the code myself
- Claude Code
- Codex
1
Get your API key
Go to the claim page and sign in. You get an API key and test credits instantly — no approval wait.
2
Set up your project
Create a fresh project and install the SDK:Then put the key from Step 1 into your shell’s environment — the code in the next step reads it from there, it isn’t written into any file:
Using Next.js, Vite, or another bundler?
Using Next.js, Vite, or another bundler?
A handful of teams have hit WASM-loading errors under Next.js/Turbopack, Vite, and older Webpack setups — the SDK loads a WASM component, and some bundlers try to process it in ways that break it. If you hit a WASM parse or module-loading error later in this guide and you’re in a bundled framework, try running the SDK code from a plain Node script or a server-only route first, to confirm your setup works before debugging the bundler. If you’re on Next.js specifically, adding your bundler’s equivalent of an external-packages/no-bundle exception for
@terminal3/t3n-sdk is worth trying. We’re tracking this as a known rough edge — if you find a config that fixes it, tell us in the developer Telegram and we’ll document it here properly.3
Connect and authenticate
Create a file named
quickstart.ts in your project and paste this in — don’t run any of it in a terminal directly, it’s TypeScript, not shell commands:“Reuse this variable” means literally keep coding in this same file.
t3n and tenantDid are plain JavaScript variables — they only exist inside this one running script. The code samples on later pages (TenantClient, contract registration, invocation) assume t3n/tenantDid/tenant are already in scope, so append each new snippet to the bottom of this same quickstart.ts rather than starting a new file, unless you deliberately repeat the connect-and-authenticate block above at the top of it.Under the Hood: what is setEnvironment doing?
Under the Hood: what is setEnvironment doing?
setEnvironment("testnet" | "production") tells the SDK which T3N cluster to resolve a node URL from for every client you create afterward — you never hardcode a node URL yourself. It defaults to "production", which is why setting it explicitly matters while you’re still building against testnet.4
Run it
From the same directory as If you see a
quickstart.ts:did:t3n:... value printed, you’re connected.What’s next
You now have two things every later page assumes you already have: an authenticatedt3n client and its tenantDid. Keep both around (same variable names, same file) as you continue:
- Building something that actually runs inside the confidential-compute enclave → Write your first TEE contract
- Letting an AI agent act on a user’s behalf → Agent Auth
- The shape of the whole ADK before you dive in further → ADK Tour
- Hit an error? → Common Errors