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 defaultconst 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)from toolnexus import create_toolkit, create_client
tk = await create_toolkit() # 10 built-ins, on by defaultagent = create_client( base_url="https://openrouter.ai/api/v1", style="openai", model="openai/gpt-4o-mini",)res = await agent.run("List the files here, then read the largest one.", tk)print(res.text)ctx := context.Background()tk, _ := toolnexus.CreateToolkit(ctx, toolnexus.Options{}) // 10 built-insagent := toolnexus.CreateClient(toolnexus.ClientOptions{ BaseURL: "https://openrouter.ai/api/v1", Style: toolnexus.StyleOpenAI, Model: "openai/gpt-4o-mini", APIKey: os.Getenv("OPENROUTER_API_KEY"),})res, _ := agent.Run(ctx, "List the files here, then read the largest one.", tk)fmt.Println(res.Text)Toolkit tk = Toolkit.create(new Toolkit.Options()); // 10 built-ins, on by defaultLlmClient agent = LlmClient.create(new LlmClient.Options() .baseUrl("https://openrouter.ai/api/v1") .style("openai") .model("openai/gpt-4o-mini"));System.out.println(agent.run("List the files here, then read the largest one.", tk).text);await using var tk = await Toolkit.CreateAsync(new Toolkit.Options()); // 10 built-insvar agent = LlmClient.Create(new LlmClient.Options { BaseUrl = "https://openrouter.ai/api/v1", Style = "openai", Model = "openai/gpt-4o-mini",});var res = await agent.RunAsync("List the files here, then read the largest one.", tk);Console.WriteLine(res.Text);{:ok, tk} = Toolnexus.create_toolkit() # 10 built-ins, on by defaultclient = Toolnexus.Client.create( base_url: "https://openrouter.ai/api/v1", style: "openai", model: "openai/gpt-4o-mini", api_key: System.get_env("OPENROUTER_API_KEY"))res = Toolnexus.Client.run(client, "List the files here, then read the largest one.", tk)IO.puts(res.text)Next: MCP servers.