1

Prerequisites

You need an AgentRouter API key and the API base URL.

  • Create an API key with the Platform API type -- it is shown once, as <keyid>.<secret>. Copy it now.
  • Base URL https://api.tetrate.ai (or your tenant's). Set AGENTROUTER_API_KEY and optionally AGENTROUTER_BASE_URL in your environment.
2

Install

Download the TypeScript SDK pack from the SDKs page, then record it as a file: dependency (never the public npm registry). Open the SDKs page

Install
npm install ./agentrouter-typescript-0.1.1.tgz
3

Your first call -- whoami

Resolve the identity behind your API key with a read-only GET /v1/me call. Copy the files below. Run with `bun run index.ts` (or `tsx index.ts`).

// Runnable example for the AgentRouter TypeScript SDK.
// Set AGENTROUTER_BASE_URL and AGENTROUTER_API_KEY in the environment, then run `npm install && npx tsx index.ts`.
import { Client } from '@tetrate/agentrouter-sdk'

const client = new Client({
  baseUrl: process.env.AGENTROUTER_BASE_URL,
  apiKey: process.env.AGENTROUTER_API_KEY,
})

// Replace the placeholder values below.
try {
  const result = await client.me.get()
  console.log(result)
} catch (err) {
  console.error('Error:', err)
}
{
  "name": "me",
  "version": "0.1.0",
  "private": true,
  "type": "module",
  "dependencies": {
    "@tetrate/agentrouter-sdk": "file:./third_party/agentrouter-typescript-0.1.1"
  },
  "devDependencies": {
    "@types/node": "^20.0.0",
    "typescript": "^5.4.0"
  }
}
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true
  }
}

← All languages · Download SDKs · API reference