just-another-sdk

Installation

Install the package, add a validator, and set up a model key.

Install

bash pnpm add just-another-sdk

That is one package with no runtime dependencies. Nothing else is pulled in.

Add a validator

The SDK validates tool inputs through Standard Schema, so you bring your own validator. It is an optional peer dependency — install whichever you already use:

pnpm add zod

Zod is the smoothest path: the JSON Schema the model sees is derived from your schema automatically, with no extra setup.

Tools without arguments need no validator at all, so you can skip this step entirely if your agent only calls no-argument tools.

Get a model key

Claude, Gemini, and OpenAI have native providers, so if you already have one of those keys you are ready — set ANTHROPIC_API_KEY, GEMINI_API_KEY, or OPENAI_API_KEY and skip to the next page.

Otherwise the fastest option is OpenRouter — one key reaches hundreds of models across every major vendor, which makes swapping models a one-string change.

Create a key

Sign up at openrouter.ai/keys and create an API key. It starts with sk-or-.

Put it in your environment

.env
OPENROUTER_API_KEY=sk-or-v1-...

The provider reads OPENROUTER_API_KEY automatically. You can also pass it explicitly, which is what you want in a serverless function that gets its secrets from elsewhere:

openrouter('anthropic/claude-opus-5', { apiKey: mySecret })

Load it

Node can read a .env file with no library:

node --env-file=.env agent.ts

Prefer a different vendor? Providers covers the native Anthropic, Gemini, and OpenAI transports, Groq, Together, DeepSeek, local Ollama and vLLM, and how to write your own.

Never commit a key. Add .env to .gitignore. The SDK will not leak a key into an error message or a trace — see Errors — but it cannot help with a key committed to git.

Verify

hello.ts
import { Agent } from 'just-another-sdk'
import { openrouter } from 'just-another-sdk/providers'

const agent = new Agent({
  name: 'hello',
  model: openrouter('anthropic/claude-opus-5'),
})

console.log((await agent.run('Reply with the single word: working')).output)
node --env-file=.env hello.ts

If the key is missing or wrong you get a ConfigurationError or AuthenticationError naming the exact problem rather than a stack trace.

TypeScript

No configuration required. For the best experience make sure strict is on, and if you are on an older setup, use "moduleResolution": "bundler" (or node16 and later) so the package's subpath exports resolve.

tsconfig.json
{
  "compilerOptions": {
    "strict": true,
    "module": "preserve",
    "moduleResolution": "bundler"
  }
}

Next

On this page