Skip to content

Zero to agent

The three-liner: a toolkit with the ten built-in tools, a client pointed at any OpenAI- or Anthropic-style endpoint, and one run. API keys are read from the environment (OPENROUTER_API_KEY, then OPENAI_API_KEY / ANTHROPIC_API_KEY) and never printed.

import { createToolkit, createClient } from "toolnexus"
const tk = await createToolkit() // 10 built-ins, on by default
const agent = createClient({
baseUrl: "https://openrouter.ai/api/v1", style: "openai",
model: "openai/gpt-4o-mini", apiKey: process.env.OPENROUTER_API_KEY,
})
const res = await agent.run("List the files here, then read the largest one.", tk)
console.log(res.text)

Next: MCP servers.