agent-kit icon indicating copy to clipboard operation
agent-kit copied to clipboard

Add OrcaRouter model support

Open xilema2 opened this issue 6 months ago • 1 comments

Summary

Adds an orcarouter() model helper for OrcaRouter, an OpenAI-compatible LLM router that exposes 150+ upstream models behind a single endpoint, plus an adaptive orcarouter/auto router that picks an upstream per request.

Because OrcaRouter is OpenAI-compatible, the helper is a thin wrapper around the existing openai model: it reuses the openai-chat adapter and only changes the default base URL (https://api.orcarouter.ai/v1) and the API key environment variable (ORCAROUTER_API_KEY). This mirrors how grok is built on top of openai.

Disclosure: I'm an engineer on the OrcaRouter team.

Usage

import { createAgent, orcarouter } from "@inngest/agent-kit";

const agent = createAgent({
  name: "Code writer",
  system: "You are an expert TypeScript programmer.",
  // `orcarouter/auto` lets OrcaRouter pick the best upstream per request.
  model: orcarouter({ model: "orcarouter/auto" }),
});
The API key is read from ORCAROUTER_API_KEY by default, or can be passed explicitly via apiKey. Any of OrcaRouter's model IDs can be passed as a free-form string; orcarouter/auto uses the adaptive router configured in your routing console.

Changes
New orcarouter() helper (packages/agent-kit/src/orcarouter.ts), re-exported from models.ts.
Reuses the existing openai-chat adapter — no new adapter/format needed.
Pins authKey to the resolved OrcaRouter key so it never silently falls back to OPENAI_API_KEY.
Docs: new OrcaRouter reference page, Models concept page tab + env var list, sidebar entry.
Changeset (minor).
Testing
pnpm --filter @inngest/agent-kit type-check — passes
pnpm --filter @inngest/agent-kit test — passes (72 tests, incl. 7 new OrcaRouter tests covering format, base URL, API-key resolution, and onCall parameter merging)
pnpm --filter @inngest/agent-kit build — passes

xilema2 avatar May 29 '26 03:05 xilema2

🦋 Changeset detected

Latest commit: e4fc41bb2bd43cdff3c5f7fb2d60467239ec67f3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@inngest/agent-kit Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar May 29 '26 03:05 changeset-bot[bot]

👋 Checking in — the workflows don't seem to have run yet. Let me know if a maintainer needs to approve the run or if there's something I can do. Thanks!

jinhaosong-source avatar Jul 09 '26 03:07 jinhaosong-source