[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-openrouter-openrouter-agent-migration":3,"mdc--2dtkq9-key":33,"related-org-openrouter-openrouter-agent-migration":6483,"related-repo-openrouter-openrouter-agent-migration":6619},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":12,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":29,"sourceUrl":31,"mdContent":32},"openrouter-agent-migration","migrate OpenRouter SDK to agent patterns","Migration guide from @openrouter\u002Fsdk to @openrouter\u002Fagent for callModel, tool(), stop conditions, and agent features. This skill should be used when code imports callModel, tool(), or stop conditions from @openrouter\u002Fsdk and needs to migrate to @openrouter\u002Fagent.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},"openrouter","OpenRouter","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fopenrouter.png","OpenRouterTeam",[13,17,20],{"name":14,"slug":15,"type":16},"TypeScript","typescript","tag",{"name":18,"slug":19,"type":16},"Migration","migration",{"name":21,"slug":22,"type":16},"SDK","sdk",187,"https:\u002F\u002Fgithub.com\u002FOpenRouterTeam\u002Fskills","2026-07-14T05:38:28.914981",null,26,[],{"repoUrl":24,"stars":23,"forks":27,"topics":30,"description":26},[],"https:\u002F\u002Fgithub.com\u002FOpenRouterTeam\u002Fskills\u002Ftree\u002FHEAD\u002Fskills\u002Fopenrouter-agent-migration","---\nname: openrouter-agent-migration\ndescription: Migration guide from @openrouter\u002Fsdk to @openrouter\u002Fagent for callModel, tool(), stop conditions, and agent features. This skill should be used when code imports callModel, tool(), or stop conditions from @openrouter\u002Fsdk and needs to migrate to @openrouter\u002Fagent.\nversion: 1.0.0\n---\n\n# Migrating from @openrouter\u002Fsdk to @openrouter\u002Fagent\n\nAgent functionality (`callModel`, `tool()`, stop conditions, format converters, streaming helpers) has moved from `@openrouter\u002Fsdk` to the standalone `@openrouter\u002Fagent` package. The `@openrouter\u002Fagent` package includes its own `OpenRouter` client class, so you do not need `@openrouter\u002Fsdk` for agent use cases.\n\n---\n\n## When This Applies\n\nMigrate if your code imports any of these from `@openrouter\u002Fsdk`:\n\n- `callModel` or uses `client.callModel()`\n- `tool()` factory function\n- Stop conditions: `stepCountIs`, `hasToolCall`, `maxCost`, `maxTokensUsed`, `finishReasonIs`\n- Format converters: `fromClaudeMessages`, `toClaudeMessage`, `fromChatMessages`, `toChatMessage`\n- Types: `Tool`, `ToolWithExecute`, `ToolWithGenerator`, `ManualTool`, `CallModelInput`, `ModelResult`\n\n---\n\n## Quick Migration\n\n### Step 1: Install\n\n```bash\nnpm install @openrouter\u002Fagent\n```\n\nIf you only use agent features, you can remove `@openrouter\u002Fsdk`:\n\n```bash\nnpm uninstall @openrouter\u002Fsdk\nnpm install @openrouter\u002Fagent\n```\n\nIf you also use non-agent SDK features (models list, chat completions, credits, OAuth, API keys), keep both packages installed.\n\n### Step 2: Update Imports\n\nThe `OpenRouter` client class and `client.callModel()` pattern work identically. Only the import source changes:\n\n```diff\n- import OpenRouter from '@openrouter\u002Fsdk';\n+ import { OpenRouter } from '@openrouter\u002Fagent';\n```\n\nThe rest of your code stays the same:\n\n```typescript\nconst client = new OpenRouter({ apiKey: process.env.OPENROUTER_API_KEY });\n\nconst result = client.callModel({\n  model: 'openai\u002Fgpt-5-nano',\n  input: 'Hello!',\n});\n\nconst text = await result.getText();\n```\n\n---\n\n## Complete Import Mapping\n\n### Client & callModel\n\n| Old | New |\n|-----|-----|\n| `import OpenRouter from '@openrouter\u002Fsdk'` | `import { OpenRouter } from '@openrouter\u002Fagent'` |\n| `import OpenRouter, { tool, stepCountIs } from '@openrouter\u002Fsdk'` | `import { OpenRouter } from '@openrouter\u002Fagent'`\u003Cbr>`import { tool } from '@openrouter\u002Fagent\u002Ftool'`\u003Cbr>`import { stepCountIs } from '@openrouter\u002Fagent\u002Fstop-conditions'` |\n\nA standalone `callModel` function is also available for advanced use cases where a pre-existing `OpenRouterCore` instance is available:\n\n```typescript\nimport { callModel } from '@openrouter\u002Fagent\u002Fcall-model';\n\n\u002F\u002F Requires an OpenRouterCore instance (from @openrouter\u002Fsdk\u002Fcore)\nconst result = callModel(coreInstance, { model: 'openai\u002Fgpt-5-nano', input: 'Hello' });\n```\n\nFor most use cases, prefer the `client.callModel()` method shown above.\n\n### Tool Creation\n\n| Old | New |\n|-----|-----|\n| `import { tool } from '@openrouter\u002Fsdk'` | `import { tool } from '@openrouter\u002Fagent\u002Ftool'` |\n\n### Stop Conditions\n\n| Old | New |\n|-----|-----|\n| `import { stepCountIs, hasToolCall, maxCost } from '@openrouter\u002Fsdk'` | `import { stepCountIs, hasToolCall, maxCost } from '@openrouter\u002Fagent\u002Fstop-conditions'` |\n| `import { maxTokensUsed, finishReasonIs } from '@openrouter\u002Fsdk'` | `import { maxTokensUsed, finishReasonIs } from '@openrouter\u002Fagent\u002Fstop-conditions'` |\n\n### Types\n\n| Old | New |\n|-----|-----|\n| `import type { Tool, ToolWithExecute, ToolWithGenerator, ManualTool } from '@openrouter\u002Fsdk\u002Flib\u002Ftool-types'` | `import type { Tool, ToolWithExecute, ToolWithGenerator, ManualTool } from '@openrouter\u002Fagent\u002Ftool-types'` |\n| `import type { CallModelInput } from '@openrouter\u002Fsdk\u002Flib\u002Fasync-params'` | `import type { CallModelInput } from '@openrouter\u002Fagent\u002Fasync-params'` |\n| `import { ModelResult } from '@openrouter\u002Fsdk\u002Flib\u002Fmodel-result'` | `import { ModelResult } from '@openrouter\u002Fagent\u002Fmodel-result'` |\n\n### Format Converters\n\n| Old | New |\n|-----|-----|\n| `import { fromClaudeMessages, toClaudeMessage } from '@openrouter\u002Fsdk'` | `import { fromClaudeMessages, toClaudeMessage } from '@openrouter\u002Fagent'` |\n| `import { fromChatMessages, toChatMessage } from '@openrouter\u002Fsdk'` | `import { fromChatMessages, toChatMessage } from '@openrouter\u002Fagent'` |\n\n### Type Guards\n\n| Old | New |\n|-----|-----|\n| `import { hasExecuteFunction, isGeneratorTool, isRegularExecuteTool } from '@openrouter\u002Fsdk'` | `import { hasExecuteFunction, isGeneratorTool, isRegularExecuteTool } from '@openrouter\u002Fagent\u002Ftool-types'` |\n\n---\n\n## Before & After Example\n\n### Before (using @openrouter\u002Fsdk)\n\n```typescript\nimport OpenRouter, { tool, stepCountIs, hasToolCall } from '@openrouter\u002Fsdk';\nimport { z } from 'zod';\n\nconst client = new OpenRouter({\n  apiKey: process.env.OPENROUTER_API_KEY,\n});\n\nconst searchTool = tool({\n  name: 'web_search',\n  description: 'Search the web',\n  inputSchema: z.object({ query: z.string() }),\n  outputSchema: z.object({ results: z.array(z.string()) }),\n  execute: async ({ query }) => {\n    return { results: ['Result 1', 'Result 2'] };\n  },\n});\n\nconst finishTool = tool({\n  name: 'finish',\n  description: 'Complete the task',\n  inputSchema: z.object({ answer: z.string() }),\n  execute: async ({ answer }) => ({ answer }),\n});\n\nconst result = client.callModel({\n  model: 'openai\u002Fgpt-5-nano',\n  instructions: 'You are a research assistant.',\n  input: 'What are the latest AI developments?',\n  tools: [searchTool, finishTool],\n  stopWhen: [stepCountIs(10), hasToolCall('finish')],\n});\n\nconst text = await result.getText();\n```\n\n### After (using @openrouter\u002Fagent)\n\n```typescript\nimport { OpenRouter } from '@openrouter\u002Fagent';\nimport { tool } from '@openrouter\u002Fagent\u002Ftool';\nimport { stepCountIs, hasToolCall } from '@openrouter\u002Fagent\u002Fstop-conditions';\nimport { z } from 'zod';\n\nconst client = new OpenRouter({\n  apiKey: process.env.OPENROUTER_API_KEY,\n});\n\nconst searchTool = tool({\n  name: 'web_search',\n  description: 'Search the web',\n  inputSchema: z.object({ query: z.string() }),\n  outputSchema: z.object({ results: z.array(z.string()) }),\n  execute: async ({ query }) => {\n    return { results: ['Result 1', 'Result 2'] };\n  },\n});\n\nconst finishTool = tool({\n  name: 'finish',\n  description: 'Complete the task',\n  inputSchema: z.object({ answer: z.string() }),\n  execute: async ({ answer }) => ({ answer }),\n});\n\nconst result = client.callModel({\n  model: 'openai\u002Fgpt-5-nano',\n  instructions: 'You are a research assistant.',\n  input: 'What are the latest AI developments?',\n  tools: [searchTool, finishTool],\n  stopWhen: [stepCountIs(10), hasToolCall('finish')],\n});\n\nconst text = await result.getText();\n```\n\nThe only changes are the three import lines at the top.\n\n---\n\n## When to Keep @openrouter\u002Fsdk\n\nKeep `@openrouter\u002Fsdk` installed if you use any of these non-agent features:\n\n| Feature | Access |\n|---------|--------|\n| Model listing | `client.models.list()` |\n| Chat completions | `client.chat.send()` |\n| Legacy completions | `client.completions.generate()` |\n| Usage analytics | `client.analytics.getUserActivity()` |\n| Credit balance | `client.credits.getCredits()` |\n| API key management | `client.apiKeys.list()`, `.create()`, etc. |\n| OAuth PKCE flow | `client.oAuth.createAuthCode()`, `.exchangeAuthCodeForAPIKey()` |\n\nFor mixed projects, use `@openrouter\u002Fsdk` for these features and `@openrouter\u002Fagent` for agent features:\n\n```typescript\nimport OpenRouter from '@openrouter\u002Fsdk';               \u002F\u002F SDK client for models, credits, etc.\nimport { OpenRouter as Agent } from '@openrouter\u002Fagent'; \u002F\u002F Agent client for callModel\nimport { tool } from '@openrouter\u002Fagent\u002Ftool';\nimport { stepCountIs } from '@openrouter\u002Fagent\u002Fstop-conditions';\n\n\u002F\u002F Use SDK client for non-agent features\nconst sdkClient = new OpenRouter({ apiKey: process.env.OPENROUTER_API_KEY });\nconst models = await sdkClient.models.list();\nconst credits = await sdkClient.credits.getCredits();\n\n\u002F\u002F Use Agent client for callModel\nconst agent = new Agent({ apiKey: process.env.OPENROUTER_API_KEY });\nconst result = agent.callModel({\n  model: 'openai\u002Fgpt-5-nano',\n  input: 'Hello!',\n  tools: [myTool],\n  stopWhen: stepCountIs(5),\n});\n```\n\n---\n\n## New Features in @openrouter\u002Fagent\n\nThese features are only available in `@openrouter\u002Fagent`, not in `@openrouter\u002Fsdk`:\n\n### Shared Context Schema\n\nType-safe shared state across all tools in a conversation:\n\n```typescript\nimport { OpenRouter } from '@openrouter\u002Fagent';\nimport { z } from 'zod';\n\nconst client = new OpenRouter({ apiKey: '...' });\n\nconst result = client.callModel({\n  model: 'openai\u002Fgpt-5-nano',\n  input: 'Process this data',\n  sharedContextSchema: z.object({\n    userId: z.string(),\n    sessionData: z.record(z.unknown()),\n  }),\n  context: {\n    shared: { userId: '123', sessionData: {} },\n  },\n  tools: [myTool],\n});\n```\n\n### Tool Context\n\nTools can declare their own typed context and access shared context:\n\n```typescript\nimport { tool } from '@openrouter\u002Fagent\u002Ftool';\nimport { z } from 'zod';\n\nconst myTool = tool({\n  name: 'my_tool',\n  description: 'A tool with context',\n  inputSchema: z.object({ query: z.string() }),\n  contextSchema: z.object({ apiKey: z.string() }),\n  execute: async (params, context) => {\n    \u002F\u002F context.local — this tool's own context\n    \u002F\u002F context.shared — shared context across all tools\n    \u002F\u002F context.setContext({ ... }) — update this tool's context\n    \u002F\u002F context.setSharedContext({ ... }) — update shared context\n    return { result: 'done' };\n  },\n});\n```\n\n### Tool Approval Flow\n\nRequire user approval before tool execution:\n\n```typescript\nconst dangerousTool = tool({\n  name: 'delete_file',\n  description: 'Delete a file',\n  inputSchema: z.object({ path: z.string() }),\n  requireApproval: true, \u002F\u002F or a function: (toolCall, context) => boolean\n  execute: async ({ path }) => { \u002F* ... *\u002F },\n});\n```\n\n### Turn Lifecycle Callbacks\n\n```typescript\nconst result = client.callModel({\n  model: 'openai\u002Fgpt-5-nano',\n  input: 'Complex task',\n  tools: [myTool],\n  onTurnStart: async (context) => {\n    console.log(`Starting turn ${context.numberOfTurns}`);\n  },\n  onTurnEnd: async (context, response) => {\n    console.log(`Turn ${context.numberOfTurns} complete`);\n  },\n});\n```\n\n---\n\n## All Subpath Exports\n\n`@openrouter\u002Fagent` provides granular subpath imports:\n\n| Subpath | Exports |\n|---------|---------|\n| `@openrouter\u002Fagent` | Barrel: all exports below |\n| `@openrouter\u002Fagent\u002Fclient` | `OpenRouter` class |\n| `@openrouter\u002Fagent\u002Fcall-model` | `callModel` standalone function |\n| `@openrouter\u002Fagent\u002Ftool` | `tool()` factory function |\n| `@openrouter\u002Fagent\u002Ftool-types` | `Tool`, `ToolWithExecute`, `ToolWithGenerator`, `ManualTool`, type guards |\n| `@openrouter\u002Fagent\u002Fstop-conditions` | `stepCountIs`, `hasToolCall`, `maxCost`, `maxTokensUsed`, `finishReasonIs` |\n| `@openrouter\u002Fagent\u002Fmodel-result` | `ModelResult` response wrapper |\n| `@openrouter\u002Fagent\u002Fasync-params` | `CallModelInput`, `hasAsyncFunctions`, `resolveAsyncFunctions` |\n| `@openrouter\u002Fagent\u002Fanthropic-compat` | `fromClaudeMessages`, `toClaudeMessage` |\n| `@openrouter\u002Fagent\u002Fchat-compat` | `fromChatMessages`, `toChatMessage` |\n| `@openrouter\u002Fagent\u002Fconversation-state` | `createInitialState`, `updateState`, `appendToMessages` |\n| `@openrouter\u002Fagent\u002Fnext-turn-params` | `nextTurnParams` utilities |\n| `@openrouter\u002Fagent\u002Fstream-transformers` | `extractUnsupportedContent`, `getUnsupportedContentSummary` |\n| `@openrouter\u002Fagent\u002Ftool-context` | `buildToolExecuteContext`, `ToolContextStore` |\n| `@openrouter\u002Fagent\u002Ftool-event-broadcaster` | `ToolEventBroadcaster` |\n| `@openrouter\u002Fagent\u002Fturn-context` | `buildTurnContext` |\n\n",{"data":34,"body":36},{"name":4,"description":6,"version":35},"1.0.0",{"type":37,"children":38},"root",[39,48,108,112,119,131,279,282,288,295,329,340,380,385,391,410,435,440,720,723,729,735,823,843,1003,1015,1021,1061,1067,1129,1135,1218,1224,1286,1292,1333,1336,1342,1348,2470,2476,3588,3593,3596,3602,3614,3771,3790,4400,4403,4409,4427,4433,4438,4936,4942,4947,5394,5400,5405,5650,5656,6010,6013,6019,6029,6477],{"type":40,"tag":41,"props":42,"children":44},"element","h1",{"id":43},"migrating-from-openroutersdk-to-openrouteragent",[45],{"type":46,"value":47},"text","Migrating from @openrouter\u002Fsdk to @openrouter\u002Fagent",{"type":40,"tag":49,"props":50,"children":51},"p",{},[52,54,61,63,69,71,77,79,85,87,92,94,99,101,106],{"type":46,"value":53},"Agent functionality (",{"type":40,"tag":55,"props":56,"children":58},"code",{"className":57},[],[59],{"type":46,"value":60},"callModel",{"type":46,"value":62},", ",{"type":40,"tag":55,"props":64,"children":66},{"className":65},[],[67],{"type":46,"value":68},"tool()",{"type":46,"value":70},", stop conditions, format converters, streaming helpers) has moved from ",{"type":40,"tag":55,"props":72,"children":74},{"className":73},[],[75],{"type":46,"value":76},"@openrouter\u002Fsdk",{"type":46,"value":78}," to the standalone ",{"type":40,"tag":55,"props":80,"children":82},{"className":81},[],[83],{"type":46,"value":84},"@openrouter\u002Fagent",{"type":46,"value":86}," package. The ",{"type":40,"tag":55,"props":88,"children":90},{"className":89},[],[91],{"type":46,"value":84},{"type":46,"value":93}," package includes its own ",{"type":40,"tag":55,"props":95,"children":97},{"className":96},[],[98],{"type":46,"value":9},{"type":46,"value":100}," client class, so you do not need ",{"type":40,"tag":55,"props":102,"children":104},{"className":103},[],[105],{"type":46,"value":76},{"type":46,"value":107}," for agent use cases.",{"type":40,"tag":109,"props":110,"children":111},"hr",{},[],{"type":40,"tag":113,"props":114,"children":116},"h2",{"id":115},"when-this-applies",[117],{"type":46,"value":118},"When This Applies",{"type":40,"tag":49,"props":120,"children":121},{},[122,124,129],{"type":46,"value":123},"Migrate if your code imports any of these from ",{"type":40,"tag":55,"props":125,"children":127},{"className":126},[],[128],{"type":46,"value":76},{"type":46,"value":130},":",{"type":40,"tag":132,"props":133,"children":134},"ul",{},[135,152,162,201,233],{"type":40,"tag":136,"props":137,"children":138},"li",{},[139,144,146],{"type":40,"tag":55,"props":140,"children":142},{"className":141},[],[143],{"type":46,"value":60},{"type":46,"value":145}," or uses ",{"type":40,"tag":55,"props":147,"children":149},{"className":148},[],[150],{"type":46,"value":151},"client.callModel()",{"type":40,"tag":136,"props":153,"children":154},{},[155,160],{"type":40,"tag":55,"props":156,"children":158},{"className":157},[],[159],{"type":46,"value":68},{"type":46,"value":161}," factory function",{"type":40,"tag":136,"props":163,"children":164},{},[165,167,173,174,180,181,187,188,194,195],{"type":46,"value":166},"Stop conditions: ",{"type":40,"tag":55,"props":168,"children":170},{"className":169},[],[171],{"type":46,"value":172},"stepCountIs",{"type":46,"value":62},{"type":40,"tag":55,"props":175,"children":177},{"className":176},[],[178],{"type":46,"value":179},"hasToolCall",{"type":46,"value":62},{"type":40,"tag":55,"props":182,"children":184},{"className":183},[],[185],{"type":46,"value":186},"maxCost",{"type":46,"value":62},{"type":40,"tag":55,"props":189,"children":191},{"className":190},[],[192],{"type":46,"value":193},"maxTokensUsed",{"type":46,"value":62},{"type":40,"tag":55,"props":196,"children":198},{"className":197},[],[199],{"type":46,"value":200},"finishReasonIs",{"type":40,"tag":136,"props":202,"children":203},{},[204,206,212,213,219,220,226,227],{"type":46,"value":205},"Format converters: ",{"type":40,"tag":55,"props":207,"children":209},{"className":208},[],[210],{"type":46,"value":211},"fromClaudeMessages",{"type":46,"value":62},{"type":40,"tag":55,"props":214,"children":216},{"className":215},[],[217],{"type":46,"value":218},"toClaudeMessage",{"type":46,"value":62},{"type":40,"tag":55,"props":221,"children":223},{"className":222},[],[224],{"type":46,"value":225},"fromChatMessages",{"type":46,"value":62},{"type":40,"tag":55,"props":228,"children":230},{"className":229},[],[231],{"type":46,"value":232},"toChatMessage",{"type":40,"tag":136,"props":234,"children":235},{},[236,238,244,245,251,252,258,259,265,266,272,273],{"type":46,"value":237},"Types: ",{"type":40,"tag":55,"props":239,"children":241},{"className":240},[],[242],{"type":46,"value":243},"Tool",{"type":46,"value":62},{"type":40,"tag":55,"props":246,"children":248},{"className":247},[],[249],{"type":46,"value":250},"ToolWithExecute",{"type":46,"value":62},{"type":40,"tag":55,"props":253,"children":255},{"className":254},[],[256],{"type":46,"value":257},"ToolWithGenerator",{"type":46,"value":62},{"type":40,"tag":55,"props":260,"children":262},{"className":261},[],[263],{"type":46,"value":264},"ManualTool",{"type":46,"value":62},{"type":40,"tag":55,"props":267,"children":269},{"className":268},[],[270],{"type":46,"value":271},"CallModelInput",{"type":46,"value":62},{"type":40,"tag":55,"props":274,"children":276},{"className":275},[],[277],{"type":46,"value":278},"ModelResult",{"type":40,"tag":109,"props":280,"children":281},{},[],{"type":40,"tag":113,"props":283,"children":285},{"id":284},"quick-migration",[286],{"type":46,"value":287},"Quick Migration",{"type":40,"tag":289,"props":290,"children":292},"h3",{"id":291},"step-1-install",[293],{"type":46,"value":294},"Step 1: Install",{"type":40,"tag":296,"props":297,"children":302},"pre",{"className":298,"code":299,"language":300,"meta":301,"style":301},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","npm install @openrouter\u002Fagent\n","bash","",[303],{"type":40,"tag":55,"props":304,"children":305},{"__ignoreMap":301},[306],{"type":40,"tag":307,"props":308,"children":311},"span",{"class":309,"line":310},"line",1,[312,318,324],{"type":40,"tag":307,"props":313,"children":315},{"style":314},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[316],{"type":46,"value":317},"npm",{"type":40,"tag":307,"props":319,"children":321},{"style":320},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[322],{"type":46,"value":323}," install",{"type":40,"tag":307,"props":325,"children":326},{"style":320},[327],{"type":46,"value":328}," @openrouter\u002Fagent\n",{"type":40,"tag":49,"props":330,"children":331},{},[332,334,339],{"type":46,"value":333},"If you only use agent features, you can remove ",{"type":40,"tag":55,"props":335,"children":337},{"className":336},[],[338],{"type":46,"value":76},{"type":46,"value":130},{"type":40,"tag":296,"props":341,"children":343},{"className":298,"code":342,"language":300,"meta":301,"style":301},"npm uninstall @openrouter\u002Fsdk\nnpm install @openrouter\u002Fagent\n",[344],{"type":40,"tag":55,"props":345,"children":346},{"__ignoreMap":301},[347,364],{"type":40,"tag":307,"props":348,"children":349},{"class":309,"line":310},[350,354,359],{"type":40,"tag":307,"props":351,"children":352},{"style":314},[353],{"type":46,"value":317},{"type":40,"tag":307,"props":355,"children":356},{"style":320},[357],{"type":46,"value":358}," uninstall",{"type":40,"tag":307,"props":360,"children":361},{"style":320},[362],{"type":46,"value":363}," @openrouter\u002Fsdk\n",{"type":40,"tag":307,"props":365,"children":367},{"class":309,"line":366},2,[368,372,376],{"type":40,"tag":307,"props":369,"children":370},{"style":314},[371],{"type":46,"value":317},{"type":40,"tag":307,"props":373,"children":374},{"style":320},[375],{"type":46,"value":323},{"type":40,"tag":307,"props":377,"children":378},{"style":320},[379],{"type":46,"value":328},{"type":40,"tag":49,"props":381,"children":382},{},[383],{"type":46,"value":384},"If you also use non-agent SDK features (models list, chat completions, credits, OAuth, API keys), keep both packages installed.",{"type":40,"tag":289,"props":386,"children":388},{"id":387},"step-2-update-imports",[389],{"type":46,"value":390},"Step 2: Update Imports",{"type":40,"tag":49,"props":392,"children":393},{},[394,396,401,403,408],{"type":46,"value":395},"The ",{"type":40,"tag":55,"props":397,"children":399},{"className":398},[],[400],{"type":46,"value":9},{"type":46,"value":402}," client class and ",{"type":40,"tag":55,"props":404,"children":406},{"className":405},[],[407],{"type":46,"value":151},{"type":46,"value":409}," pattern work identically. Only the import source changes:",{"type":40,"tag":296,"props":411,"children":415},{"className":412,"code":413,"language":414,"meta":301,"style":301},"language-diff shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","- import OpenRouter from '@openrouter\u002Fsdk';\n+ import { OpenRouter } from '@openrouter\u002Fagent';\n","diff",[416],{"type":40,"tag":55,"props":417,"children":418},{"__ignoreMap":301},[419,427],{"type":40,"tag":307,"props":420,"children":421},{"class":309,"line":310},[422],{"type":40,"tag":307,"props":423,"children":424},{},[425],{"type":46,"value":426},"- import OpenRouter from '@openrouter\u002Fsdk';\n",{"type":40,"tag":307,"props":428,"children":429},{"class":309,"line":366},[430],{"type":40,"tag":307,"props":431,"children":432},{},[433],{"type":46,"value":434},"+ import { OpenRouter } from '@openrouter\u002Fagent';\n",{"type":40,"tag":49,"props":436,"children":437},{},[438],{"type":46,"value":439},"The rest of your code stays the same:",{"type":40,"tag":296,"props":441,"children":444},{"className":442,"code":443,"language":15,"meta":301,"style":301},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","const client = new OpenRouter({ apiKey: process.env.OPENROUTER_API_KEY });\n\nconst result = client.callModel({\n  model: 'openai\u002Fgpt-5-nano',\n  input: 'Hello!',\n});\n\nconst text = await result.getText();\n",[445],{"type":40,"tag":55,"props":446,"children":447},{"__ignoreMap":301},[448,539,548,587,620,650,666,674],{"type":40,"tag":307,"props":449,"children":450},{"class":309,"line":310},[451,457,463,469,474,480,485,490,496,500,505,510,515,519,524,529,534],{"type":40,"tag":307,"props":452,"children":454},{"style":453},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[455],{"type":46,"value":456},"const",{"type":40,"tag":307,"props":458,"children":460},{"style":459},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[461],{"type":46,"value":462}," client ",{"type":40,"tag":307,"props":464,"children":466},{"style":465},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[467],{"type":46,"value":468},"=",{"type":40,"tag":307,"props":470,"children":471},{"style":465},[472],{"type":46,"value":473}," new",{"type":40,"tag":307,"props":475,"children":477},{"style":476},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[478],{"type":46,"value":479}," OpenRouter",{"type":40,"tag":307,"props":481,"children":482},{"style":459},[483],{"type":46,"value":484},"(",{"type":40,"tag":307,"props":486,"children":487},{"style":465},[488],{"type":46,"value":489},"{",{"type":40,"tag":307,"props":491,"children":493},{"style":492},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[494],{"type":46,"value":495}," apiKey",{"type":40,"tag":307,"props":497,"children":498},{"style":465},[499],{"type":46,"value":130},{"type":40,"tag":307,"props":501,"children":502},{"style":459},[503],{"type":46,"value":504}," process",{"type":40,"tag":307,"props":506,"children":507},{"style":465},[508],{"type":46,"value":509},".",{"type":40,"tag":307,"props":511,"children":512},{"style":459},[513],{"type":46,"value":514},"env",{"type":40,"tag":307,"props":516,"children":517},{"style":465},[518],{"type":46,"value":509},{"type":40,"tag":307,"props":520,"children":521},{"style":459},[522],{"type":46,"value":523},"OPENROUTER_API_KEY ",{"type":40,"tag":307,"props":525,"children":526},{"style":465},[527],{"type":46,"value":528},"}",{"type":40,"tag":307,"props":530,"children":531},{"style":459},[532],{"type":46,"value":533},")",{"type":40,"tag":307,"props":535,"children":536},{"style":465},[537],{"type":46,"value":538},";\n",{"type":40,"tag":307,"props":540,"children":541},{"class":309,"line":366},[542],{"type":40,"tag":307,"props":543,"children":545},{"emptyLinePlaceholder":544},true,[546],{"type":46,"value":547},"\n",{"type":40,"tag":307,"props":549,"children":551},{"class":309,"line":550},3,[552,556,561,565,570,574,578,582],{"type":40,"tag":307,"props":553,"children":554},{"style":453},[555],{"type":46,"value":456},{"type":40,"tag":307,"props":557,"children":558},{"style":459},[559],{"type":46,"value":560}," result ",{"type":40,"tag":307,"props":562,"children":563},{"style":465},[564],{"type":46,"value":468},{"type":40,"tag":307,"props":566,"children":567},{"style":459},[568],{"type":46,"value":569}," client",{"type":40,"tag":307,"props":571,"children":572},{"style":465},[573],{"type":46,"value":509},{"type":40,"tag":307,"props":575,"children":576},{"style":476},[577],{"type":46,"value":60},{"type":40,"tag":307,"props":579,"children":580},{"style":459},[581],{"type":46,"value":484},{"type":40,"tag":307,"props":583,"children":584},{"style":465},[585],{"type":46,"value":586},"{\n",{"type":40,"tag":307,"props":588,"children":590},{"class":309,"line":589},4,[591,596,600,605,610,615],{"type":40,"tag":307,"props":592,"children":593},{"style":492},[594],{"type":46,"value":595},"  model",{"type":40,"tag":307,"props":597,"children":598},{"style":465},[599],{"type":46,"value":130},{"type":40,"tag":307,"props":601,"children":602},{"style":465},[603],{"type":46,"value":604}," '",{"type":40,"tag":307,"props":606,"children":607},{"style":320},[608],{"type":46,"value":609},"openai\u002Fgpt-5-nano",{"type":40,"tag":307,"props":611,"children":612},{"style":465},[613],{"type":46,"value":614},"'",{"type":40,"tag":307,"props":616,"children":617},{"style":465},[618],{"type":46,"value":619},",\n",{"type":40,"tag":307,"props":621,"children":623},{"class":309,"line":622},5,[624,629,633,637,642,646],{"type":40,"tag":307,"props":625,"children":626},{"style":492},[627],{"type":46,"value":628},"  input",{"type":40,"tag":307,"props":630,"children":631},{"style":465},[632],{"type":46,"value":130},{"type":40,"tag":307,"props":634,"children":635},{"style":465},[636],{"type":46,"value":604},{"type":40,"tag":307,"props":638,"children":639},{"style":320},[640],{"type":46,"value":641},"Hello!",{"type":40,"tag":307,"props":643,"children":644},{"style":465},[645],{"type":46,"value":614},{"type":40,"tag":307,"props":647,"children":648},{"style":465},[649],{"type":46,"value":619},{"type":40,"tag":307,"props":651,"children":653},{"class":309,"line":652},6,[654,658,662],{"type":40,"tag":307,"props":655,"children":656},{"style":465},[657],{"type":46,"value":528},{"type":40,"tag":307,"props":659,"children":660},{"style":459},[661],{"type":46,"value":533},{"type":40,"tag":307,"props":663,"children":664},{"style":465},[665],{"type":46,"value":538},{"type":40,"tag":307,"props":667,"children":669},{"class":309,"line":668},7,[670],{"type":40,"tag":307,"props":671,"children":672},{"emptyLinePlaceholder":544},[673],{"type":46,"value":547},{"type":40,"tag":307,"props":675,"children":677},{"class":309,"line":676},8,[678,682,687,691,697,702,706,711,716],{"type":40,"tag":307,"props":679,"children":680},{"style":453},[681],{"type":46,"value":456},{"type":40,"tag":307,"props":683,"children":684},{"style":459},[685],{"type":46,"value":686}," text ",{"type":40,"tag":307,"props":688,"children":689},{"style":465},[690],{"type":46,"value":468},{"type":40,"tag":307,"props":692,"children":694},{"style":693},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[695],{"type":46,"value":696}," await",{"type":40,"tag":307,"props":698,"children":699},{"style":459},[700],{"type":46,"value":701}," result",{"type":40,"tag":307,"props":703,"children":704},{"style":465},[705],{"type":46,"value":509},{"type":40,"tag":307,"props":707,"children":708},{"style":476},[709],{"type":46,"value":710},"getText",{"type":40,"tag":307,"props":712,"children":713},{"style":459},[714],{"type":46,"value":715},"()",{"type":40,"tag":307,"props":717,"children":718},{"style":465},[719],{"type":46,"value":538},{"type":40,"tag":109,"props":721,"children":722},{},[],{"type":40,"tag":113,"props":724,"children":726},{"id":725},"complete-import-mapping",[727],{"type":46,"value":728},"Complete Import Mapping",{"type":40,"tag":289,"props":730,"children":732},{"id":731},"client-callmodel",[733],{"type":46,"value":734},"Client & callModel",{"type":40,"tag":736,"props":737,"children":738},"table",{},[739,758],{"type":40,"tag":740,"props":741,"children":742},"thead",{},[743],{"type":40,"tag":744,"props":745,"children":746},"tr",{},[747,753],{"type":40,"tag":748,"props":749,"children":750},"th",{},[751],{"type":46,"value":752},"Old",{"type":40,"tag":748,"props":754,"children":755},{},[756],{"type":46,"value":757},"New",{"type":40,"tag":759,"props":760,"children":761},"tbody",{},[762,784],{"type":40,"tag":744,"props":763,"children":764},{},[765,775],{"type":40,"tag":766,"props":767,"children":768},"td",{},[769],{"type":40,"tag":55,"props":770,"children":772},{"className":771},[],[773],{"type":46,"value":774},"import OpenRouter from '@openrouter\u002Fsdk'",{"type":40,"tag":766,"props":776,"children":777},{},[778],{"type":40,"tag":55,"props":779,"children":781},{"className":780},[],[782],{"type":46,"value":783},"import { OpenRouter } from '@openrouter\u002Fagent'",{"type":40,"tag":744,"props":785,"children":786},{},[787,796],{"type":40,"tag":766,"props":788,"children":789},{},[790],{"type":40,"tag":55,"props":791,"children":793},{"className":792},[],[794],{"type":46,"value":795},"import OpenRouter, { tool, stepCountIs } from '@openrouter\u002Fsdk'",{"type":40,"tag":766,"props":797,"children":798},{},[799,804,808,814,817],{"type":40,"tag":55,"props":800,"children":802},{"className":801},[],[803],{"type":46,"value":783},{"type":40,"tag":805,"props":806,"children":807},"br",{},[],{"type":40,"tag":55,"props":809,"children":811},{"className":810},[],[812],{"type":46,"value":813},"import { tool } from '@openrouter\u002Fagent\u002Ftool'",{"type":40,"tag":805,"props":815,"children":816},{},[],{"type":40,"tag":55,"props":818,"children":820},{"className":819},[],[821],{"type":46,"value":822},"import { stepCountIs } from '@openrouter\u002Fagent\u002Fstop-conditions'",{"type":40,"tag":49,"props":824,"children":825},{},[826,828,833,835,841],{"type":46,"value":827},"A standalone ",{"type":40,"tag":55,"props":829,"children":831},{"className":830},[],[832],{"type":46,"value":60},{"type":46,"value":834}," function is also available for advanced use cases where a pre-existing ",{"type":40,"tag":55,"props":836,"children":838},{"className":837},[],[839],{"type":46,"value":840},"OpenRouterCore",{"type":46,"value":842}," instance is available:",{"type":40,"tag":296,"props":844,"children":846},{"className":442,"code":845,"language":15,"meta":301,"style":301},"import { callModel } from '@openrouter\u002Fagent\u002Fcall-model';\n\n\u002F\u002F Requires an OpenRouterCore instance (from @openrouter\u002Fsdk\u002Fcore)\nconst result = callModel(coreInstance, { model: 'openai\u002Fgpt-5-nano', input: 'Hello' });\n",[847],{"type":40,"tag":55,"props":848,"children":849},{"__ignoreMap":301},[850,895,902,911],{"type":40,"tag":307,"props":851,"children":852},{"class":309,"line":310},[853,858,863,868,873,878,882,887,891],{"type":40,"tag":307,"props":854,"children":855},{"style":693},[856],{"type":46,"value":857},"import",{"type":40,"tag":307,"props":859,"children":860},{"style":465},[861],{"type":46,"value":862}," {",{"type":40,"tag":307,"props":864,"children":865},{"style":459},[866],{"type":46,"value":867}," callModel",{"type":40,"tag":307,"props":869,"children":870},{"style":465},[871],{"type":46,"value":872}," }",{"type":40,"tag":307,"props":874,"children":875},{"style":693},[876],{"type":46,"value":877}," from",{"type":40,"tag":307,"props":879,"children":880},{"style":465},[881],{"type":46,"value":604},{"type":40,"tag":307,"props":883,"children":884},{"style":320},[885],{"type":46,"value":886},"@openrouter\u002Fagent\u002Fcall-model",{"type":40,"tag":307,"props":888,"children":889},{"style":465},[890],{"type":46,"value":614},{"type":40,"tag":307,"props":892,"children":893},{"style":465},[894],{"type":46,"value":538},{"type":40,"tag":307,"props":896,"children":897},{"class":309,"line":366},[898],{"type":40,"tag":307,"props":899,"children":900},{"emptyLinePlaceholder":544},[901],{"type":46,"value":547},{"type":40,"tag":307,"props":903,"children":904},{"class":309,"line":550},[905],{"type":40,"tag":307,"props":906,"children":908},{"style":907},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[909],{"type":46,"value":910},"\u002F\u002F Requires an OpenRouterCore instance (from @openrouter\u002Fsdk\u002Fcore)\n",{"type":40,"tag":307,"props":912,"children":913},{"class":309,"line":589},[914,918,922,926,930,935,940,944,949,953,957,961,965,969,974,978,982,987,991,995,999],{"type":40,"tag":307,"props":915,"children":916},{"style":453},[917],{"type":46,"value":456},{"type":40,"tag":307,"props":919,"children":920},{"style":459},[921],{"type":46,"value":560},{"type":40,"tag":307,"props":923,"children":924},{"style":465},[925],{"type":46,"value":468},{"type":40,"tag":307,"props":927,"children":928},{"style":476},[929],{"type":46,"value":867},{"type":40,"tag":307,"props":931,"children":932},{"style":459},[933],{"type":46,"value":934},"(coreInstance",{"type":40,"tag":307,"props":936,"children":937},{"style":465},[938],{"type":46,"value":939},",",{"type":40,"tag":307,"props":941,"children":942},{"style":465},[943],{"type":46,"value":862},{"type":40,"tag":307,"props":945,"children":946},{"style":492},[947],{"type":46,"value":948}," model",{"type":40,"tag":307,"props":950,"children":951},{"style":465},[952],{"type":46,"value":130},{"type":40,"tag":307,"props":954,"children":955},{"style":465},[956],{"type":46,"value":604},{"type":40,"tag":307,"props":958,"children":959},{"style":320},[960],{"type":46,"value":609},{"type":40,"tag":307,"props":962,"children":963},{"style":465},[964],{"type":46,"value":614},{"type":40,"tag":307,"props":966,"children":967},{"style":465},[968],{"type":46,"value":939},{"type":40,"tag":307,"props":970,"children":971},{"style":492},[972],{"type":46,"value":973}," input",{"type":40,"tag":307,"props":975,"children":976},{"style":465},[977],{"type":46,"value":130},{"type":40,"tag":307,"props":979,"children":980},{"style":465},[981],{"type":46,"value":604},{"type":40,"tag":307,"props":983,"children":984},{"style":320},[985],{"type":46,"value":986},"Hello",{"type":40,"tag":307,"props":988,"children":989},{"style":465},[990],{"type":46,"value":614},{"type":40,"tag":307,"props":992,"children":993},{"style":465},[994],{"type":46,"value":872},{"type":40,"tag":307,"props":996,"children":997},{"style":459},[998],{"type":46,"value":533},{"type":40,"tag":307,"props":1000,"children":1001},{"style":465},[1002],{"type":46,"value":538},{"type":40,"tag":49,"props":1004,"children":1005},{},[1006,1008,1013],{"type":46,"value":1007},"For most use cases, prefer the ",{"type":40,"tag":55,"props":1009,"children":1011},{"className":1010},[],[1012],{"type":46,"value":151},{"type":46,"value":1014}," method shown above.",{"type":40,"tag":289,"props":1016,"children":1018},{"id":1017},"tool-creation",[1019],{"type":46,"value":1020},"Tool Creation",{"type":40,"tag":736,"props":1022,"children":1023},{},[1024,1038],{"type":40,"tag":740,"props":1025,"children":1026},{},[1027],{"type":40,"tag":744,"props":1028,"children":1029},{},[1030,1034],{"type":40,"tag":748,"props":1031,"children":1032},{},[1033],{"type":46,"value":752},{"type":40,"tag":748,"props":1035,"children":1036},{},[1037],{"type":46,"value":757},{"type":40,"tag":759,"props":1039,"children":1040},{},[1041],{"type":40,"tag":744,"props":1042,"children":1043},{},[1044,1053],{"type":40,"tag":766,"props":1045,"children":1046},{},[1047],{"type":40,"tag":55,"props":1048,"children":1050},{"className":1049},[],[1051],{"type":46,"value":1052},"import { tool } from '@openrouter\u002Fsdk'",{"type":40,"tag":766,"props":1054,"children":1055},{},[1056],{"type":40,"tag":55,"props":1057,"children":1059},{"className":1058},[],[1060],{"type":46,"value":813},{"type":40,"tag":289,"props":1062,"children":1064},{"id":1063},"stop-conditions",[1065],{"type":46,"value":1066},"Stop Conditions",{"type":40,"tag":736,"props":1068,"children":1069},{},[1070,1084],{"type":40,"tag":740,"props":1071,"children":1072},{},[1073],{"type":40,"tag":744,"props":1074,"children":1075},{},[1076,1080],{"type":40,"tag":748,"props":1077,"children":1078},{},[1079],{"type":46,"value":752},{"type":40,"tag":748,"props":1081,"children":1082},{},[1083],{"type":46,"value":757},{"type":40,"tag":759,"props":1085,"children":1086},{},[1087,1108],{"type":40,"tag":744,"props":1088,"children":1089},{},[1090,1099],{"type":40,"tag":766,"props":1091,"children":1092},{},[1093],{"type":40,"tag":55,"props":1094,"children":1096},{"className":1095},[],[1097],{"type":46,"value":1098},"import { stepCountIs, hasToolCall, maxCost } from '@openrouter\u002Fsdk'",{"type":40,"tag":766,"props":1100,"children":1101},{},[1102],{"type":40,"tag":55,"props":1103,"children":1105},{"className":1104},[],[1106],{"type":46,"value":1107},"import { stepCountIs, hasToolCall, maxCost } from '@openrouter\u002Fagent\u002Fstop-conditions'",{"type":40,"tag":744,"props":1109,"children":1110},{},[1111,1120],{"type":40,"tag":766,"props":1112,"children":1113},{},[1114],{"type":40,"tag":55,"props":1115,"children":1117},{"className":1116},[],[1118],{"type":46,"value":1119},"import { maxTokensUsed, finishReasonIs } from '@openrouter\u002Fsdk'",{"type":40,"tag":766,"props":1121,"children":1122},{},[1123],{"type":40,"tag":55,"props":1124,"children":1126},{"className":1125},[],[1127],{"type":46,"value":1128},"import { maxTokensUsed, finishReasonIs } from '@openrouter\u002Fagent\u002Fstop-conditions'",{"type":40,"tag":289,"props":1130,"children":1132},{"id":1131},"types",[1133],{"type":46,"value":1134},"Types",{"type":40,"tag":736,"props":1136,"children":1137},{},[1138,1152],{"type":40,"tag":740,"props":1139,"children":1140},{},[1141],{"type":40,"tag":744,"props":1142,"children":1143},{},[1144,1148],{"type":40,"tag":748,"props":1145,"children":1146},{},[1147],{"type":46,"value":752},{"type":40,"tag":748,"props":1149,"children":1150},{},[1151],{"type":46,"value":757},{"type":40,"tag":759,"props":1153,"children":1154},{},[1155,1176,1197],{"type":40,"tag":744,"props":1156,"children":1157},{},[1158,1167],{"type":40,"tag":766,"props":1159,"children":1160},{},[1161],{"type":40,"tag":55,"props":1162,"children":1164},{"className":1163},[],[1165],{"type":46,"value":1166},"import type { Tool, ToolWithExecute, ToolWithGenerator, ManualTool } from '@openrouter\u002Fsdk\u002Flib\u002Ftool-types'",{"type":40,"tag":766,"props":1168,"children":1169},{},[1170],{"type":40,"tag":55,"props":1171,"children":1173},{"className":1172},[],[1174],{"type":46,"value":1175},"import type { Tool, ToolWithExecute, ToolWithGenerator, ManualTool } from '@openrouter\u002Fagent\u002Ftool-types'",{"type":40,"tag":744,"props":1177,"children":1178},{},[1179,1188],{"type":40,"tag":766,"props":1180,"children":1181},{},[1182],{"type":40,"tag":55,"props":1183,"children":1185},{"className":1184},[],[1186],{"type":46,"value":1187},"import type { CallModelInput } from '@openrouter\u002Fsdk\u002Flib\u002Fasync-params'",{"type":40,"tag":766,"props":1189,"children":1190},{},[1191],{"type":40,"tag":55,"props":1192,"children":1194},{"className":1193},[],[1195],{"type":46,"value":1196},"import type { CallModelInput } from '@openrouter\u002Fagent\u002Fasync-params'",{"type":40,"tag":744,"props":1198,"children":1199},{},[1200,1209],{"type":40,"tag":766,"props":1201,"children":1202},{},[1203],{"type":40,"tag":55,"props":1204,"children":1206},{"className":1205},[],[1207],{"type":46,"value":1208},"import { ModelResult } from '@openrouter\u002Fsdk\u002Flib\u002Fmodel-result'",{"type":40,"tag":766,"props":1210,"children":1211},{},[1212],{"type":40,"tag":55,"props":1213,"children":1215},{"className":1214},[],[1216],{"type":46,"value":1217},"import { ModelResult } from '@openrouter\u002Fagent\u002Fmodel-result'",{"type":40,"tag":289,"props":1219,"children":1221},{"id":1220},"format-converters",[1222],{"type":46,"value":1223},"Format Converters",{"type":40,"tag":736,"props":1225,"children":1226},{},[1227,1241],{"type":40,"tag":740,"props":1228,"children":1229},{},[1230],{"type":40,"tag":744,"props":1231,"children":1232},{},[1233,1237],{"type":40,"tag":748,"props":1234,"children":1235},{},[1236],{"type":46,"value":752},{"type":40,"tag":748,"props":1238,"children":1239},{},[1240],{"type":46,"value":757},{"type":40,"tag":759,"props":1242,"children":1243},{},[1244,1265],{"type":40,"tag":744,"props":1245,"children":1246},{},[1247,1256],{"type":40,"tag":766,"props":1248,"children":1249},{},[1250],{"type":40,"tag":55,"props":1251,"children":1253},{"className":1252},[],[1254],{"type":46,"value":1255},"import { fromClaudeMessages, toClaudeMessage } from '@openrouter\u002Fsdk'",{"type":40,"tag":766,"props":1257,"children":1258},{},[1259],{"type":40,"tag":55,"props":1260,"children":1262},{"className":1261},[],[1263],{"type":46,"value":1264},"import { fromClaudeMessages, toClaudeMessage } from '@openrouter\u002Fagent'",{"type":40,"tag":744,"props":1266,"children":1267},{},[1268,1277],{"type":40,"tag":766,"props":1269,"children":1270},{},[1271],{"type":40,"tag":55,"props":1272,"children":1274},{"className":1273},[],[1275],{"type":46,"value":1276},"import { fromChatMessages, toChatMessage } from '@openrouter\u002Fsdk'",{"type":40,"tag":766,"props":1278,"children":1279},{},[1280],{"type":40,"tag":55,"props":1281,"children":1283},{"className":1282},[],[1284],{"type":46,"value":1285},"import { fromChatMessages, toChatMessage } from '@openrouter\u002Fagent'",{"type":40,"tag":289,"props":1287,"children":1289},{"id":1288},"type-guards",[1290],{"type":46,"value":1291},"Type Guards",{"type":40,"tag":736,"props":1293,"children":1294},{},[1295,1309],{"type":40,"tag":740,"props":1296,"children":1297},{},[1298],{"type":40,"tag":744,"props":1299,"children":1300},{},[1301,1305],{"type":40,"tag":748,"props":1302,"children":1303},{},[1304],{"type":46,"value":752},{"type":40,"tag":748,"props":1306,"children":1307},{},[1308],{"type":46,"value":757},{"type":40,"tag":759,"props":1310,"children":1311},{},[1312],{"type":40,"tag":744,"props":1313,"children":1314},{},[1315,1324],{"type":40,"tag":766,"props":1316,"children":1317},{},[1318],{"type":40,"tag":55,"props":1319,"children":1321},{"className":1320},[],[1322],{"type":46,"value":1323},"import { hasExecuteFunction, isGeneratorTool, isRegularExecuteTool } from '@openrouter\u002Fsdk'",{"type":40,"tag":766,"props":1325,"children":1326},{},[1327],{"type":40,"tag":55,"props":1328,"children":1330},{"className":1329},[],[1331],{"type":46,"value":1332},"import { hasExecuteFunction, isGeneratorTool, isRegularExecuteTool } from '@openrouter\u002Fagent\u002Ftool-types'",{"type":40,"tag":109,"props":1334,"children":1335},{},[],{"type":40,"tag":113,"props":1337,"children":1339},{"id":1338},"before-after-example",[1340],{"type":46,"value":1341},"Before & After Example",{"type":40,"tag":289,"props":1343,"children":1345},{"id":1344},"before-using-openroutersdk",[1346],{"type":46,"value":1347},"Before (using @openrouter\u002Fsdk)",{"type":40,"tag":296,"props":1349,"children":1351},{"className":442,"code":1350,"language":15,"meta":301,"style":301},"import OpenRouter, { tool, stepCountIs, hasToolCall } from '@openrouter\u002Fsdk';\nimport { z } from 'zod';\n\nconst client = new OpenRouter({\n  apiKey: process.env.OPENROUTER_API_KEY,\n});\n\nconst searchTool = tool({\n  name: 'web_search',\n  description: 'Search the web',\n  inputSchema: z.object({ query: z.string() }),\n  outputSchema: z.object({ results: z.array(z.string()) }),\n  execute: async ({ query }) => {\n    return { results: ['Result 1', 'Result 2'] };\n  },\n});\n\nconst finishTool = tool({\n  name: 'finish',\n  description: 'Complete the task',\n  inputSchema: z.object({ answer: z.string() }),\n  execute: async ({ answer }) => ({ answer }),\n});\n\nconst result = client.callModel({\n  model: 'openai\u002Fgpt-5-nano',\n  instructions: 'You are a research assistant.',\n  input: 'What are the latest AI developments?',\n  tools: [searchTool, finishTool],\n  stopWhen: [stepCountIs(10), hasToolCall('finish')],\n});\n\nconst text = await result.getText();\n",[1352],{"type":40,"tag":55,"props":1353,"children":1354},{"__ignoreMap":301},[1355,1421,1462,1469,1500,1537,1552,1559,1587,1617,1647,1720,1805,1848,1914,1923,1939,1947,1976,2005,2034,2103,2161,2177,2185,2221,2248,2278,2307,2338,2406,2422,2430],{"type":40,"tag":307,"props":1356,"children":1357},{"class":309,"line":310},[1358,1362,1366,1370,1374,1379,1383,1388,1392,1397,1401,1405,1409,1413,1417],{"type":40,"tag":307,"props":1359,"children":1360},{"style":693},[1361],{"type":46,"value":857},{"type":40,"tag":307,"props":1363,"children":1364},{"style":459},[1365],{"type":46,"value":479},{"type":40,"tag":307,"props":1367,"children":1368},{"style":465},[1369],{"type":46,"value":939},{"type":40,"tag":307,"props":1371,"children":1372},{"style":465},[1373],{"type":46,"value":862},{"type":40,"tag":307,"props":1375,"children":1376},{"style":459},[1377],{"type":46,"value":1378}," tool",{"type":40,"tag":307,"props":1380,"children":1381},{"style":465},[1382],{"type":46,"value":939},{"type":40,"tag":307,"props":1384,"children":1385},{"style":459},[1386],{"type":46,"value":1387}," stepCountIs",{"type":40,"tag":307,"props":1389,"children":1390},{"style":465},[1391],{"type":46,"value":939},{"type":40,"tag":307,"props":1393,"children":1394},{"style":459},[1395],{"type":46,"value":1396}," hasToolCall",{"type":40,"tag":307,"props":1398,"children":1399},{"style":465},[1400],{"type":46,"value":872},{"type":40,"tag":307,"props":1402,"children":1403},{"style":693},[1404],{"type":46,"value":877},{"type":40,"tag":307,"props":1406,"children":1407},{"style":465},[1408],{"type":46,"value":604},{"type":40,"tag":307,"props":1410,"children":1411},{"style":320},[1412],{"type":46,"value":76},{"type":40,"tag":307,"props":1414,"children":1415},{"style":465},[1416],{"type":46,"value":614},{"type":40,"tag":307,"props":1418,"children":1419},{"style":465},[1420],{"type":46,"value":538},{"type":40,"tag":307,"props":1422,"children":1423},{"class":309,"line":366},[1424,1428,1432,1437,1441,1445,1449,1454,1458],{"type":40,"tag":307,"props":1425,"children":1426},{"style":693},[1427],{"type":46,"value":857},{"type":40,"tag":307,"props":1429,"children":1430},{"style":465},[1431],{"type":46,"value":862},{"type":40,"tag":307,"props":1433,"children":1434},{"style":459},[1435],{"type":46,"value":1436}," z",{"type":40,"tag":307,"props":1438,"children":1439},{"style":465},[1440],{"type":46,"value":872},{"type":40,"tag":307,"props":1442,"children":1443},{"style":693},[1444],{"type":46,"value":877},{"type":40,"tag":307,"props":1446,"children":1447},{"style":465},[1448],{"type":46,"value":604},{"type":40,"tag":307,"props":1450,"children":1451},{"style":320},[1452],{"type":46,"value":1453},"zod",{"type":40,"tag":307,"props":1455,"children":1456},{"style":465},[1457],{"type":46,"value":614},{"type":40,"tag":307,"props":1459,"children":1460},{"style":465},[1461],{"type":46,"value":538},{"type":40,"tag":307,"props":1463,"children":1464},{"class":309,"line":550},[1465],{"type":40,"tag":307,"props":1466,"children":1467},{"emptyLinePlaceholder":544},[1468],{"type":46,"value":547},{"type":40,"tag":307,"props":1470,"children":1471},{"class":309,"line":589},[1472,1476,1480,1484,1488,1492,1496],{"type":40,"tag":307,"props":1473,"children":1474},{"style":453},[1475],{"type":46,"value":456},{"type":40,"tag":307,"props":1477,"children":1478},{"style":459},[1479],{"type":46,"value":462},{"type":40,"tag":307,"props":1481,"children":1482},{"style":465},[1483],{"type":46,"value":468},{"type":40,"tag":307,"props":1485,"children":1486},{"style":465},[1487],{"type":46,"value":473},{"type":40,"tag":307,"props":1489,"children":1490},{"style":476},[1491],{"type":46,"value":479},{"type":40,"tag":307,"props":1493,"children":1494},{"style":459},[1495],{"type":46,"value":484},{"type":40,"tag":307,"props":1497,"children":1498},{"style":465},[1499],{"type":46,"value":586},{"type":40,"tag":307,"props":1501,"children":1502},{"class":309,"line":622},[1503,1508,1512,1516,1520,1524,1528,1533],{"type":40,"tag":307,"props":1504,"children":1505},{"style":492},[1506],{"type":46,"value":1507},"  apiKey",{"type":40,"tag":307,"props":1509,"children":1510},{"style":465},[1511],{"type":46,"value":130},{"type":40,"tag":307,"props":1513,"children":1514},{"style":459},[1515],{"type":46,"value":504},{"type":40,"tag":307,"props":1517,"children":1518},{"style":465},[1519],{"type":46,"value":509},{"type":40,"tag":307,"props":1521,"children":1522},{"style":459},[1523],{"type":46,"value":514},{"type":40,"tag":307,"props":1525,"children":1526},{"style":465},[1527],{"type":46,"value":509},{"type":40,"tag":307,"props":1529,"children":1530},{"style":459},[1531],{"type":46,"value":1532},"OPENROUTER_API_KEY",{"type":40,"tag":307,"props":1534,"children":1535},{"style":465},[1536],{"type":46,"value":619},{"type":40,"tag":307,"props":1538,"children":1539},{"class":309,"line":652},[1540,1544,1548],{"type":40,"tag":307,"props":1541,"children":1542},{"style":465},[1543],{"type":46,"value":528},{"type":40,"tag":307,"props":1545,"children":1546},{"style":459},[1547],{"type":46,"value":533},{"type":40,"tag":307,"props":1549,"children":1550},{"style":465},[1551],{"type":46,"value":538},{"type":40,"tag":307,"props":1553,"children":1554},{"class":309,"line":668},[1555],{"type":40,"tag":307,"props":1556,"children":1557},{"emptyLinePlaceholder":544},[1558],{"type":46,"value":547},{"type":40,"tag":307,"props":1560,"children":1561},{"class":309,"line":676},[1562,1566,1571,1575,1579,1583],{"type":40,"tag":307,"props":1563,"children":1564},{"style":453},[1565],{"type":46,"value":456},{"type":40,"tag":307,"props":1567,"children":1568},{"style":459},[1569],{"type":46,"value":1570}," searchTool ",{"type":40,"tag":307,"props":1572,"children":1573},{"style":465},[1574],{"type":46,"value":468},{"type":40,"tag":307,"props":1576,"children":1577},{"style":476},[1578],{"type":46,"value":1378},{"type":40,"tag":307,"props":1580,"children":1581},{"style":459},[1582],{"type":46,"value":484},{"type":40,"tag":307,"props":1584,"children":1585},{"style":465},[1586],{"type":46,"value":586},{"type":40,"tag":307,"props":1588,"children":1590},{"class":309,"line":1589},9,[1591,1596,1600,1604,1609,1613],{"type":40,"tag":307,"props":1592,"children":1593},{"style":492},[1594],{"type":46,"value":1595},"  name",{"type":40,"tag":307,"props":1597,"children":1598},{"style":465},[1599],{"type":46,"value":130},{"type":40,"tag":307,"props":1601,"children":1602},{"style":465},[1603],{"type":46,"value":604},{"type":40,"tag":307,"props":1605,"children":1606},{"style":320},[1607],{"type":46,"value":1608},"web_search",{"type":40,"tag":307,"props":1610,"children":1611},{"style":465},[1612],{"type":46,"value":614},{"type":40,"tag":307,"props":1614,"children":1615},{"style":465},[1616],{"type":46,"value":619},{"type":40,"tag":307,"props":1618,"children":1620},{"class":309,"line":1619},10,[1621,1626,1630,1634,1639,1643],{"type":40,"tag":307,"props":1622,"children":1623},{"style":492},[1624],{"type":46,"value":1625},"  description",{"type":40,"tag":307,"props":1627,"children":1628},{"style":465},[1629],{"type":46,"value":130},{"type":40,"tag":307,"props":1631,"children":1632},{"style":465},[1633],{"type":46,"value":604},{"type":40,"tag":307,"props":1635,"children":1636},{"style":320},[1637],{"type":46,"value":1638},"Search the web",{"type":40,"tag":307,"props":1640,"children":1641},{"style":465},[1642],{"type":46,"value":614},{"type":40,"tag":307,"props":1644,"children":1645},{"style":465},[1646],{"type":46,"value":619},{"type":40,"tag":307,"props":1648,"children":1650},{"class":309,"line":1649},11,[1651,1656,1660,1664,1668,1673,1677,1681,1686,1690,1694,1698,1703,1708,1712,1716],{"type":40,"tag":307,"props":1652,"children":1653},{"style":492},[1654],{"type":46,"value":1655},"  inputSchema",{"type":40,"tag":307,"props":1657,"children":1658},{"style":465},[1659],{"type":46,"value":130},{"type":40,"tag":307,"props":1661,"children":1662},{"style":459},[1663],{"type":46,"value":1436},{"type":40,"tag":307,"props":1665,"children":1666},{"style":465},[1667],{"type":46,"value":509},{"type":40,"tag":307,"props":1669,"children":1670},{"style":476},[1671],{"type":46,"value":1672},"object",{"type":40,"tag":307,"props":1674,"children":1675},{"style":459},[1676],{"type":46,"value":484},{"type":40,"tag":307,"props":1678,"children":1679},{"style":465},[1680],{"type":46,"value":489},{"type":40,"tag":307,"props":1682,"children":1683},{"style":492},[1684],{"type":46,"value":1685}," query",{"type":40,"tag":307,"props":1687,"children":1688},{"style":465},[1689],{"type":46,"value":130},{"type":40,"tag":307,"props":1691,"children":1692},{"style":459},[1693],{"type":46,"value":1436},{"type":40,"tag":307,"props":1695,"children":1696},{"style":465},[1697],{"type":46,"value":509},{"type":40,"tag":307,"props":1699,"children":1700},{"style":476},[1701],{"type":46,"value":1702},"string",{"type":40,"tag":307,"props":1704,"children":1705},{"style":459},[1706],{"type":46,"value":1707},"() ",{"type":40,"tag":307,"props":1709,"children":1710},{"style":465},[1711],{"type":46,"value":528},{"type":40,"tag":307,"props":1713,"children":1714},{"style":459},[1715],{"type":46,"value":533},{"type":40,"tag":307,"props":1717,"children":1718},{"style":465},[1719],{"type":46,"value":619},{"type":40,"tag":307,"props":1721,"children":1723},{"class":309,"line":1722},12,[1724,1729,1733,1737,1741,1745,1749,1753,1758,1762,1766,1770,1775,1780,1784,1788,1793,1797,1801],{"type":40,"tag":307,"props":1725,"children":1726},{"style":492},[1727],{"type":46,"value":1728},"  outputSchema",{"type":40,"tag":307,"props":1730,"children":1731},{"style":465},[1732],{"type":46,"value":130},{"type":40,"tag":307,"props":1734,"children":1735},{"style":459},[1736],{"type":46,"value":1436},{"type":40,"tag":307,"props":1738,"children":1739},{"style":465},[1740],{"type":46,"value":509},{"type":40,"tag":307,"props":1742,"children":1743},{"style":476},[1744],{"type":46,"value":1672},{"type":40,"tag":307,"props":1746,"children":1747},{"style":459},[1748],{"type":46,"value":484},{"type":40,"tag":307,"props":1750,"children":1751},{"style":465},[1752],{"type":46,"value":489},{"type":40,"tag":307,"props":1754,"children":1755},{"style":492},[1756],{"type":46,"value":1757}," results",{"type":40,"tag":307,"props":1759,"children":1760},{"style":465},[1761],{"type":46,"value":130},{"type":40,"tag":307,"props":1763,"children":1764},{"style":459},[1765],{"type":46,"value":1436},{"type":40,"tag":307,"props":1767,"children":1768},{"style":465},[1769],{"type":46,"value":509},{"type":40,"tag":307,"props":1771,"children":1772},{"style":476},[1773],{"type":46,"value":1774},"array",{"type":40,"tag":307,"props":1776,"children":1777},{"style":459},[1778],{"type":46,"value":1779},"(z",{"type":40,"tag":307,"props":1781,"children":1782},{"style":465},[1783],{"type":46,"value":509},{"type":40,"tag":307,"props":1785,"children":1786},{"style":476},[1787],{"type":46,"value":1702},{"type":40,"tag":307,"props":1789,"children":1790},{"style":459},[1791],{"type":46,"value":1792},"()) ",{"type":40,"tag":307,"props":1794,"children":1795},{"style":465},[1796],{"type":46,"value":528},{"type":40,"tag":307,"props":1798,"children":1799},{"style":459},[1800],{"type":46,"value":533},{"type":40,"tag":307,"props":1802,"children":1803},{"style":465},[1804],{"type":46,"value":619},{"type":40,"tag":307,"props":1806,"children":1808},{"class":309,"line":1807},13,[1809,1814,1818,1823,1828,1833,1838,1843],{"type":40,"tag":307,"props":1810,"children":1811},{"style":476},[1812],{"type":46,"value":1813},"  execute",{"type":40,"tag":307,"props":1815,"children":1816},{"style":465},[1817],{"type":46,"value":130},{"type":40,"tag":307,"props":1819,"children":1820},{"style":453},[1821],{"type":46,"value":1822}," async",{"type":40,"tag":307,"props":1824,"children":1825},{"style":465},[1826],{"type":46,"value":1827}," ({",{"type":40,"tag":307,"props":1829,"children":1831},{"style":1830},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[1832],{"type":46,"value":1685},{"type":40,"tag":307,"props":1834,"children":1835},{"style":465},[1836],{"type":46,"value":1837}," })",{"type":40,"tag":307,"props":1839,"children":1840},{"style":453},[1841],{"type":46,"value":1842}," =>",{"type":40,"tag":307,"props":1844,"children":1845},{"style":465},[1846],{"type":46,"value":1847}," {\n",{"type":40,"tag":307,"props":1849,"children":1851},{"class":309,"line":1850},14,[1852,1857,1861,1865,1869,1874,1878,1883,1887,1891,1895,1900,1904,1909],{"type":40,"tag":307,"props":1853,"children":1854},{"style":693},[1855],{"type":46,"value":1856},"    return",{"type":40,"tag":307,"props":1858,"children":1859},{"style":465},[1860],{"type":46,"value":862},{"type":40,"tag":307,"props":1862,"children":1863},{"style":492},[1864],{"type":46,"value":1757},{"type":40,"tag":307,"props":1866,"children":1867},{"style":465},[1868],{"type":46,"value":130},{"type":40,"tag":307,"props":1870,"children":1871},{"style":492},[1872],{"type":46,"value":1873}," [",{"type":40,"tag":307,"props":1875,"children":1876},{"style":465},[1877],{"type":46,"value":614},{"type":40,"tag":307,"props":1879,"children":1880},{"style":320},[1881],{"type":46,"value":1882},"Result 1",{"type":40,"tag":307,"props":1884,"children":1885},{"style":465},[1886],{"type":46,"value":614},{"type":40,"tag":307,"props":1888,"children":1889},{"style":465},[1890],{"type":46,"value":939},{"type":40,"tag":307,"props":1892,"children":1893},{"style":465},[1894],{"type":46,"value":604},{"type":40,"tag":307,"props":1896,"children":1897},{"style":320},[1898],{"type":46,"value":1899},"Result 2",{"type":40,"tag":307,"props":1901,"children":1902},{"style":465},[1903],{"type":46,"value":614},{"type":40,"tag":307,"props":1905,"children":1906},{"style":492},[1907],{"type":46,"value":1908},"] ",{"type":40,"tag":307,"props":1910,"children":1911},{"style":465},[1912],{"type":46,"value":1913},"};\n",{"type":40,"tag":307,"props":1915,"children":1917},{"class":309,"line":1916},15,[1918],{"type":40,"tag":307,"props":1919,"children":1920},{"style":465},[1921],{"type":46,"value":1922},"  },\n",{"type":40,"tag":307,"props":1924,"children":1926},{"class":309,"line":1925},16,[1927,1931,1935],{"type":40,"tag":307,"props":1928,"children":1929},{"style":465},[1930],{"type":46,"value":528},{"type":40,"tag":307,"props":1932,"children":1933},{"style":459},[1934],{"type":46,"value":533},{"type":40,"tag":307,"props":1936,"children":1937},{"style":465},[1938],{"type":46,"value":538},{"type":40,"tag":307,"props":1940,"children":1942},{"class":309,"line":1941},17,[1943],{"type":40,"tag":307,"props":1944,"children":1945},{"emptyLinePlaceholder":544},[1946],{"type":46,"value":547},{"type":40,"tag":307,"props":1948,"children":1950},{"class":309,"line":1949},18,[1951,1955,1960,1964,1968,1972],{"type":40,"tag":307,"props":1952,"children":1953},{"style":453},[1954],{"type":46,"value":456},{"type":40,"tag":307,"props":1956,"children":1957},{"style":459},[1958],{"type":46,"value":1959}," finishTool ",{"type":40,"tag":307,"props":1961,"children":1962},{"style":465},[1963],{"type":46,"value":468},{"type":40,"tag":307,"props":1965,"children":1966},{"style":476},[1967],{"type":46,"value":1378},{"type":40,"tag":307,"props":1969,"children":1970},{"style":459},[1971],{"type":46,"value":484},{"type":40,"tag":307,"props":1973,"children":1974},{"style":465},[1975],{"type":46,"value":586},{"type":40,"tag":307,"props":1977,"children":1979},{"class":309,"line":1978},19,[1980,1984,1988,1992,1997,2001],{"type":40,"tag":307,"props":1981,"children":1982},{"style":492},[1983],{"type":46,"value":1595},{"type":40,"tag":307,"props":1985,"children":1986},{"style":465},[1987],{"type":46,"value":130},{"type":40,"tag":307,"props":1989,"children":1990},{"style":465},[1991],{"type":46,"value":604},{"type":40,"tag":307,"props":1993,"children":1994},{"style":320},[1995],{"type":46,"value":1996},"finish",{"type":40,"tag":307,"props":1998,"children":1999},{"style":465},[2000],{"type":46,"value":614},{"type":40,"tag":307,"props":2002,"children":2003},{"style":465},[2004],{"type":46,"value":619},{"type":40,"tag":307,"props":2006,"children":2008},{"class":309,"line":2007},20,[2009,2013,2017,2021,2026,2030],{"type":40,"tag":307,"props":2010,"children":2011},{"style":492},[2012],{"type":46,"value":1625},{"type":40,"tag":307,"props":2014,"children":2015},{"style":465},[2016],{"type":46,"value":130},{"type":40,"tag":307,"props":2018,"children":2019},{"style":465},[2020],{"type":46,"value":604},{"type":40,"tag":307,"props":2022,"children":2023},{"style":320},[2024],{"type":46,"value":2025},"Complete the task",{"type":40,"tag":307,"props":2027,"children":2028},{"style":465},[2029],{"type":46,"value":614},{"type":40,"tag":307,"props":2031,"children":2032},{"style":465},[2033],{"type":46,"value":619},{"type":40,"tag":307,"props":2035,"children":2037},{"class":309,"line":2036},21,[2038,2042,2046,2050,2054,2058,2062,2066,2071,2075,2079,2083,2087,2091,2095,2099],{"type":40,"tag":307,"props":2039,"children":2040},{"style":492},[2041],{"type":46,"value":1655},{"type":40,"tag":307,"props":2043,"children":2044},{"style":465},[2045],{"type":46,"value":130},{"type":40,"tag":307,"props":2047,"children":2048},{"style":459},[2049],{"type":46,"value":1436},{"type":40,"tag":307,"props":2051,"children":2052},{"style":465},[2053],{"type":46,"value":509},{"type":40,"tag":307,"props":2055,"children":2056},{"style":476},[2057],{"type":46,"value":1672},{"type":40,"tag":307,"props":2059,"children":2060},{"style":459},[2061],{"type":46,"value":484},{"type":40,"tag":307,"props":2063,"children":2064},{"style":465},[2065],{"type":46,"value":489},{"type":40,"tag":307,"props":2067,"children":2068},{"style":492},[2069],{"type":46,"value":2070}," answer",{"type":40,"tag":307,"props":2072,"children":2073},{"style":465},[2074],{"type":46,"value":130},{"type":40,"tag":307,"props":2076,"children":2077},{"style":459},[2078],{"type":46,"value":1436},{"type":40,"tag":307,"props":2080,"children":2081},{"style":465},[2082],{"type":46,"value":509},{"type":40,"tag":307,"props":2084,"children":2085},{"style":476},[2086],{"type":46,"value":1702},{"type":40,"tag":307,"props":2088,"children":2089},{"style":459},[2090],{"type":46,"value":1707},{"type":40,"tag":307,"props":2092,"children":2093},{"style":465},[2094],{"type":46,"value":528},{"type":40,"tag":307,"props":2096,"children":2097},{"style":459},[2098],{"type":46,"value":533},{"type":40,"tag":307,"props":2100,"children":2101},{"style":465},[2102],{"type":46,"value":619},{"type":40,"tag":307,"props":2104,"children":2106},{"class":309,"line":2105},22,[2107,2111,2115,2119,2123,2127,2131,2135,2140,2144,2149,2153,2157],{"type":40,"tag":307,"props":2108,"children":2109},{"style":476},[2110],{"type":46,"value":1813},{"type":40,"tag":307,"props":2112,"children":2113},{"style":465},[2114],{"type":46,"value":130},{"type":40,"tag":307,"props":2116,"children":2117},{"style":453},[2118],{"type":46,"value":1822},{"type":40,"tag":307,"props":2120,"children":2121},{"style":465},[2122],{"type":46,"value":1827},{"type":40,"tag":307,"props":2124,"children":2125},{"style":1830},[2126],{"type":46,"value":2070},{"type":40,"tag":307,"props":2128,"children":2129},{"style":465},[2130],{"type":46,"value":1837},{"type":40,"tag":307,"props":2132,"children":2133},{"style":453},[2134],{"type":46,"value":1842},{"type":40,"tag":307,"props":2136,"children":2137},{"style":459},[2138],{"type":46,"value":2139}," (",{"type":40,"tag":307,"props":2141,"children":2142},{"style":465},[2143],{"type":46,"value":489},{"type":40,"tag":307,"props":2145,"children":2146},{"style":459},[2147],{"type":46,"value":2148}," answer ",{"type":40,"tag":307,"props":2150,"children":2151},{"style":465},[2152],{"type":46,"value":528},{"type":40,"tag":307,"props":2154,"children":2155},{"style":459},[2156],{"type":46,"value":533},{"type":40,"tag":307,"props":2158,"children":2159},{"style":465},[2160],{"type":46,"value":619},{"type":40,"tag":307,"props":2162,"children":2164},{"class":309,"line":2163},23,[2165,2169,2173],{"type":40,"tag":307,"props":2166,"children":2167},{"style":465},[2168],{"type":46,"value":528},{"type":40,"tag":307,"props":2170,"children":2171},{"style":459},[2172],{"type":46,"value":533},{"type":40,"tag":307,"props":2174,"children":2175},{"style":465},[2176],{"type":46,"value":538},{"type":40,"tag":307,"props":2178,"children":2180},{"class":309,"line":2179},24,[2181],{"type":40,"tag":307,"props":2182,"children":2183},{"emptyLinePlaceholder":544},[2184],{"type":46,"value":547},{"type":40,"tag":307,"props":2186,"children":2188},{"class":309,"line":2187},25,[2189,2193,2197,2201,2205,2209,2213,2217],{"type":40,"tag":307,"props":2190,"children":2191},{"style":453},[2192],{"type":46,"value":456},{"type":40,"tag":307,"props":2194,"children":2195},{"style":459},[2196],{"type":46,"value":560},{"type":40,"tag":307,"props":2198,"children":2199},{"style":465},[2200],{"type":46,"value":468},{"type":40,"tag":307,"props":2202,"children":2203},{"style":459},[2204],{"type":46,"value":569},{"type":40,"tag":307,"props":2206,"children":2207},{"style":465},[2208],{"type":46,"value":509},{"type":40,"tag":307,"props":2210,"children":2211},{"style":476},[2212],{"type":46,"value":60},{"type":40,"tag":307,"props":2214,"children":2215},{"style":459},[2216],{"type":46,"value":484},{"type":40,"tag":307,"props":2218,"children":2219},{"style":465},[2220],{"type":46,"value":586},{"type":40,"tag":307,"props":2222,"children":2223},{"class":309,"line":27},[2224,2228,2232,2236,2240,2244],{"type":40,"tag":307,"props":2225,"children":2226},{"style":492},[2227],{"type":46,"value":595},{"type":40,"tag":307,"props":2229,"children":2230},{"style":465},[2231],{"type":46,"value":130},{"type":40,"tag":307,"props":2233,"children":2234},{"style":465},[2235],{"type":46,"value":604},{"type":40,"tag":307,"props":2237,"children":2238},{"style":320},[2239],{"type":46,"value":609},{"type":40,"tag":307,"props":2241,"children":2242},{"style":465},[2243],{"type":46,"value":614},{"type":40,"tag":307,"props":2245,"children":2246},{"style":465},[2247],{"type":46,"value":619},{"type":40,"tag":307,"props":2249,"children":2251},{"class":309,"line":2250},27,[2252,2257,2261,2265,2270,2274],{"type":40,"tag":307,"props":2253,"children":2254},{"style":492},[2255],{"type":46,"value":2256},"  instructions",{"type":40,"tag":307,"props":2258,"children":2259},{"style":465},[2260],{"type":46,"value":130},{"type":40,"tag":307,"props":2262,"children":2263},{"style":465},[2264],{"type":46,"value":604},{"type":40,"tag":307,"props":2266,"children":2267},{"style":320},[2268],{"type":46,"value":2269},"You are a research assistant.",{"type":40,"tag":307,"props":2271,"children":2272},{"style":465},[2273],{"type":46,"value":614},{"type":40,"tag":307,"props":2275,"children":2276},{"style":465},[2277],{"type":46,"value":619},{"type":40,"tag":307,"props":2279,"children":2281},{"class":309,"line":2280},28,[2282,2286,2290,2294,2299,2303],{"type":40,"tag":307,"props":2283,"children":2284},{"style":492},[2285],{"type":46,"value":628},{"type":40,"tag":307,"props":2287,"children":2288},{"style":465},[2289],{"type":46,"value":130},{"type":40,"tag":307,"props":2291,"children":2292},{"style":465},[2293],{"type":46,"value":604},{"type":40,"tag":307,"props":2295,"children":2296},{"style":320},[2297],{"type":46,"value":2298},"What are the latest AI developments?",{"type":40,"tag":307,"props":2300,"children":2301},{"style":465},[2302],{"type":46,"value":614},{"type":40,"tag":307,"props":2304,"children":2305},{"style":465},[2306],{"type":46,"value":619},{"type":40,"tag":307,"props":2308,"children":2310},{"class":309,"line":2309},29,[2311,2316,2320,2325,2329,2334],{"type":40,"tag":307,"props":2312,"children":2313},{"style":492},[2314],{"type":46,"value":2315},"  tools",{"type":40,"tag":307,"props":2317,"children":2318},{"style":465},[2319],{"type":46,"value":130},{"type":40,"tag":307,"props":2321,"children":2322},{"style":459},[2323],{"type":46,"value":2324}," [searchTool",{"type":40,"tag":307,"props":2326,"children":2327},{"style":465},[2328],{"type":46,"value":939},{"type":40,"tag":307,"props":2330,"children":2331},{"style":459},[2332],{"type":46,"value":2333}," finishTool]",{"type":40,"tag":307,"props":2335,"children":2336},{"style":465},[2337],{"type":46,"value":619},{"type":40,"tag":307,"props":2339,"children":2341},{"class":309,"line":2340},30,[2342,2347,2351,2355,2359,2363,2369,2373,2377,2381,2385,2389,2393,2397,2402],{"type":40,"tag":307,"props":2343,"children":2344},{"style":492},[2345],{"type":46,"value":2346},"  stopWhen",{"type":40,"tag":307,"props":2348,"children":2349},{"style":465},[2350],{"type":46,"value":130},{"type":40,"tag":307,"props":2352,"children":2353},{"style":459},[2354],{"type":46,"value":1873},{"type":40,"tag":307,"props":2356,"children":2357},{"style":476},[2358],{"type":46,"value":172},{"type":40,"tag":307,"props":2360,"children":2361},{"style":459},[2362],{"type":46,"value":484},{"type":40,"tag":307,"props":2364,"children":2366},{"style":2365},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[2367],{"type":46,"value":2368},"10",{"type":40,"tag":307,"props":2370,"children":2371},{"style":459},[2372],{"type":46,"value":533},{"type":40,"tag":307,"props":2374,"children":2375},{"style":465},[2376],{"type":46,"value":939},{"type":40,"tag":307,"props":2378,"children":2379},{"style":476},[2380],{"type":46,"value":1396},{"type":40,"tag":307,"props":2382,"children":2383},{"style":459},[2384],{"type":46,"value":484},{"type":40,"tag":307,"props":2386,"children":2387},{"style":465},[2388],{"type":46,"value":614},{"type":40,"tag":307,"props":2390,"children":2391},{"style":320},[2392],{"type":46,"value":1996},{"type":40,"tag":307,"props":2394,"children":2395},{"style":465},[2396],{"type":46,"value":614},{"type":40,"tag":307,"props":2398,"children":2399},{"style":459},[2400],{"type":46,"value":2401},")]",{"type":40,"tag":307,"props":2403,"children":2404},{"style":465},[2405],{"type":46,"value":619},{"type":40,"tag":307,"props":2407,"children":2409},{"class":309,"line":2408},31,[2410,2414,2418],{"type":40,"tag":307,"props":2411,"children":2412},{"style":465},[2413],{"type":46,"value":528},{"type":40,"tag":307,"props":2415,"children":2416},{"style":459},[2417],{"type":46,"value":533},{"type":40,"tag":307,"props":2419,"children":2420},{"style":465},[2421],{"type":46,"value":538},{"type":40,"tag":307,"props":2423,"children":2425},{"class":309,"line":2424},32,[2426],{"type":40,"tag":307,"props":2427,"children":2428},{"emptyLinePlaceholder":544},[2429],{"type":46,"value":547},{"type":40,"tag":307,"props":2431,"children":2433},{"class":309,"line":2432},33,[2434,2438,2442,2446,2450,2454,2458,2462,2466],{"type":40,"tag":307,"props":2435,"children":2436},{"style":453},[2437],{"type":46,"value":456},{"type":40,"tag":307,"props":2439,"children":2440},{"style":459},[2441],{"type":46,"value":686},{"type":40,"tag":307,"props":2443,"children":2444},{"style":465},[2445],{"type":46,"value":468},{"type":40,"tag":307,"props":2447,"children":2448},{"style":693},[2449],{"type":46,"value":696},{"type":40,"tag":307,"props":2451,"children":2452},{"style":459},[2453],{"type":46,"value":701},{"type":40,"tag":307,"props":2455,"children":2456},{"style":465},[2457],{"type":46,"value":509},{"type":40,"tag":307,"props":2459,"children":2460},{"style":476},[2461],{"type":46,"value":710},{"type":40,"tag":307,"props":2463,"children":2464},{"style":459},[2465],{"type":46,"value":715},{"type":40,"tag":307,"props":2467,"children":2468},{"style":465},[2469],{"type":46,"value":538},{"type":40,"tag":289,"props":2471,"children":2473},{"id":2472},"after-using-openrouteragent",[2474],{"type":46,"value":2475},"After (using @openrouter\u002Fagent)",{"type":40,"tag":296,"props":2477,"children":2479},{"className":442,"code":2478,"language":15,"meta":301,"style":301},"import { OpenRouter } from '@openrouter\u002Fagent';\nimport { tool } from '@openrouter\u002Fagent\u002Ftool';\nimport { stepCountIs, hasToolCall } from '@openrouter\u002Fagent\u002Fstop-conditions';\nimport { z } from 'zod';\n\nconst client = new OpenRouter({\n  apiKey: process.env.OPENROUTER_API_KEY,\n});\n\nconst searchTool = tool({\n  name: 'web_search',\n  description: 'Search the web',\n  inputSchema: z.object({ query: z.string() }),\n  outputSchema: z.object({ results: z.array(z.string()) }),\n  execute: async ({ query }) => {\n    return { results: ['Result 1', 'Result 2'] };\n  },\n});\n\nconst finishTool = tool({\n  name: 'finish',\n  description: 'Complete the task',\n  inputSchema: z.object({ answer: z.string() }),\n  execute: async ({ answer }) => ({ answer }),\n});\n\nconst result = client.callModel({\n  model: 'openai\u002Fgpt-5-nano',\n  instructions: 'You are a research assistant.',\n  input: 'What are the latest AI developments?',\n  tools: [searchTool, finishTool],\n  stopWhen: [stepCountIs(10), hasToolCall('finish')],\n});\n\nconst text = await result.getText();\n",[2480],{"type":40,"tag":55,"props":2481,"children":2482},{"__ignoreMap":301},[2483,2522,2562,2610,2649,2656,2687,2722,2737,2744,2771,2798,2825,2892,2971,3006,3065,3072,3087,3094,3121,3148,3175,3242,3297,3312,3319,3354,3381,3408,3435,3462,3525,3540,3548],{"type":40,"tag":307,"props":2484,"children":2485},{"class":309,"line":310},[2486,2490,2494,2498,2502,2506,2510,2514,2518],{"type":40,"tag":307,"props":2487,"children":2488},{"style":693},[2489],{"type":46,"value":857},{"type":40,"tag":307,"props":2491,"children":2492},{"style":465},[2493],{"type":46,"value":862},{"type":40,"tag":307,"props":2495,"children":2496},{"style":459},[2497],{"type":46,"value":479},{"type":40,"tag":307,"props":2499,"children":2500},{"style":465},[2501],{"type":46,"value":872},{"type":40,"tag":307,"props":2503,"children":2504},{"style":693},[2505],{"type":46,"value":877},{"type":40,"tag":307,"props":2507,"children":2508},{"style":465},[2509],{"type":46,"value":604},{"type":40,"tag":307,"props":2511,"children":2512},{"style":320},[2513],{"type":46,"value":84},{"type":40,"tag":307,"props":2515,"children":2516},{"style":465},[2517],{"type":46,"value":614},{"type":40,"tag":307,"props":2519,"children":2520},{"style":465},[2521],{"type":46,"value":538},{"type":40,"tag":307,"props":2523,"children":2524},{"class":309,"line":366},[2525,2529,2533,2537,2541,2545,2549,2554,2558],{"type":40,"tag":307,"props":2526,"children":2527},{"style":693},[2528],{"type":46,"value":857},{"type":40,"tag":307,"props":2530,"children":2531},{"style":465},[2532],{"type":46,"value":862},{"type":40,"tag":307,"props":2534,"children":2535},{"style":459},[2536],{"type":46,"value":1378},{"type":40,"tag":307,"props":2538,"children":2539},{"style":465},[2540],{"type":46,"value":872},{"type":40,"tag":307,"props":2542,"children":2543},{"style":693},[2544],{"type":46,"value":877},{"type":40,"tag":307,"props":2546,"children":2547},{"style":465},[2548],{"type":46,"value":604},{"type":40,"tag":307,"props":2550,"children":2551},{"style":320},[2552],{"type":46,"value":2553},"@openrouter\u002Fagent\u002Ftool",{"type":40,"tag":307,"props":2555,"children":2556},{"style":465},[2557],{"type":46,"value":614},{"type":40,"tag":307,"props":2559,"children":2560},{"style":465},[2561],{"type":46,"value":538},{"type":40,"tag":307,"props":2563,"children":2564},{"class":309,"line":550},[2565,2569,2573,2577,2581,2585,2589,2593,2597,2602,2606],{"type":40,"tag":307,"props":2566,"children":2567},{"style":693},[2568],{"type":46,"value":857},{"type":40,"tag":307,"props":2570,"children":2571},{"style":465},[2572],{"type":46,"value":862},{"type":40,"tag":307,"props":2574,"children":2575},{"style":459},[2576],{"type":46,"value":1387},{"type":40,"tag":307,"props":2578,"children":2579},{"style":465},[2580],{"type":46,"value":939},{"type":40,"tag":307,"props":2582,"children":2583},{"style":459},[2584],{"type":46,"value":1396},{"type":40,"tag":307,"props":2586,"children":2587},{"style":465},[2588],{"type":46,"value":872},{"type":40,"tag":307,"props":2590,"children":2591},{"style":693},[2592],{"type":46,"value":877},{"type":40,"tag":307,"props":2594,"children":2595},{"style":465},[2596],{"type":46,"value":604},{"type":40,"tag":307,"props":2598,"children":2599},{"style":320},[2600],{"type":46,"value":2601},"@openrouter\u002Fagent\u002Fstop-conditions",{"type":40,"tag":307,"props":2603,"children":2604},{"style":465},[2605],{"type":46,"value":614},{"type":40,"tag":307,"props":2607,"children":2608},{"style":465},[2609],{"type":46,"value":538},{"type":40,"tag":307,"props":2611,"children":2612},{"class":309,"line":589},[2613,2617,2621,2625,2629,2633,2637,2641,2645],{"type":40,"tag":307,"props":2614,"children":2615},{"style":693},[2616],{"type":46,"value":857},{"type":40,"tag":307,"props":2618,"children":2619},{"style":465},[2620],{"type":46,"value":862},{"type":40,"tag":307,"props":2622,"children":2623},{"style":459},[2624],{"type":46,"value":1436},{"type":40,"tag":307,"props":2626,"children":2627},{"style":465},[2628],{"type":46,"value":872},{"type":40,"tag":307,"props":2630,"children":2631},{"style":693},[2632],{"type":46,"value":877},{"type":40,"tag":307,"props":2634,"children":2635},{"style":465},[2636],{"type":46,"value":604},{"type":40,"tag":307,"props":2638,"children":2639},{"style":320},[2640],{"type":46,"value":1453},{"type":40,"tag":307,"props":2642,"children":2643},{"style":465},[2644],{"type":46,"value":614},{"type":40,"tag":307,"props":2646,"children":2647},{"style":465},[2648],{"type":46,"value":538},{"type":40,"tag":307,"props":2650,"children":2651},{"class":309,"line":622},[2652],{"type":40,"tag":307,"props":2653,"children":2654},{"emptyLinePlaceholder":544},[2655],{"type":46,"value":547},{"type":40,"tag":307,"props":2657,"children":2658},{"class":309,"line":652},[2659,2663,2667,2671,2675,2679,2683],{"type":40,"tag":307,"props":2660,"children":2661},{"style":453},[2662],{"type":46,"value":456},{"type":40,"tag":307,"props":2664,"children":2665},{"style":459},[2666],{"type":46,"value":462},{"type":40,"tag":307,"props":2668,"children":2669},{"style":465},[2670],{"type":46,"value":468},{"type":40,"tag":307,"props":2672,"children":2673},{"style":465},[2674],{"type":46,"value":473},{"type":40,"tag":307,"props":2676,"children":2677},{"style":476},[2678],{"type":46,"value":479},{"type":40,"tag":307,"props":2680,"children":2681},{"style":459},[2682],{"type":46,"value":484},{"type":40,"tag":307,"props":2684,"children":2685},{"style":465},[2686],{"type":46,"value":586},{"type":40,"tag":307,"props":2688,"children":2689},{"class":309,"line":668},[2690,2694,2698,2702,2706,2710,2714,2718],{"type":40,"tag":307,"props":2691,"children":2692},{"style":492},[2693],{"type":46,"value":1507},{"type":40,"tag":307,"props":2695,"children":2696},{"style":465},[2697],{"type":46,"value":130},{"type":40,"tag":307,"props":2699,"children":2700},{"style":459},[2701],{"type":46,"value":504},{"type":40,"tag":307,"props":2703,"children":2704},{"style":465},[2705],{"type":46,"value":509},{"type":40,"tag":307,"props":2707,"children":2708},{"style":459},[2709],{"type":46,"value":514},{"type":40,"tag":307,"props":2711,"children":2712},{"style":465},[2713],{"type":46,"value":509},{"type":40,"tag":307,"props":2715,"children":2716},{"style":459},[2717],{"type":46,"value":1532},{"type":40,"tag":307,"props":2719,"children":2720},{"style":465},[2721],{"type":46,"value":619},{"type":40,"tag":307,"props":2723,"children":2724},{"class":309,"line":676},[2725,2729,2733],{"type":40,"tag":307,"props":2726,"children":2727},{"style":465},[2728],{"type":46,"value":528},{"type":40,"tag":307,"props":2730,"children":2731},{"style":459},[2732],{"type":46,"value":533},{"type":40,"tag":307,"props":2734,"children":2735},{"style":465},[2736],{"type":46,"value":538},{"type":40,"tag":307,"props":2738,"children":2739},{"class":309,"line":1589},[2740],{"type":40,"tag":307,"props":2741,"children":2742},{"emptyLinePlaceholder":544},[2743],{"type":46,"value":547},{"type":40,"tag":307,"props":2745,"children":2746},{"class":309,"line":1619},[2747,2751,2755,2759,2763,2767],{"type":40,"tag":307,"props":2748,"children":2749},{"style":453},[2750],{"type":46,"value":456},{"type":40,"tag":307,"props":2752,"children":2753},{"style":459},[2754],{"type":46,"value":1570},{"type":40,"tag":307,"props":2756,"children":2757},{"style":465},[2758],{"type":46,"value":468},{"type":40,"tag":307,"props":2760,"children":2761},{"style":476},[2762],{"type":46,"value":1378},{"type":40,"tag":307,"props":2764,"children":2765},{"style":459},[2766],{"type":46,"value":484},{"type":40,"tag":307,"props":2768,"children":2769},{"style":465},[2770],{"type":46,"value":586},{"type":40,"tag":307,"props":2772,"children":2773},{"class":309,"line":1649},[2774,2778,2782,2786,2790,2794],{"type":40,"tag":307,"props":2775,"children":2776},{"style":492},[2777],{"type":46,"value":1595},{"type":40,"tag":307,"props":2779,"children":2780},{"style":465},[2781],{"type":46,"value":130},{"type":40,"tag":307,"props":2783,"children":2784},{"style":465},[2785],{"type":46,"value":604},{"type":40,"tag":307,"props":2787,"children":2788},{"style":320},[2789],{"type":46,"value":1608},{"type":40,"tag":307,"props":2791,"children":2792},{"style":465},[2793],{"type":46,"value":614},{"type":40,"tag":307,"props":2795,"children":2796},{"style":465},[2797],{"type":46,"value":619},{"type":40,"tag":307,"props":2799,"children":2800},{"class":309,"line":1722},[2801,2805,2809,2813,2817,2821],{"type":40,"tag":307,"props":2802,"children":2803},{"style":492},[2804],{"type":46,"value":1625},{"type":40,"tag":307,"props":2806,"children":2807},{"style":465},[2808],{"type":46,"value":130},{"type":40,"tag":307,"props":2810,"children":2811},{"style":465},[2812],{"type":46,"value":604},{"type":40,"tag":307,"props":2814,"children":2815},{"style":320},[2816],{"type":46,"value":1638},{"type":40,"tag":307,"props":2818,"children":2819},{"style":465},[2820],{"type":46,"value":614},{"type":40,"tag":307,"props":2822,"children":2823},{"style":465},[2824],{"type":46,"value":619},{"type":40,"tag":307,"props":2826,"children":2827},{"class":309,"line":1807},[2828,2832,2836,2840,2844,2848,2852,2856,2860,2864,2868,2872,2876,2880,2884,2888],{"type":40,"tag":307,"props":2829,"children":2830},{"style":492},[2831],{"type":46,"value":1655},{"type":40,"tag":307,"props":2833,"children":2834},{"style":465},[2835],{"type":46,"value":130},{"type":40,"tag":307,"props":2837,"children":2838},{"style":459},[2839],{"type":46,"value":1436},{"type":40,"tag":307,"props":2841,"children":2842},{"style":465},[2843],{"type":46,"value":509},{"type":40,"tag":307,"props":2845,"children":2846},{"style":476},[2847],{"type":46,"value":1672},{"type":40,"tag":307,"props":2849,"children":2850},{"style":459},[2851],{"type":46,"value":484},{"type":40,"tag":307,"props":2853,"children":2854},{"style":465},[2855],{"type":46,"value":489},{"type":40,"tag":307,"props":2857,"children":2858},{"style":492},[2859],{"type":46,"value":1685},{"type":40,"tag":307,"props":2861,"children":2862},{"style":465},[2863],{"type":46,"value":130},{"type":40,"tag":307,"props":2865,"children":2866},{"style":459},[2867],{"type":46,"value":1436},{"type":40,"tag":307,"props":2869,"children":2870},{"style":465},[2871],{"type":46,"value":509},{"type":40,"tag":307,"props":2873,"children":2874},{"style":476},[2875],{"type":46,"value":1702},{"type":40,"tag":307,"props":2877,"children":2878},{"style":459},[2879],{"type":46,"value":1707},{"type":40,"tag":307,"props":2881,"children":2882},{"style":465},[2883],{"type":46,"value":528},{"type":40,"tag":307,"props":2885,"children":2886},{"style":459},[2887],{"type":46,"value":533},{"type":40,"tag":307,"props":2889,"children":2890},{"style":465},[2891],{"type":46,"value":619},{"type":40,"tag":307,"props":2893,"children":2894},{"class":309,"line":1850},[2895,2899,2903,2907,2911,2915,2919,2923,2927,2931,2935,2939,2943,2947,2951,2955,2959,2963,2967],{"type":40,"tag":307,"props":2896,"children":2897},{"style":492},[2898],{"type":46,"value":1728},{"type":40,"tag":307,"props":2900,"children":2901},{"style":465},[2902],{"type":46,"value":130},{"type":40,"tag":307,"props":2904,"children":2905},{"style":459},[2906],{"type":46,"value":1436},{"type":40,"tag":307,"props":2908,"children":2909},{"style":465},[2910],{"type":46,"value":509},{"type":40,"tag":307,"props":2912,"children":2913},{"style":476},[2914],{"type":46,"value":1672},{"type":40,"tag":307,"props":2916,"children":2917},{"style":459},[2918],{"type":46,"value":484},{"type":40,"tag":307,"props":2920,"children":2921},{"style":465},[2922],{"type":46,"value":489},{"type":40,"tag":307,"props":2924,"children":2925},{"style":492},[2926],{"type":46,"value":1757},{"type":40,"tag":307,"props":2928,"children":2929},{"style":465},[2930],{"type":46,"value":130},{"type":40,"tag":307,"props":2932,"children":2933},{"style":459},[2934],{"type":46,"value":1436},{"type":40,"tag":307,"props":2936,"children":2937},{"style":465},[2938],{"type":46,"value":509},{"type":40,"tag":307,"props":2940,"children":2941},{"style":476},[2942],{"type":46,"value":1774},{"type":40,"tag":307,"props":2944,"children":2945},{"style":459},[2946],{"type":46,"value":1779},{"type":40,"tag":307,"props":2948,"children":2949},{"style":465},[2950],{"type":46,"value":509},{"type":40,"tag":307,"props":2952,"children":2953},{"style":476},[2954],{"type":46,"value":1702},{"type":40,"tag":307,"props":2956,"children":2957},{"style":459},[2958],{"type":46,"value":1792},{"type":40,"tag":307,"props":2960,"children":2961},{"style":465},[2962],{"type":46,"value":528},{"type":40,"tag":307,"props":2964,"children":2965},{"style":459},[2966],{"type":46,"value":533},{"type":40,"tag":307,"props":2968,"children":2969},{"style":465},[2970],{"type":46,"value":619},{"type":40,"tag":307,"props":2972,"children":2973},{"class":309,"line":1916},[2974,2978,2982,2986,2990,2994,2998,3002],{"type":40,"tag":307,"props":2975,"children":2976},{"style":476},[2977],{"type":46,"value":1813},{"type":40,"tag":307,"props":2979,"children":2980},{"style":465},[2981],{"type":46,"value":130},{"type":40,"tag":307,"props":2983,"children":2984},{"style":453},[2985],{"type":46,"value":1822},{"type":40,"tag":307,"props":2987,"children":2988},{"style":465},[2989],{"type":46,"value":1827},{"type":40,"tag":307,"props":2991,"children":2992},{"style":1830},[2993],{"type":46,"value":1685},{"type":40,"tag":307,"props":2995,"children":2996},{"style":465},[2997],{"type":46,"value":1837},{"type":40,"tag":307,"props":2999,"children":3000},{"style":453},[3001],{"type":46,"value":1842},{"type":40,"tag":307,"props":3003,"children":3004},{"style":465},[3005],{"type":46,"value":1847},{"type":40,"tag":307,"props":3007,"children":3008},{"class":309,"line":1925},[3009,3013,3017,3021,3025,3029,3033,3037,3041,3045,3049,3053,3057,3061],{"type":40,"tag":307,"props":3010,"children":3011},{"style":693},[3012],{"type":46,"value":1856},{"type":40,"tag":307,"props":3014,"children":3015},{"style":465},[3016],{"type":46,"value":862},{"type":40,"tag":307,"props":3018,"children":3019},{"style":492},[3020],{"type":46,"value":1757},{"type":40,"tag":307,"props":3022,"children":3023},{"style":465},[3024],{"type":46,"value":130},{"type":40,"tag":307,"props":3026,"children":3027},{"style":492},[3028],{"type":46,"value":1873},{"type":40,"tag":307,"props":3030,"children":3031},{"style":465},[3032],{"type":46,"value":614},{"type":40,"tag":307,"props":3034,"children":3035},{"style":320},[3036],{"type":46,"value":1882},{"type":40,"tag":307,"props":3038,"children":3039},{"style":465},[3040],{"type":46,"value":614},{"type":40,"tag":307,"props":3042,"children":3043},{"style":465},[3044],{"type":46,"value":939},{"type":40,"tag":307,"props":3046,"children":3047},{"style":465},[3048],{"type":46,"value":604},{"type":40,"tag":307,"props":3050,"children":3051},{"style":320},[3052],{"type":46,"value":1899},{"type":40,"tag":307,"props":3054,"children":3055},{"style":465},[3056],{"type":46,"value":614},{"type":40,"tag":307,"props":3058,"children":3059},{"style":492},[3060],{"type":46,"value":1908},{"type":40,"tag":307,"props":3062,"children":3063},{"style":465},[3064],{"type":46,"value":1913},{"type":40,"tag":307,"props":3066,"children":3067},{"class":309,"line":1941},[3068],{"type":40,"tag":307,"props":3069,"children":3070},{"style":465},[3071],{"type":46,"value":1922},{"type":40,"tag":307,"props":3073,"children":3074},{"class":309,"line":1949},[3075,3079,3083],{"type":40,"tag":307,"props":3076,"children":3077},{"style":465},[3078],{"type":46,"value":528},{"type":40,"tag":307,"props":3080,"children":3081},{"style":459},[3082],{"type":46,"value":533},{"type":40,"tag":307,"props":3084,"children":3085},{"style":465},[3086],{"type":46,"value":538},{"type":40,"tag":307,"props":3088,"children":3089},{"class":309,"line":1978},[3090],{"type":40,"tag":307,"props":3091,"children":3092},{"emptyLinePlaceholder":544},[3093],{"type":46,"value":547},{"type":40,"tag":307,"props":3095,"children":3096},{"class":309,"line":2007},[3097,3101,3105,3109,3113,3117],{"type":40,"tag":307,"props":3098,"children":3099},{"style":453},[3100],{"type":46,"value":456},{"type":40,"tag":307,"props":3102,"children":3103},{"style":459},[3104],{"type":46,"value":1959},{"type":40,"tag":307,"props":3106,"children":3107},{"style":465},[3108],{"type":46,"value":468},{"type":40,"tag":307,"props":3110,"children":3111},{"style":476},[3112],{"type":46,"value":1378},{"type":40,"tag":307,"props":3114,"children":3115},{"style":459},[3116],{"type":46,"value":484},{"type":40,"tag":307,"props":3118,"children":3119},{"style":465},[3120],{"type":46,"value":586},{"type":40,"tag":307,"props":3122,"children":3123},{"class":309,"line":2036},[3124,3128,3132,3136,3140,3144],{"type":40,"tag":307,"props":3125,"children":3126},{"style":492},[3127],{"type":46,"value":1595},{"type":40,"tag":307,"props":3129,"children":3130},{"style":465},[3131],{"type":46,"value":130},{"type":40,"tag":307,"props":3133,"children":3134},{"style":465},[3135],{"type":46,"value":604},{"type":40,"tag":307,"props":3137,"children":3138},{"style":320},[3139],{"type":46,"value":1996},{"type":40,"tag":307,"props":3141,"children":3142},{"style":465},[3143],{"type":46,"value":614},{"type":40,"tag":307,"props":3145,"children":3146},{"style":465},[3147],{"type":46,"value":619},{"type":40,"tag":307,"props":3149,"children":3150},{"class":309,"line":2105},[3151,3155,3159,3163,3167,3171],{"type":40,"tag":307,"props":3152,"children":3153},{"style":492},[3154],{"type":46,"value":1625},{"type":40,"tag":307,"props":3156,"children":3157},{"style":465},[3158],{"type":46,"value":130},{"type":40,"tag":307,"props":3160,"children":3161},{"style":465},[3162],{"type":46,"value":604},{"type":40,"tag":307,"props":3164,"children":3165},{"style":320},[3166],{"type":46,"value":2025},{"type":40,"tag":307,"props":3168,"children":3169},{"style":465},[3170],{"type":46,"value":614},{"type":40,"tag":307,"props":3172,"children":3173},{"style":465},[3174],{"type":46,"value":619},{"type":40,"tag":307,"props":3176,"children":3177},{"class":309,"line":2163},[3178,3182,3186,3190,3194,3198,3202,3206,3210,3214,3218,3222,3226,3230,3234,3238],{"type":40,"tag":307,"props":3179,"children":3180},{"style":492},[3181],{"type":46,"value":1655},{"type":40,"tag":307,"props":3183,"children":3184},{"style":465},[3185],{"type":46,"value":130},{"type":40,"tag":307,"props":3187,"children":3188},{"style":459},[3189],{"type":46,"value":1436},{"type":40,"tag":307,"props":3191,"children":3192},{"style":465},[3193],{"type":46,"value":509},{"type":40,"tag":307,"props":3195,"children":3196},{"style":476},[3197],{"type":46,"value":1672},{"type":40,"tag":307,"props":3199,"children":3200},{"style":459},[3201],{"type":46,"value":484},{"type":40,"tag":307,"props":3203,"children":3204},{"style":465},[3205],{"type":46,"value":489},{"type":40,"tag":307,"props":3207,"children":3208},{"style":492},[3209],{"type":46,"value":2070},{"type":40,"tag":307,"props":3211,"children":3212},{"style":465},[3213],{"type":46,"value":130},{"type":40,"tag":307,"props":3215,"children":3216},{"style":459},[3217],{"type":46,"value":1436},{"type":40,"tag":307,"props":3219,"children":3220},{"style":465},[3221],{"type":46,"value":509},{"type":40,"tag":307,"props":3223,"children":3224},{"style":476},[3225],{"type":46,"value":1702},{"type":40,"tag":307,"props":3227,"children":3228},{"style":459},[3229],{"type":46,"value":1707},{"type":40,"tag":307,"props":3231,"children":3232},{"style":465},[3233],{"type":46,"value":528},{"type":40,"tag":307,"props":3235,"children":3236},{"style":459},[3237],{"type":46,"value":533},{"type":40,"tag":307,"props":3239,"children":3240},{"style":465},[3241],{"type":46,"value":619},{"type":40,"tag":307,"props":3243,"children":3244},{"class":309,"line":2179},[3245,3249,3253,3257,3261,3265,3269,3273,3277,3281,3285,3289,3293],{"type":40,"tag":307,"props":3246,"children":3247},{"style":476},[3248],{"type":46,"value":1813},{"type":40,"tag":307,"props":3250,"children":3251},{"style":465},[3252],{"type":46,"value":130},{"type":40,"tag":307,"props":3254,"children":3255},{"style":453},[3256],{"type":46,"value":1822},{"type":40,"tag":307,"props":3258,"children":3259},{"style":465},[3260],{"type":46,"value":1827},{"type":40,"tag":307,"props":3262,"children":3263},{"style":1830},[3264],{"type":46,"value":2070},{"type":40,"tag":307,"props":3266,"children":3267},{"style":465},[3268],{"type":46,"value":1837},{"type":40,"tag":307,"props":3270,"children":3271},{"style":453},[3272],{"type":46,"value":1842},{"type":40,"tag":307,"props":3274,"children":3275},{"style":459},[3276],{"type":46,"value":2139},{"type":40,"tag":307,"props":3278,"children":3279},{"style":465},[3280],{"type":46,"value":489},{"type":40,"tag":307,"props":3282,"children":3283},{"style":459},[3284],{"type":46,"value":2148},{"type":40,"tag":307,"props":3286,"children":3287},{"style":465},[3288],{"type":46,"value":528},{"type":40,"tag":307,"props":3290,"children":3291},{"style":459},[3292],{"type":46,"value":533},{"type":40,"tag":307,"props":3294,"children":3295},{"style":465},[3296],{"type":46,"value":619},{"type":40,"tag":307,"props":3298,"children":3299},{"class":309,"line":2187},[3300,3304,3308],{"type":40,"tag":307,"props":3301,"children":3302},{"style":465},[3303],{"type":46,"value":528},{"type":40,"tag":307,"props":3305,"children":3306},{"style":459},[3307],{"type":46,"value":533},{"type":40,"tag":307,"props":3309,"children":3310},{"style":465},[3311],{"type":46,"value":538},{"type":40,"tag":307,"props":3313,"children":3314},{"class":309,"line":27},[3315],{"type":40,"tag":307,"props":3316,"children":3317},{"emptyLinePlaceholder":544},[3318],{"type":46,"value":547},{"type":40,"tag":307,"props":3320,"children":3321},{"class":309,"line":2250},[3322,3326,3330,3334,3338,3342,3346,3350],{"type":40,"tag":307,"props":3323,"children":3324},{"style":453},[3325],{"type":46,"value":456},{"type":40,"tag":307,"props":3327,"children":3328},{"style":459},[3329],{"type":46,"value":560},{"type":40,"tag":307,"props":3331,"children":3332},{"style":465},[3333],{"type":46,"value":468},{"type":40,"tag":307,"props":3335,"children":3336},{"style":459},[3337],{"type":46,"value":569},{"type":40,"tag":307,"props":3339,"children":3340},{"style":465},[3341],{"type":46,"value":509},{"type":40,"tag":307,"props":3343,"children":3344},{"style":476},[3345],{"type":46,"value":60},{"type":40,"tag":307,"props":3347,"children":3348},{"style":459},[3349],{"type":46,"value":484},{"type":40,"tag":307,"props":3351,"children":3352},{"style":465},[3353],{"type":46,"value":586},{"type":40,"tag":307,"props":3355,"children":3356},{"class":309,"line":2280},[3357,3361,3365,3369,3373,3377],{"type":40,"tag":307,"props":3358,"children":3359},{"style":492},[3360],{"type":46,"value":595},{"type":40,"tag":307,"props":3362,"children":3363},{"style":465},[3364],{"type":46,"value":130},{"type":40,"tag":307,"props":3366,"children":3367},{"style":465},[3368],{"type":46,"value":604},{"type":40,"tag":307,"props":3370,"children":3371},{"style":320},[3372],{"type":46,"value":609},{"type":40,"tag":307,"props":3374,"children":3375},{"style":465},[3376],{"type":46,"value":614},{"type":40,"tag":307,"props":3378,"children":3379},{"style":465},[3380],{"type":46,"value":619},{"type":40,"tag":307,"props":3382,"children":3383},{"class":309,"line":2309},[3384,3388,3392,3396,3400,3404],{"type":40,"tag":307,"props":3385,"children":3386},{"style":492},[3387],{"type":46,"value":2256},{"type":40,"tag":307,"props":3389,"children":3390},{"style":465},[3391],{"type":46,"value":130},{"type":40,"tag":307,"props":3393,"children":3394},{"style":465},[3395],{"type":46,"value":604},{"type":40,"tag":307,"props":3397,"children":3398},{"style":320},[3399],{"type":46,"value":2269},{"type":40,"tag":307,"props":3401,"children":3402},{"style":465},[3403],{"type":46,"value":614},{"type":40,"tag":307,"props":3405,"children":3406},{"style":465},[3407],{"type":46,"value":619},{"type":40,"tag":307,"props":3409,"children":3410},{"class":309,"line":2340},[3411,3415,3419,3423,3427,3431],{"type":40,"tag":307,"props":3412,"children":3413},{"style":492},[3414],{"type":46,"value":628},{"type":40,"tag":307,"props":3416,"children":3417},{"style":465},[3418],{"type":46,"value":130},{"type":40,"tag":307,"props":3420,"children":3421},{"style":465},[3422],{"type":46,"value":604},{"type":40,"tag":307,"props":3424,"children":3425},{"style":320},[3426],{"type":46,"value":2298},{"type":40,"tag":307,"props":3428,"children":3429},{"style":465},[3430],{"type":46,"value":614},{"type":40,"tag":307,"props":3432,"children":3433},{"style":465},[3434],{"type":46,"value":619},{"type":40,"tag":307,"props":3436,"children":3437},{"class":309,"line":2408},[3438,3442,3446,3450,3454,3458],{"type":40,"tag":307,"props":3439,"children":3440},{"style":492},[3441],{"type":46,"value":2315},{"type":40,"tag":307,"props":3443,"children":3444},{"style":465},[3445],{"type":46,"value":130},{"type":40,"tag":307,"props":3447,"children":3448},{"style":459},[3449],{"type":46,"value":2324},{"type":40,"tag":307,"props":3451,"children":3452},{"style":465},[3453],{"type":46,"value":939},{"type":40,"tag":307,"props":3455,"children":3456},{"style":459},[3457],{"type":46,"value":2333},{"type":40,"tag":307,"props":3459,"children":3460},{"style":465},[3461],{"type":46,"value":619},{"type":40,"tag":307,"props":3463,"children":3464},{"class":309,"line":2424},[3465,3469,3473,3477,3481,3485,3489,3493,3497,3501,3505,3509,3513,3517,3521],{"type":40,"tag":307,"props":3466,"children":3467},{"style":492},[3468],{"type":46,"value":2346},{"type":40,"tag":307,"props":3470,"children":3471},{"style":465},[3472],{"type":46,"value":130},{"type":40,"tag":307,"props":3474,"children":3475},{"style":459},[3476],{"type":46,"value":1873},{"type":40,"tag":307,"props":3478,"children":3479},{"style":476},[3480],{"type":46,"value":172},{"type":40,"tag":307,"props":3482,"children":3483},{"style":459},[3484],{"type":46,"value":484},{"type":40,"tag":307,"props":3486,"children":3487},{"style":2365},[3488],{"type":46,"value":2368},{"type":40,"tag":307,"props":3490,"children":3491},{"style":459},[3492],{"type":46,"value":533},{"type":40,"tag":307,"props":3494,"children":3495},{"style":465},[3496],{"type":46,"value":939},{"type":40,"tag":307,"props":3498,"children":3499},{"style":476},[3500],{"type":46,"value":1396},{"type":40,"tag":307,"props":3502,"children":3503},{"style":459},[3504],{"type":46,"value":484},{"type":40,"tag":307,"props":3506,"children":3507},{"style":465},[3508],{"type":46,"value":614},{"type":40,"tag":307,"props":3510,"children":3511},{"style":320},[3512],{"type":46,"value":1996},{"type":40,"tag":307,"props":3514,"children":3515},{"style":465},[3516],{"type":46,"value":614},{"type":40,"tag":307,"props":3518,"children":3519},{"style":459},[3520],{"type":46,"value":2401},{"type":40,"tag":307,"props":3522,"children":3523},{"style":465},[3524],{"type":46,"value":619},{"type":40,"tag":307,"props":3526,"children":3527},{"class":309,"line":2432},[3528,3532,3536],{"type":40,"tag":307,"props":3529,"children":3530},{"style":465},[3531],{"type":46,"value":528},{"type":40,"tag":307,"props":3533,"children":3534},{"style":459},[3535],{"type":46,"value":533},{"type":40,"tag":307,"props":3537,"children":3538},{"style":465},[3539],{"type":46,"value":538},{"type":40,"tag":307,"props":3541,"children":3543},{"class":309,"line":3542},34,[3544],{"type":40,"tag":307,"props":3545,"children":3546},{"emptyLinePlaceholder":544},[3547],{"type":46,"value":547},{"type":40,"tag":307,"props":3549,"children":3551},{"class":309,"line":3550},35,[3552,3556,3560,3564,3568,3572,3576,3580,3584],{"type":40,"tag":307,"props":3553,"children":3554},{"style":453},[3555],{"type":46,"value":456},{"type":40,"tag":307,"props":3557,"children":3558},{"style":459},[3559],{"type":46,"value":686},{"type":40,"tag":307,"props":3561,"children":3562},{"style":465},[3563],{"type":46,"value":468},{"type":40,"tag":307,"props":3565,"children":3566},{"style":693},[3567],{"type":46,"value":696},{"type":40,"tag":307,"props":3569,"children":3570},{"style":459},[3571],{"type":46,"value":701},{"type":40,"tag":307,"props":3573,"children":3574},{"style":465},[3575],{"type":46,"value":509},{"type":40,"tag":307,"props":3577,"children":3578},{"style":476},[3579],{"type":46,"value":710},{"type":40,"tag":307,"props":3581,"children":3582},{"style":459},[3583],{"type":46,"value":715},{"type":40,"tag":307,"props":3585,"children":3586},{"style":465},[3587],{"type":46,"value":538},{"type":40,"tag":49,"props":3589,"children":3590},{},[3591],{"type":46,"value":3592},"The only changes are the three import lines at the top.",{"type":40,"tag":109,"props":3594,"children":3595},{},[],{"type":40,"tag":113,"props":3597,"children":3599},{"id":3598},"when-to-keep-openroutersdk",[3600],{"type":46,"value":3601},"When to Keep @openrouter\u002Fsdk",{"type":40,"tag":49,"props":3603,"children":3604},{},[3605,3607,3612],{"type":46,"value":3606},"Keep ",{"type":40,"tag":55,"props":3608,"children":3610},{"className":3609},[],[3611],{"type":46,"value":76},{"type":46,"value":3613}," installed if you use any of these non-agent features:",{"type":40,"tag":736,"props":3615,"children":3616},{},[3617,3633],{"type":40,"tag":740,"props":3618,"children":3619},{},[3620],{"type":40,"tag":744,"props":3621,"children":3622},{},[3623,3628],{"type":40,"tag":748,"props":3624,"children":3625},{},[3626],{"type":46,"value":3627},"Feature",{"type":40,"tag":748,"props":3629,"children":3630},{},[3631],{"type":46,"value":3632},"Access",{"type":40,"tag":759,"props":3634,"children":3635},{},[3636,3653,3670,3687,3704,3721,3747],{"type":40,"tag":744,"props":3637,"children":3638},{},[3639,3644],{"type":40,"tag":766,"props":3640,"children":3641},{},[3642],{"type":46,"value":3643},"Model listing",{"type":40,"tag":766,"props":3645,"children":3646},{},[3647],{"type":40,"tag":55,"props":3648,"children":3650},{"className":3649},[],[3651],{"type":46,"value":3652},"client.models.list()",{"type":40,"tag":744,"props":3654,"children":3655},{},[3656,3661],{"type":40,"tag":766,"props":3657,"children":3658},{},[3659],{"type":46,"value":3660},"Chat completions",{"type":40,"tag":766,"props":3662,"children":3663},{},[3664],{"type":40,"tag":55,"props":3665,"children":3667},{"className":3666},[],[3668],{"type":46,"value":3669},"client.chat.send()",{"type":40,"tag":744,"props":3671,"children":3672},{},[3673,3678],{"type":40,"tag":766,"props":3674,"children":3675},{},[3676],{"type":46,"value":3677},"Legacy completions",{"type":40,"tag":766,"props":3679,"children":3680},{},[3681],{"type":40,"tag":55,"props":3682,"children":3684},{"className":3683},[],[3685],{"type":46,"value":3686},"client.completions.generate()",{"type":40,"tag":744,"props":3688,"children":3689},{},[3690,3695],{"type":40,"tag":766,"props":3691,"children":3692},{},[3693],{"type":46,"value":3694},"Usage analytics",{"type":40,"tag":766,"props":3696,"children":3697},{},[3698],{"type":40,"tag":55,"props":3699,"children":3701},{"className":3700},[],[3702],{"type":46,"value":3703},"client.analytics.getUserActivity()",{"type":40,"tag":744,"props":3705,"children":3706},{},[3707,3712],{"type":40,"tag":766,"props":3708,"children":3709},{},[3710],{"type":46,"value":3711},"Credit balance",{"type":40,"tag":766,"props":3713,"children":3714},{},[3715],{"type":40,"tag":55,"props":3716,"children":3718},{"className":3717},[],[3719],{"type":46,"value":3720},"client.credits.getCredits()",{"type":40,"tag":744,"props":3722,"children":3723},{},[3724,3729],{"type":40,"tag":766,"props":3725,"children":3726},{},[3727],{"type":46,"value":3728},"API key management",{"type":40,"tag":766,"props":3730,"children":3731},{},[3732,3738,3739,3745],{"type":40,"tag":55,"props":3733,"children":3735},{"className":3734},[],[3736],{"type":46,"value":3737},"client.apiKeys.list()",{"type":46,"value":62},{"type":40,"tag":55,"props":3740,"children":3742},{"className":3741},[],[3743],{"type":46,"value":3744},".create()",{"type":46,"value":3746},", etc.",{"type":40,"tag":744,"props":3748,"children":3749},{},[3750,3755],{"type":40,"tag":766,"props":3751,"children":3752},{},[3753],{"type":46,"value":3754},"OAuth PKCE flow",{"type":40,"tag":766,"props":3756,"children":3757},{},[3758,3764,3765],{"type":40,"tag":55,"props":3759,"children":3761},{"className":3760},[],[3762],{"type":46,"value":3763},"client.oAuth.createAuthCode()",{"type":46,"value":62},{"type":40,"tag":55,"props":3766,"children":3768},{"className":3767},[],[3769],{"type":46,"value":3770},".exchangeAuthCodeForAPIKey()",{"type":40,"tag":49,"props":3772,"children":3773},{},[3774,3776,3781,3783,3788],{"type":46,"value":3775},"For mixed projects, use ",{"type":40,"tag":55,"props":3777,"children":3779},{"className":3778},[],[3780],{"type":46,"value":76},{"type":46,"value":3782}," for these features and ",{"type":40,"tag":55,"props":3784,"children":3786},{"className":3785},[],[3787],{"type":46,"value":84},{"type":46,"value":3789}," for agent features:",{"type":40,"tag":296,"props":3791,"children":3793},{"className":442,"code":3792,"language":15,"meta":301,"style":301},"import OpenRouter from '@openrouter\u002Fsdk';               \u002F\u002F SDK client for models, credits, etc.\nimport { OpenRouter as Agent } from '@openrouter\u002Fagent'; \u002F\u002F Agent client for callModel\nimport { tool } from '@openrouter\u002Fagent\u002Ftool';\nimport { stepCountIs } from '@openrouter\u002Fagent\u002Fstop-conditions';\n\n\u002F\u002F Use SDK client for non-agent features\nconst sdkClient = new OpenRouter({ apiKey: process.env.OPENROUTER_API_KEY });\nconst models = await sdkClient.models.list();\nconst credits = await sdkClient.credits.getCredits();\n\n\u002F\u002F Use Agent client for callModel\nconst agent = new Agent({ apiKey: process.env.OPENROUTER_API_KEY });\nconst result = agent.callModel({\n  model: 'openai\u002Fgpt-5-nano',\n  input: 'Hello!',\n  tools: [myTool],\n  stopWhen: stepCountIs(5),\n});\n",[3794],{"type":40,"tag":55,"props":3795,"children":3796},{"__ignoreMap":301},[3797,3836,3890,3929,3968,3975,3983,4055,4106,4156,4163,4171,4243,4279,4306,4333,4353,4385],{"type":40,"tag":307,"props":3798,"children":3799},{"class":309,"line":310},[3800,3804,3809,3814,3818,3822,3826,3831],{"type":40,"tag":307,"props":3801,"children":3802},{"style":693},[3803],{"type":46,"value":857},{"type":40,"tag":307,"props":3805,"children":3806},{"style":459},[3807],{"type":46,"value":3808}," OpenRouter ",{"type":40,"tag":307,"props":3810,"children":3811},{"style":693},[3812],{"type":46,"value":3813},"from",{"type":40,"tag":307,"props":3815,"children":3816},{"style":465},[3817],{"type":46,"value":604},{"type":40,"tag":307,"props":3819,"children":3820},{"style":320},[3821],{"type":46,"value":76},{"type":40,"tag":307,"props":3823,"children":3824},{"style":465},[3825],{"type":46,"value":614},{"type":40,"tag":307,"props":3827,"children":3828},{"style":465},[3829],{"type":46,"value":3830},";",{"type":40,"tag":307,"props":3832,"children":3833},{"style":907},[3834],{"type":46,"value":3835},"               \u002F\u002F SDK client for models, credits, etc.\n",{"type":40,"tag":307,"props":3837,"children":3838},{"class":309,"line":366},[3839,3843,3847,3851,3856,3861,3865,3869,3873,3877,3881,3885],{"type":40,"tag":307,"props":3840,"children":3841},{"style":693},[3842],{"type":46,"value":857},{"type":40,"tag":307,"props":3844,"children":3845},{"style":465},[3846],{"type":46,"value":862},{"type":40,"tag":307,"props":3848,"children":3849},{"style":459},[3850],{"type":46,"value":479},{"type":40,"tag":307,"props":3852,"children":3853},{"style":693},[3854],{"type":46,"value":3855}," as",{"type":40,"tag":307,"props":3857,"children":3858},{"style":459},[3859],{"type":46,"value":3860}," Agent",{"type":40,"tag":307,"props":3862,"children":3863},{"style":465},[3864],{"type":46,"value":872},{"type":40,"tag":307,"props":3866,"children":3867},{"style":693},[3868],{"type":46,"value":877},{"type":40,"tag":307,"props":3870,"children":3871},{"style":465},[3872],{"type":46,"value":604},{"type":40,"tag":307,"props":3874,"children":3875},{"style":320},[3876],{"type":46,"value":84},{"type":40,"tag":307,"props":3878,"children":3879},{"style":465},[3880],{"type":46,"value":614},{"type":40,"tag":307,"props":3882,"children":3883},{"style":465},[3884],{"type":46,"value":3830},{"type":40,"tag":307,"props":3886,"children":3887},{"style":907},[3888],{"type":46,"value":3889}," \u002F\u002F Agent client for callModel\n",{"type":40,"tag":307,"props":3891,"children":3892},{"class":309,"line":550},[3893,3897,3901,3905,3909,3913,3917,3921,3925],{"type":40,"tag":307,"props":3894,"children":3895},{"style":693},[3896],{"type":46,"value":857},{"type":40,"tag":307,"props":3898,"children":3899},{"style":465},[3900],{"type":46,"value":862},{"type":40,"tag":307,"props":3902,"children":3903},{"style":459},[3904],{"type":46,"value":1378},{"type":40,"tag":307,"props":3906,"children":3907},{"style":465},[3908],{"type":46,"value":872},{"type":40,"tag":307,"props":3910,"children":3911},{"style":693},[3912],{"type":46,"value":877},{"type":40,"tag":307,"props":3914,"children":3915},{"style":465},[3916],{"type":46,"value":604},{"type":40,"tag":307,"props":3918,"children":3919},{"style":320},[3920],{"type":46,"value":2553},{"type":40,"tag":307,"props":3922,"children":3923},{"style":465},[3924],{"type":46,"value":614},{"type":40,"tag":307,"props":3926,"children":3927},{"style":465},[3928],{"type":46,"value":538},{"type":40,"tag":307,"props":3930,"children":3931},{"class":309,"line":589},[3932,3936,3940,3944,3948,3952,3956,3960,3964],{"type":40,"tag":307,"props":3933,"children":3934},{"style":693},[3935],{"type":46,"value":857},{"type":40,"tag":307,"props":3937,"children":3938},{"style":465},[3939],{"type":46,"value":862},{"type":40,"tag":307,"props":3941,"children":3942},{"style":459},[3943],{"type":46,"value":1387},{"type":40,"tag":307,"props":3945,"children":3946},{"style":465},[3947],{"type":46,"value":872},{"type":40,"tag":307,"props":3949,"children":3950},{"style":693},[3951],{"type":46,"value":877},{"type":40,"tag":307,"props":3953,"children":3954},{"style":465},[3955],{"type":46,"value":604},{"type":40,"tag":307,"props":3957,"children":3958},{"style":320},[3959],{"type":46,"value":2601},{"type":40,"tag":307,"props":3961,"children":3962},{"style":465},[3963],{"type":46,"value":614},{"type":40,"tag":307,"props":3965,"children":3966},{"style":465},[3967],{"type":46,"value":538},{"type":40,"tag":307,"props":3969,"children":3970},{"class":309,"line":622},[3971],{"type":40,"tag":307,"props":3972,"children":3973},{"emptyLinePlaceholder":544},[3974],{"type":46,"value":547},{"type":40,"tag":307,"props":3976,"children":3977},{"class":309,"line":652},[3978],{"type":40,"tag":307,"props":3979,"children":3980},{"style":907},[3981],{"type":46,"value":3982},"\u002F\u002F Use SDK client for non-agent features\n",{"type":40,"tag":307,"props":3984,"children":3985},{"class":309,"line":668},[3986,3990,3995,3999,4003,4007,4011,4015,4019,4023,4027,4031,4035,4039,4043,4047,4051],{"type":40,"tag":307,"props":3987,"children":3988},{"style":453},[3989],{"type":46,"value":456},{"type":40,"tag":307,"props":3991,"children":3992},{"style":459},[3993],{"type":46,"value":3994}," sdkClient ",{"type":40,"tag":307,"props":3996,"children":3997},{"style":465},[3998],{"type":46,"value":468},{"type":40,"tag":307,"props":4000,"children":4001},{"style":465},[4002],{"type":46,"value":473},{"type":40,"tag":307,"props":4004,"children":4005},{"style":476},[4006],{"type":46,"value":479},{"type":40,"tag":307,"props":4008,"children":4009},{"style":459},[4010],{"type":46,"value":484},{"type":40,"tag":307,"props":4012,"children":4013},{"style":465},[4014],{"type":46,"value":489},{"type":40,"tag":307,"props":4016,"children":4017},{"style":492},[4018],{"type":46,"value":495},{"type":40,"tag":307,"props":4020,"children":4021},{"style":465},[4022],{"type":46,"value":130},{"type":40,"tag":307,"props":4024,"children":4025},{"style":459},[4026],{"type":46,"value":504},{"type":40,"tag":307,"props":4028,"children":4029},{"style":465},[4030],{"type":46,"value":509},{"type":40,"tag":307,"props":4032,"children":4033},{"style":459},[4034],{"type":46,"value":514},{"type":40,"tag":307,"props":4036,"children":4037},{"style":465},[4038],{"type":46,"value":509},{"type":40,"tag":307,"props":4040,"children":4041},{"style":459},[4042],{"type":46,"value":523},{"type":40,"tag":307,"props":4044,"children":4045},{"style":465},[4046],{"type":46,"value":528},{"type":40,"tag":307,"props":4048,"children":4049},{"style":459},[4050],{"type":46,"value":533},{"type":40,"tag":307,"props":4052,"children":4053},{"style":465},[4054],{"type":46,"value":538},{"type":40,"tag":307,"props":4056,"children":4057},{"class":309,"line":676},[4058,4062,4067,4071,4075,4080,4084,4089,4093,4098,4102],{"type":40,"tag":307,"props":4059,"children":4060},{"style":453},[4061],{"type":46,"value":456},{"type":40,"tag":307,"props":4063,"children":4064},{"style":459},[4065],{"type":46,"value":4066}," models ",{"type":40,"tag":307,"props":4068,"children":4069},{"style":465},[4070],{"type":46,"value":468},{"type":40,"tag":307,"props":4072,"children":4073},{"style":693},[4074],{"type":46,"value":696},{"type":40,"tag":307,"props":4076,"children":4077},{"style":459},[4078],{"type":46,"value":4079}," sdkClient",{"type":40,"tag":307,"props":4081,"children":4082},{"style":465},[4083],{"type":46,"value":509},{"type":40,"tag":307,"props":4085,"children":4086},{"style":459},[4087],{"type":46,"value":4088},"models",{"type":40,"tag":307,"props":4090,"children":4091},{"style":465},[4092],{"type":46,"value":509},{"type":40,"tag":307,"props":4094,"children":4095},{"style":476},[4096],{"type":46,"value":4097},"list",{"type":40,"tag":307,"props":4099,"children":4100},{"style":459},[4101],{"type":46,"value":715},{"type":40,"tag":307,"props":4103,"children":4104},{"style":465},[4105],{"type":46,"value":538},{"type":40,"tag":307,"props":4107,"children":4108},{"class":309,"line":1589},[4109,4113,4118,4122,4126,4130,4134,4139,4143,4148,4152],{"type":40,"tag":307,"props":4110,"children":4111},{"style":453},[4112],{"type":46,"value":456},{"type":40,"tag":307,"props":4114,"children":4115},{"style":459},[4116],{"type":46,"value":4117}," credits ",{"type":40,"tag":307,"props":4119,"children":4120},{"style":465},[4121],{"type":46,"value":468},{"type":40,"tag":307,"props":4123,"children":4124},{"style":693},[4125],{"type":46,"value":696},{"type":40,"tag":307,"props":4127,"children":4128},{"style":459},[4129],{"type":46,"value":4079},{"type":40,"tag":307,"props":4131,"children":4132},{"style":465},[4133],{"type":46,"value":509},{"type":40,"tag":307,"props":4135,"children":4136},{"style":459},[4137],{"type":46,"value":4138},"credits",{"type":40,"tag":307,"props":4140,"children":4141},{"style":465},[4142],{"type":46,"value":509},{"type":40,"tag":307,"props":4144,"children":4145},{"style":476},[4146],{"type":46,"value":4147},"getCredits",{"type":40,"tag":307,"props":4149,"children":4150},{"style":459},[4151],{"type":46,"value":715},{"type":40,"tag":307,"props":4153,"children":4154},{"style":465},[4155],{"type":46,"value":538},{"type":40,"tag":307,"props":4157,"children":4158},{"class":309,"line":1619},[4159],{"type":40,"tag":307,"props":4160,"children":4161},{"emptyLinePlaceholder":544},[4162],{"type":46,"value":547},{"type":40,"tag":307,"props":4164,"children":4165},{"class":309,"line":1649},[4166],{"type":40,"tag":307,"props":4167,"children":4168},{"style":907},[4169],{"type":46,"value":4170},"\u002F\u002F Use Agent client for callModel\n",{"type":40,"tag":307,"props":4172,"children":4173},{"class":309,"line":1722},[4174,4178,4183,4187,4191,4195,4199,4203,4207,4211,4215,4219,4223,4227,4231,4235,4239],{"type":40,"tag":307,"props":4175,"children":4176},{"style":453},[4177],{"type":46,"value":456},{"type":40,"tag":307,"props":4179,"children":4180},{"style":459},[4181],{"type":46,"value":4182}," agent ",{"type":40,"tag":307,"props":4184,"children":4185},{"style":465},[4186],{"type":46,"value":468},{"type":40,"tag":307,"props":4188,"children":4189},{"style":465},[4190],{"type":46,"value":473},{"type":40,"tag":307,"props":4192,"children":4193},{"style":476},[4194],{"type":46,"value":3860},{"type":40,"tag":307,"props":4196,"children":4197},{"style":459},[4198],{"type":46,"value":484},{"type":40,"tag":307,"props":4200,"children":4201},{"style":465},[4202],{"type":46,"value":489},{"type":40,"tag":307,"props":4204,"children":4205},{"style":492},[4206],{"type":46,"value":495},{"type":40,"tag":307,"props":4208,"children":4209},{"style":465},[4210],{"type":46,"value":130},{"type":40,"tag":307,"props":4212,"children":4213},{"style":459},[4214],{"type":46,"value":504},{"type":40,"tag":307,"props":4216,"children":4217},{"style":465},[4218],{"type":46,"value":509},{"type":40,"tag":307,"props":4220,"children":4221},{"style":459},[4222],{"type":46,"value":514},{"type":40,"tag":307,"props":4224,"children":4225},{"style":465},[4226],{"type":46,"value":509},{"type":40,"tag":307,"props":4228,"children":4229},{"style":459},[4230],{"type":46,"value":523},{"type":40,"tag":307,"props":4232,"children":4233},{"style":465},[4234],{"type":46,"value":528},{"type":40,"tag":307,"props":4236,"children":4237},{"style":459},[4238],{"type":46,"value":533},{"type":40,"tag":307,"props":4240,"children":4241},{"style":465},[4242],{"type":46,"value":538},{"type":40,"tag":307,"props":4244,"children":4245},{"class":309,"line":1807},[4246,4250,4254,4258,4263,4267,4271,4275],{"type":40,"tag":307,"props":4247,"children":4248},{"style":453},[4249],{"type":46,"value":456},{"type":40,"tag":307,"props":4251,"children":4252},{"style":459},[4253],{"type":46,"value":560},{"type":40,"tag":307,"props":4255,"children":4256},{"style":465},[4257],{"type":46,"value":468},{"type":40,"tag":307,"props":4259,"children":4260},{"style":459},[4261],{"type":46,"value":4262}," agent",{"type":40,"tag":307,"props":4264,"children":4265},{"style":465},[4266],{"type":46,"value":509},{"type":40,"tag":307,"props":4268,"children":4269},{"style":476},[4270],{"type":46,"value":60},{"type":40,"tag":307,"props":4272,"children":4273},{"style":459},[4274],{"type":46,"value":484},{"type":40,"tag":307,"props":4276,"children":4277},{"style":465},[4278],{"type":46,"value":586},{"type":40,"tag":307,"props":4280,"children":4281},{"class":309,"line":1850},[4282,4286,4290,4294,4298,4302],{"type":40,"tag":307,"props":4283,"children":4284},{"style":492},[4285],{"type":46,"value":595},{"type":40,"tag":307,"props":4287,"children":4288},{"style":465},[4289],{"type":46,"value":130},{"type":40,"tag":307,"props":4291,"children":4292},{"style":465},[4293],{"type":46,"value":604},{"type":40,"tag":307,"props":4295,"children":4296},{"style":320},[4297],{"type":46,"value":609},{"type":40,"tag":307,"props":4299,"children":4300},{"style":465},[4301],{"type":46,"value":614},{"type":40,"tag":307,"props":4303,"children":4304},{"style":465},[4305],{"type":46,"value":619},{"type":40,"tag":307,"props":4307,"children":4308},{"class":309,"line":1916},[4309,4313,4317,4321,4325,4329],{"type":40,"tag":307,"props":4310,"children":4311},{"style":492},[4312],{"type":46,"value":628},{"type":40,"tag":307,"props":4314,"children":4315},{"style":465},[4316],{"type":46,"value":130},{"type":40,"tag":307,"props":4318,"children":4319},{"style":465},[4320],{"type":46,"value":604},{"type":40,"tag":307,"props":4322,"children":4323},{"style":320},[4324],{"type":46,"value":641},{"type":40,"tag":307,"props":4326,"children":4327},{"style":465},[4328],{"type":46,"value":614},{"type":40,"tag":307,"props":4330,"children":4331},{"style":465},[4332],{"type":46,"value":619},{"type":40,"tag":307,"props":4334,"children":4335},{"class":309,"line":1925},[4336,4340,4344,4349],{"type":40,"tag":307,"props":4337,"children":4338},{"style":492},[4339],{"type":46,"value":2315},{"type":40,"tag":307,"props":4341,"children":4342},{"style":465},[4343],{"type":46,"value":130},{"type":40,"tag":307,"props":4345,"children":4346},{"style":459},[4347],{"type":46,"value":4348}," [myTool]",{"type":40,"tag":307,"props":4350,"children":4351},{"style":465},[4352],{"type":46,"value":619},{"type":40,"tag":307,"props":4354,"children":4355},{"class":309,"line":1941},[4356,4360,4364,4368,4372,4377,4381],{"type":40,"tag":307,"props":4357,"children":4358},{"style":492},[4359],{"type":46,"value":2346},{"type":40,"tag":307,"props":4361,"children":4362},{"style":465},[4363],{"type":46,"value":130},{"type":40,"tag":307,"props":4365,"children":4366},{"style":476},[4367],{"type":46,"value":1387},{"type":40,"tag":307,"props":4369,"children":4370},{"style":459},[4371],{"type":46,"value":484},{"type":40,"tag":307,"props":4373,"children":4374},{"style":2365},[4375],{"type":46,"value":4376},"5",{"type":40,"tag":307,"props":4378,"children":4379},{"style":459},[4380],{"type":46,"value":533},{"type":40,"tag":307,"props":4382,"children":4383},{"style":465},[4384],{"type":46,"value":619},{"type":40,"tag":307,"props":4386,"children":4387},{"class":309,"line":1949},[4388,4392,4396],{"type":40,"tag":307,"props":4389,"children":4390},{"style":465},[4391],{"type":46,"value":528},{"type":40,"tag":307,"props":4393,"children":4394},{"style":459},[4395],{"type":46,"value":533},{"type":40,"tag":307,"props":4397,"children":4398},{"style":465},[4399],{"type":46,"value":538},{"type":40,"tag":109,"props":4401,"children":4402},{},[],{"type":40,"tag":113,"props":4404,"children":4406},{"id":4405},"new-features-in-openrouteragent",[4407],{"type":46,"value":4408},"New Features in @openrouter\u002Fagent",{"type":40,"tag":49,"props":4410,"children":4411},{},[4412,4414,4419,4421,4426],{"type":46,"value":4413},"These features are only available in ",{"type":40,"tag":55,"props":4415,"children":4417},{"className":4416},[],[4418],{"type":46,"value":84},{"type":46,"value":4420},", not in ",{"type":40,"tag":55,"props":4422,"children":4424},{"className":4423},[],[4425],{"type":46,"value":76},{"type":46,"value":130},{"type":40,"tag":289,"props":4428,"children":4430},{"id":4429},"shared-context-schema",[4431],{"type":46,"value":4432},"Shared Context Schema",{"type":40,"tag":49,"props":4434,"children":4435},{},[4436],{"type":46,"value":4437},"Type-safe shared state across all tools in a conversation:",{"type":40,"tag":296,"props":4439,"children":4441},{"className":442,"code":4440,"language":15,"meta":301,"style":301},"import { OpenRouter } from '@openrouter\u002Fagent';\nimport { z } from 'zod';\n\nconst client = new OpenRouter({ apiKey: '...' });\n\nconst result = client.callModel({\n  model: 'openai\u002Fgpt-5-nano',\n  input: 'Process this data',\n  sharedContextSchema: z.object({\n    userId: z.string(),\n    sessionData: z.record(z.unknown()),\n  }),\n  context: {\n    shared: { userId: '123', sessionData: {} },\n  },\n  tools: [myTool],\n});\n",[4442],{"type":40,"tag":55,"props":4443,"children":4444},{"__ignoreMap":301},[4445,4484,4523,4530,4594,4601,4636,4663,4691,4723,4755,4802,4818,4834,4895,4902,4921],{"type":40,"tag":307,"props":4446,"children":4447},{"class":309,"line":310},[4448,4452,4456,4460,4464,4468,4472,4476,4480],{"type":40,"tag":307,"props":4449,"children":4450},{"style":693},[4451],{"type":46,"value":857},{"type":40,"tag":307,"props":4453,"children":4454},{"style":465},[4455],{"type":46,"value":862},{"type":40,"tag":307,"props":4457,"children":4458},{"style":459},[4459],{"type":46,"value":479},{"type":40,"tag":307,"props":4461,"children":4462},{"style":465},[4463],{"type":46,"value":872},{"type":40,"tag":307,"props":4465,"children":4466},{"style":693},[4467],{"type":46,"value":877},{"type":40,"tag":307,"props":4469,"children":4470},{"style":465},[4471],{"type":46,"value":604},{"type":40,"tag":307,"props":4473,"children":4474},{"style":320},[4475],{"type":46,"value":84},{"type":40,"tag":307,"props":4477,"children":4478},{"style":465},[4479],{"type":46,"value":614},{"type":40,"tag":307,"props":4481,"children":4482},{"style":465},[4483],{"type":46,"value":538},{"type":40,"tag":307,"props":4485,"children":4486},{"class":309,"line":366},[4487,4491,4495,4499,4503,4507,4511,4515,4519],{"type":40,"tag":307,"props":4488,"children":4489},{"style":693},[4490],{"type":46,"value":857},{"type":40,"tag":307,"props":4492,"children":4493},{"style":465},[4494],{"type":46,"value":862},{"type":40,"tag":307,"props":4496,"children":4497},{"style":459},[4498],{"type":46,"value":1436},{"type":40,"tag":307,"props":4500,"children":4501},{"style":465},[4502],{"type":46,"value":872},{"type":40,"tag":307,"props":4504,"children":4505},{"style":693},[4506],{"type":46,"value":877},{"type":40,"tag":307,"props":4508,"children":4509},{"style":465},[4510],{"type":46,"value":604},{"type":40,"tag":307,"props":4512,"children":4513},{"style":320},[4514],{"type":46,"value":1453},{"type":40,"tag":307,"props":4516,"children":4517},{"style":465},[4518],{"type":46,"value":614},{"type":40,"tag":307,"props":4520,"children":4521},{"style":465},[4522],{"type":46,"value":538},{"type":40,"tag":307,"props":4524,"children":4525},{"class":309,"line":550},[4526],{"type":40,"tag":307,"props":4527,"children":4528},{"emptyLinePlaceholder":544},[4529],{"type":46,"value":547},{"type":40,"tag":307,"props":4531,"children":4532},{"class":309,"line":589},[4533,4537,4541,4545,4549,4553,4557,4561,4565,4569,4573,4578,4582,4586,4590],{"type":40,"tag":307,"props":4534,"children":4535},{"style":453},[4536],{"type":46,"value":456},{"type":40,"tag":307,"props":4538,"children":4539},{"style":459},[4540],{"type":46,"value":462},{"type":40,"tag":307,"props":4542,"children":4543},{"style":465},[4544],{"type":46,"value":468},{"type":40,"tag":307,"props":4546,"children":4547},{"style":465},[4548],{"type":46,"value":473},{"type":40,"tag":307,"props":4550,"children":4551},{"style":476},[4552],{"type":46,"value":479},{"type":40,"tag":307,"props":4554,"children":4555},{"style":459},[4556],{"type":46,"value":484},{"type":40,"tag":307,"props":4558,"children":4559},{"style":465},[4560],{"type":46,"value":489},{"type":40,"tag":307,"props":4562,"children":4563},{"style":492},[4564],{"type":46,"value":495},{"type":40,"tag":307,"props":4566,"children":4567},{"style":465},[4568],{"type":46,"value":130},{"type":40,"tag":307,"props":4570,"children":4571},{"style":465},[4572],{"type":46,"value":604},{"type":40,"tag":307,"props":4574,"children":4575},{"style":320},[4576],{"type":46,"value":4577},"...",{"type":40,"tag":307,"props":4579,"children":4580},{"style":465},[4581],{"type":46,"value":614},{"type":40,"tag":307,"props":4583,"children":4584},{"style":465},[4585],{"type":46,"value":872},{"type":40,"tag":307,"props":4587,"children":4588},{"style":459},[4589],{"type":46,"value":533},{"type":40,"tag":307,"props":4591,"children":4592},{"style":465},[4593],{"type":46,"value":538},{"type":40,"tag":307,"props":4595,"children":4596},{"class":309,"line":622},[4597],{"type":40,"tag":307,"props":4598,"children":4599},{"emptyLinePlaceholder":544},[4600],{"type":46,"value":547},{"type":40,"tag":307,"props":4602,"children":4603},{"class":309,"line":652},[4604,4608,4612,4616,4620,4624,4628,4632],{"type":40,"tag":307,"props":4605,"children":4606},{"style":453},[4607],{"type":46,"value":456},{"type":40,"tag":307,"props":4609,"children":4610},{"style":459},[4611],{"type":46,"value":560},{"type":40,"tag":307,"props":4613,"children":4614},{"style":465},[4615],{"type":46,"value":468},{"type":40,"tag":307,"props":4617,"children":4618},{"style":459},[4619],{"type":46,"value":569},{"type":40,"tag":307,"props":4621,"children":4622},{"style":465},[4623],{"type":46,"value":509},{"type":40,"tag":307,"props":4625,"children":4626},{"style":476},[4627],{"type":46,"value":60},{"type":40,"tag":307,"props":4629,"children":4630},{"style":459},[4631],{"type":46,"value":484},{"type":40,"tag":307,"props":4633,"children":4634},{"style":465},[4635],{"type":46,"value":586},{"type":40,"tag":307,"props":4637,"children":4638},{"class":309,"line":668},[4639,4643,4647,4651,4655,4659],{"type":40,"tag":307,"props":4640,"children":4641},{"style":492},[4642],{"type":46,"value":595},{"type":40,"tag":307,"props":4644,"children":4645},{"style":465},[4646],{"type":46,"value":130},{"type":40,"tag":307,"props":4648,"children":4649},{"style":465},[4650],{"type":46,"value":604},{"type":40,"tag":307,"props":4652,"children":4653},{"style":320},[4654],{"type":46,"value":609},{"type":40,"tag":307,"props":4656,"children":4657},{"style":465},[4658],{"type":46,"value":614},{"type":40,"tag":307,"props":4660,"children":4661},{"style":465},[4662],{"type":46,"value":619},{"type":40,"tag":307,"props":4664,"children":4665},{"class":309,"line":676},[4666,4670,4674,4678,4683,4687],{"type":40,"tag":307,"props":4667,"children":4668},{"style":492},[4669],{"type":46,"value":628},{"type":40,"tag":307,"props":4671,"children":4672},{"style":465},[4673],{"type":46,"value":130},{"type":40,"tag":307,"props":4675,"children":4676},{"style":465},[4677],{"type":46,"value":604},{"type":40,"tag":307,"props":4679,"children":4680},{"style":320},[4681],{"type":46,"value":4682},"Process this data",{"type":40,"tag":307,"props":4684,"children":4685},{"style":465},[4686],{"type":46,"value":614},{"type":40,"tag":307,"props":4688,"children":4689},{"style":465},[4690],{"type":46,"value":619},{"type":40,"tag":307,"props":4692,"children":4693},{"class":309,"line":1589},[4694,4699,4703,4707,4711,4715,4719],{"type":40,"tag":307,"props":4695,"children":4696},{"style":492},[4697],{"type":46,"value":4698},"  sharedContextSchema",{"type":40,"tag":307,"props":4700,"children":4701},{"style":465},[4702],{"type":46,"value":130},{"type":40,"tag":307,"props":4704,"children":4705},{"style":459},[4706],{"type":46,"value":1436},{"type":40,"tag":307,"props":4708,"children":4709},{"style":465},[4710],{"type":46,"value":509},{"type":40,"tag":307,"props":4712,"children":4713},{"style":476},[4714],{"type":46,"value":1672},{"type":40,"tag":307,"props":4716,"children":4717},{"style":459},[4718],{"type":46,"value":484},{"type":40,"tag":307,"props":4720,"children":4721},{"style":465},[4722],{"type":46,"value":586},{"type":40,"tag":307,"props":4724,"children":4725},{"class":309,"line":1619},[4726,4731,4735,4739,4743,4747,4751],{"type":40,"tag":307,"props":4727,"children":4728},{"style":492},[4729],{"type":46,"value":4730},"    userId",{"type":40,"tag":307,"props":4732,"children":4733},{"style":465},[4734],{"type":46,"value":130},{"type":40,"tag":307,"props":4736,"children":4737},{"style":459},[4738],{"type":46,"value":1436},{"type":40,"tag":307,"props":4740,"children":4741},{"style":465},[4742],{"type":46,"value":509},{"type":40,"tag":307,"props":4744,"children":4745},{"style":476},[4746],{"type":46,"value":1702},{"type":40,"tag":307,"props":4748,"children":4749},{"style":459},[4750],{"type":46,"value":715},{"type":40,"tag":307,"props":4752,"children":4753},{"style":465},[4754],{"type":46,"value":619},{"type":40,"tag":307,"props":4756,"children":4757},{"class":309,"line":1649},[4758,4763,4767,4771,4775,4780,4784,4788,4793,4798],{"type":40,"tag":307,"props":4759,"children":4760},{"style":492},[4761],{"type":46,"value":4762},"    sessionData",{"type":40,"tag":307,"props":4764,"children":4765},{"style":465},[4766],{"type":46,"value":130},{"type":40,"tag":307,"props":4768,"children":4769},{"style":459},[4770],{"type":46,"value":1436},{"type":40,"tag":307,"props":4772,"children":4773},{"style":465},[4774],{"type":46,"value":509},{"type":40,"tag":307,"props":4776,"children":4777},{"style":476},[4778],{"type":46,"value":4779},"record",{"type":40,"tag":307,"props":4781,"children":4782},{"style":459},[4783],{"type":46,"value":1779},{"type":40,"tag":307,"props":4785,"children":4786},{"style":465},[4787],{"type":46,"value":509},{"type":40,"tag":307,"props":4789,"children":4790},{"style":476},[4791],{"type":46,"value":4792},"unknown",{"type":40,"tag":307,"props":4794,"children":4795},{"style":459},[4796],{"type":46,"value":4797},"())",{"type":40,"tag":307,"props":4799,"children":4800},{"style":465},[4801],{"type":46,"value":619},{"type":40,"tag":307,"props":4803,"children":4804},{"class":309,"line":1722},[4805,4810,4814],{"type":40,"tag":307,"props":4806,"children":4807},{"style":465},[4808],{"type":46,"value":4809},"  }",{"type":40,"tag":307,"props":4811,"children":4812},{"style":459},[4813],{"type":46,"value":533},{"type":40,"tag":307,"props":4815,"children":4816},{"style":465},[4817],{"type":46,"value":619},{"type":40,"tag":307,"props":4819,"children":4820},{"class":309,"line":1807},[4821,4826,4830],{"type":40,"tag":307,"props":4822,"children":4823},{"style":492},[4824],{"type":46,"value":4825},"  context",{"type":40,"tag":307,"props":4827,"children":4828},{"style":465},[4829],{"type":46,"value":130},{"type":40,"tag":307,"props":4831,"children":4832},{"style":465},[4833],{"type":46,"value":1847},{"type":40,"tag":307,"props":4835,"children":4836},{"class":309,"line":1850},[4837,4842,4846,4850,4855,4859,4863,4868,4872,4876,4881,4885,4890],{"type":40,"tag":307,"props":4838,"children":4839},{"style":492},[4840],{"type":46,"value":4841},"    shared",{"type":40,"tag":307,"props":4843,"children":4844},{"style":465},[4845],{"type":46,"value":130},{"type":40,"tag":307,"props":4847,"children":4848},{"style":465},[4849],{"type":46,"value":862},{"type":40,"tag":307,"props":4851,"children":4852},{"style":492},[4853],{"type":46,"value":4854}," userId",{"type":40,"tag":307,"props":4856,"children":4857},{"style":465},[4858],{"type":46,"value":130},{"type":40,"tag":307,"props":4860,"children":4861},{"style":465},[4862],{"type":46,"value":604},{"type":40,"tag":307,"props":4864,"children":4865},{"style":320},[4866],{"type":46,"value":4867},"123",{"type":40,"tag":307,"props":4869,"children":4870},{"style":465},[4871],{"type":46,"value":614},{"type":40,"tag":307,"props":4873,"children":4874},{"style":465},[4875],{"type":46,"value":939},{"type":40,"tag":307,"props":4877,"children":4878},{"style":492},[4879],{"type":46,"value":4880}," sessionData",{"type":40,"tag":307,"props":4882,"children":4883},{"style":465},[4884],{"type":46,"value":130},{"type":40,"tag":307,"props":4886,"children":4887},{"style":465},[4888],{"type":46,"value":4889}," {}",{"type":40,"tag":307,"props":4891,"children":4892},{"style":465},[4893],{"type":46,"value":4894}," },\n",{"type":40,"tag":307,"props":4896,"children":4897},{"class":309,"line":1916},[4898],{"type":40,"tag":307,"props":4899,"children":4900},{"style":465},[4901],{"type":46,"value":1922},{"type":40,"tag":307,"props":4903,"children":4904},{"class":309,"line":1925},[4905,4909,4913,4917],{"type":40,"tag":307,"props":4906,"children":4907},{"style":492},[4908],{"type":46,"value":2315},{"type":40,"tag":307,"props":4910,"children":4911},{"style":465},[4912],{"type":46,"value":130},{"type":40,"tag":307,"props":4914,"children":4915},{"style":459},[4916],{"type":46,"value":4348},{"type":40,"tag":307,"props":4918,"children":4919},{"style":465},[4920],{"type":46,"value":619},{"type":40,"tag":307,"props":4922,"children":4923},{"class":309,"line":1941},[4924,4928,4932],{"type":40,"tag":307,"props":4925,"children":4926},{"style":465},[4927],{"type":46,"value":528},{"type":40,"tag":307,"props":4929,"children":4930},{"style":459},[4931],{"type":46,"value":533},{"type":40,"tag":307,"props":4933,"children":4934},{"style":465},[4935],{"type":46,"value":538},{"type":40,"tag":289,"props":4937,"children":4939},{"id":4938},"tool-context",[4940],{"type":46,"value":4941},"Tool Context",{"type":40,"tag":49,"props":4943,"children":4944},{},[4945],{"type":46,"value":4946},"Tools can declare their own typed context and access shared context:",{"type":40,"tag":296,"props":4948,"children":4950},{"className":442,"code":4949,"language":15,"meta":301,"style":301},"import { tool } from '@openrouter\u002Fagent\u002Ftool';\nimport { z } from 'zod';\n\nconst myTool = tool({\n  name: 'my_tool',\n  description: 'A tool with context',\n  inputSchema: z.object({ query: z.string() }),\n  contextSchema: z.object({ apiKey: z.string() }),\n  execute: async (params, context) => {\n    \u002F\u002F context.local — this tool's own context\n    \u002F\u002F context.shared — shared context across all tools\n    \u002F\u002F context.setContext({ ... }) — update this tool's context\n    \u002F\u002F context.setSharedContext({ ... }) — update shared context\n    return { result: 'done' };\n  },\n});\n",[4951],{"type":40,"tag":55,"props":4952,"children":4953},{"__ignoreMap":301},[4954,4993,5032,5039,5067,5095,5123,5190,5258,5303,5311,5319,5327,5335,5372,5379],{"type":40,"tag":307,"props":4955,"children":4956},{"class":309,"line":310},[4957,4961,4965,4969,4973,4977,4981,4985,4989],{"type":40,"tag":307,"props":4958,"children":4959},{"style":693},[4960],{"type":46,"value":857},{"type":40,"tag":307,"props":4962,"children":4963},{"style":465},[4964],{"type":46,"value":862},{"type":40,"tag":307,"props":4966,"children":4967},{"style":459},[4968],{"type":46,"value":1378},{"type":40,"tag":307,"props":4970,"children":4971},{"style":465},[4972],{"type":46,"value":872},{"type":40,"tag":307,"props":4974,"children":4975},{"style":693},[4976],{"type":46,"value":877},{"type":40,"tag":307,"props":4978,"children":4979},{"style":465},[4980],{"type":46,"value":604},{"type":40,"tag":307,"props":4982,"children":4983},{"style":320},[4984],{"type":46,"value":2553},{"type":40,"tag":307,"props":4986,"children":4987},{"style":465},[4988],{"type":46,"value":614},{"type":40,"tag":307,"props":4990,"children":4991},{"style":465},[4992],{"type":46,"value":538},{"type":40,"tag":307,"props":4994,"children":4995},{"class":309,"line":366},[4996,5000,5004,5008,5012,5016,5020,5024,5028],{"type":40,"tag":307,"props":4997,"children":4998},{"style":693},[4999],{"type":46,"value":857},{"type":40,"tag":307,"props":5001,"children":5002},{"style":465},[5003],{"type":46,"value":862},{"type":40,"tag":307,"props":5005,"children":5006},{"style":459},[5007],{"type":46,"value":1436},{"type":40,"tag":307,"props":5009,"children":5010},{"style":465},[5011],{"type":46,"value":872},{"type":40,"tag":307,"props":5013,"children":5014},{"style":693},[5015],{"type":46,"value":877},{"type":40,"tag":307,"props":5017,"children":5018},{"style":465},[5019],{"type":46,"value":604},{"type":40,"tag":307,"props":5021,"children":5022},{"style":320},[5023],{"type":46,"value":1453},{"type":40,"tag":307,"props":5025,"children":5026},{"style":465},[5027],{"type":46,"value":614},{"type":40,"tag":307,"props":5029,"children":5030},{"style":465},[5031],{"type":46,"value":538},{"type":40,"tag":307,"props":5033,"children":5034},{"class":309,"line":550},[5035],{"type":40,"tag":307,"props":5036,"children":5037},{"emptyLinePlaceholder":544},[5038],{"type":46,"value":547},{"type":40,"tag":307,"props":5040,"children":5041},{"class":309,"line":589},[5042,5046,5051,5055,5059,5063],{"type":40,"tag":307,"props":5043,"children":5044},{"style":453},[5045],{"type":46,"value":456},{"type":40,"tag":307,"props":5047,"children":5048},{"style":459},[5049],{"type":46,"value":5050}," myTool ",{"type":40,"tag":307,"props":5052,"children":5053},{"style":465},[5054],{"type":46,"value":468},{"type":40,"tag":307,"props":5056,"children":5057},{"style":476},[5058],{"type":46,"value":1378},{"type":40,"tag":307,"props":5060,"children":5061},{"style":459},[5062],{"type":46,"value":484},{"type":40,"tag":307,"props":5064,"children":5065},{"style":465},[5066],{"type":46,"value":586},{"type":40,"tag":307,"props":5068,"children":5069},{"class":309,"line":622},[5070,5074,5078,5082,5087,5091],{"type":40,"tag":307,"props":5071,"children":5072},{"style":492},[5073],{"type":46,"value":1595},{"type":40,"tag":307,"props":5075,"children":5076},{"style":465},[5077],{"type":46,"value":130},{"type":40,"tag":307,"props":5079,"children":5080},{"style":465},[5081],{"type":46,"value":604},{"type":40,"tag":307,"props":5083,"children":5084},{"style":320},[5085],{"type":46,"value":5086},"my_tool",{"type":40,"tag":307,"props":5088,"children":5089},{"style":465},[5090],{"type":46,"value":614},{"type":40,"tag":307,"props":5092,"children":5093},{"style":465},[5094],{"type":46,"value":619},{"type":40,"tag":307,"props":5096,"children":5097},{"class":309,"line":652},[5098,5102,5106,5110,5115,5119],{"type":40,"tag":307,"props":5099,"children":5100},{"style":492},[5101],{"type":46,"value":1625},{"type":40,"tag":307,"props":5103,"children":5104},{"style":465},[5105],{"type":46,"value":130},{"type":40,"tag":307,"props":5107,"children":5108},{"style":465},[5109],{"type":46,"value":604},{"type":40,"tag":307,"props":5111,"children":5112},{"style":320},[5113],{"type":46,"value":5114},"A tool with context",{"type":40,"tag":307,"props":5116,"children":5117},{"style":465},[5118],{"type":46,"value":614},{"type":40,"tag":307,"props":5120,"children":5121},{"style":465},[5122],{"type":46,"value":619},{"type":40,"tag":307,"props":5124,"children":5125},{"class":309,"line":668},[5126,5130,5134,5138,5142,5146,5150,5154,5158,5162,5166,5170,5174,5178,5182,5186],{"type":40,"tag":307,"props":5127,"children":5128},{"style":492},[5129],{"type":46,"value":1655},{"type":40,"tag":307,"props":5131,"children":5132},{"style":465},[5133],{"type":46,"value":130},{"type":40,"tag":307,"props":5135,"children":5136},{"style":459},[5137],{"type":46,"value":1436},{"type":40,"tag":307,"props":5139,"children":5140},{"style":465},[5141],{"type":46,"value":509},{"type":40,"tag":307,"props":5143,"children":5144},{"style":476},[5145],{"type":46,"value":1672},{"type":40,"tag":307,"props":5147,"children":5148},{"style":459},[5149],{"type":46,"value":484},{"type":40,"tag":307,"props":5151,"children":5152},{"style":465},[5153],{"type":46,"value":489},{"type":40,"tag":307,"props":5155,"children":5156},{"style":492},[5157],{"type":46,"value":1685},{"type":40,"tag":307,"props":5159,"children":5160},{"style":465},[5161],{"type":46,"value":130},{"type":40,"tag":307,"props":5163,"children":5164},{"style":459},[5165],{"type":46,"value":1436},{"type":40,"tag":307,"props":5167,"children":5168},{"style":465},[5169],{"type":46,"value":509},{"type":40,"tag":307,"props":5171,"children":5172},{"style":476},[5173],{"type":46,"value":1702},{"type":40,"tag":307,"props":5175,"children":5176},{"style":459},[5177],{"type":46,"value":1707},{"type":40,"tag":307,"props":5179,"children":5180},{"style":465},[5181],{"type":46,"value":528},{"type":40,"tag":307,"props":5183,"children":5184},{"style":459},[5185],{"type":46,"value":533},{"type":40,"tag":307,"props":5187,"children":5188},{"style":465},[5189],{"type":46,"value":619},{"type":40,"tag":307,"props":5191,"children":5192},{"class":309,"line":676},[5193,5198,5202,5206,5210,5214,5218,5222,5226,5230,5234,5238,5242,5246,5250,5254],{"type":40,"tag":307,"props":5194,"children":5195},{"style":492},[5196],{"type":46,"value":5197},"  contextSchema",{"type":40,"tag":307,"props":5199,"children":5200},{"style":465},[5201],{"type":46,"value":130},{"type":40,"tag":307,"props":5203,"children":5204},{"style":459},[5205],{"type":46,"value":1436},{"type":40,"tag":307,"props":5207,"children":5208},{"style":465},[5209],{"type":46,"value":509},{"type":40,"tag":307,"props":5211,"children":5212},{"style":476},[5213],{"type":46,"value":1672},{"type":40,"tag":307,"props":5215,"children":5216},{"style":459},[5217],{"type":46,"value":484},{"type":40,"tag":307,"props":5219,"children":5220},{"style":465},[5221],{"type":46,"value":489},{"type":40,"tag":307,"props":5223,"children":5224},{"style":492},[5225],{"type":46,"value":495},{"type":40,"tag":307,"props":5227,"children":5228},{"style":465},[5229],{"type":46,"value":130},{"type":40,"tag":307,"props":5231,"children":5232},{"style":459},[5233],{"type":46,"value":1436},{"type":40,"tag":307,"props":5235,"children":5236},{"style":465},[5237],{"type":46,"value":509},{"type":40,"tag":307,"props":5239,"children":5240},{"style":476},[5241],{"type":46,"value":1702},{"type":40,"tag":307,"props":5243,"children":5244},{"style":459},[5245],{"type":46,"value":1707},{"type":40,"tag":307,"props":5247,"children":5248},{"style":465},[5249],{"type":46,"value":528},{"type":40,"tag":307,"props":5251,"children":5252},{"style":459},[5253],{"type":46,"value":533},{"type":40,"tag":307,"props":5255,"children":5256},{"style":465},[5257],{"type":46,"value":619},{"type":40,"tag":307,"props":5259,"children":5260},{"class":309,"line":1589},[5261,5265,5269,5273,5277,5282,5286,5291,5295,5299],{"type":40,"tag":307,"props":5262,"children":5263},{"style":476},[5264],{"type":46,"value":1813},{"type":40,"tag":307,"props":5266,"children":5267},{"style":465},[5268],{"type":46,"value":130},{"type":40,"tag":307,"props":5270,"children":5271},{"style":453},[5272],{"type":46,"value":1822},{"type":40,"tag":307,"props":5274,"children":5275},{"style":465},[5276],{"type":46,"value":2139},{"type":40,"tag":307,"props":5278,"children":5279},{"style":1830},[5280],{"type":46,"value":5281},"params",{"type":40,"tag":307,"props":5283,"children":5284},{"style":465},[5285],{"type":46,"value":939},{"type":40,"tag":307,"props":5287,"children":5288},{"style":1830},[5289],{"type":46,"value":5290}," context",{"type":40,"tag":307,"props":5292,"children":5293},{"style":465},[5294],{"type":46,"value":533},{"type":40,"tag":307,"props":5296,"children":5297},{"style":453},[5298],{"type":46,"value":1842},{"type":40,"tag":307,"props":5300,"children":5301},{"style":465},[5302],{"type":46,"value":1847},{"type":40,"tag":307,"props":5304,"children":5305},{"class":309,"line":1619},[5306],{"type":40,"tag":307,"props":5307,"children":5308},{"style":907},[5309],{"type":46,"value":5310},"    \u002F\u002F context.local — this tool's own context\n",{"type":40,"tag":307,"props":5312,"children":5313},{"class":309,"line":1649},[5314],{"type":40,"tag":307,"props":5315,"children":5316},{"style":907},[5317],{"type":46,"value":5318},"    \u002F\u002F context.shared — shared context across all tools\n",{"type":40,"tag":307,"props":5320,"children":5321},{"class":309,"line":1722},[5322],{"type":40,"tag":307,"props":5323,"children":5324},{"style":907},[5325],{"type":46,"value":5326},"    \u002F\u002F context.setContext({ ... }) — update this tool's context\n",{"type":40,"tag":307,"props":5328,"children":5329},{"class":309,"line":1807},[5330],{"type":40,"tag":307,"props":5331,"children":5332},{"style":907},[5333],{"type":46,"value":5334},"    \u002F\u002F context.setSharedContext({ ... }) — update shared context\n",{"type":40,"tag":307,"props":5336,"children":5337},{"class":309,"line":1850},[5338,5342,5346,5350,5354,5358,5363,5367],{"type":40,"tag":307,"props":5339,"children":5340},{"style":693},[5341],{"type":46,"value":1856},{"type":40,"tag":307,"props":5343,"children":5344},{"style":465},[5345],{"type":46,"value":862},{"type":40,"tag":307,"props":5347,"children":5348},{"style":492},[5349],{"type":46,"value":701},{"type":40,"tag":307,"props":5351,"children":5352},{"style":465},[5353],{"type":46,"value":130},{"type":40,"tag":307,"props":5355,"children":5356},{"style":465},[5357],{"type":46,"value":604},{"type":40,"tag":307,"props":5359,"children":5360},{"style":320},[5361],{"type":46,"value":5362},"done",{"type":40,"tag":307,"props":5364,"children":5365},{"style":465},[5366],{"type":46,"value":614},{"type":40,"tag":307,"props":5368,"children":5369},{"style":465},[5370],{"type":46,"value":5371}," };\n",{"type":40,"tag":307,"props":5373,"children":5374},{"class":309,"line":1916},[5375],{"type":40,"tag":307,"props":5376,"children":5377},{"style":465},[5378],{"type":46,"value":1922},{"type":40,"tag":307,"props":5380,"children":5381},{"class":309,"line":1925},[5382,5386,5390],{"type":40,"tag":307,"props":5383,"children":5384},{"style":465},[5385],{"type":46,"value":528},{"type":40,"tag":307,"props":5387,"children":5388},{"style":459},[5389],{"type":46,"value":533},{"type":40,"tag":307,"props":5391,"children":5392},{"style":465},[5393],{"type":46,"value":538},{"type":40,"tag":289,"props":5395,"children":5397},{"id":5396},"tool-approval-flow",[5398],{"type":46,"value":5399},"Tool Approval Flow",{"type":40,"tag":49,"props":5401,"children":5402},{},[5403],{"type":46,"value":5404},"Require user approval before tool execution:",{"type":40,"tag":296,"props":5406,"children":5408},{"className":442,"code":5407,"language":15,"meta":301,"style":301},"const dangerousTool = tool({\n  name: 'delete_file',\n  description: 'Delete a file',\n  inputSchema: z.object({ path: z.string() }),\n  requireApproval: true, \u002F\u002F or a function: (toolCall, context) => boolean\n  execute: async ({ path }) => { \u002F* ... *\u002F },\n});\n",[5409],{"type":40,"tag":55,"props":5410,"children":5411},{"__ignoreMap":301},[5412,5440,5468,5496,5564,5591,5635],{"type":40,"tag":307,"props":5413,"children":5414},{"class":309,"line":310},[5415,5419,5424,5428,5432,5436],{"type":40,"tag":307,"props":5416,"children":5417},{"style":453},[5418],{"type":46,"value":456},{"type":40,"tag":307,"props":5420,"children":5421},{"style":459},[5422],{"type":46,"value":5423}," dangerousTool ",{"type":40,"tag":307,"props":5425,"children":5426},{"style":465},[5427],{"type":46,"value":468},{"type":40,"tag":307,"props":5429,"children":5430},{"style":476},[5431],{"type":46,"value":1378},{"type":40,"tag":307,"props":5433,"children":5434},{"style":459},[5435],{"type":46,"value":484},{"type":40,"tag":307,"props":5437,"children":5438},{"style":465},[5439],{"type":46,"value":586},{"type":40,"tag":307,"props":5441,"children":5442},{"class":309,"line":366},[5443,5447,5451,5455,5460,5464],{"type":40,"tag":307,"props":5444,"children":5445},{"style":492},[5446],{"type":46,"value":1595},{"type":40,"tag":307,"props":5448,"children":5449},{"style":465},[5450],{"type":46,"value":130},{"type":40,"tag":307,"props":5452,"children":5453},{"style":465},[5454],{"type":46,"value":604},{"type":40,"tag":307,"props":5456,"children":5457},{"style":320},[5458],{"type":46,"value":5459},"delete_file",{"type":40,"tag":307,"props":5461,"children":5462},{"style":465},[5463],{"type":46,"value":614},{"type":40,"tag":307,"props":5465,"children":5466},{"style":465},[5467],{"type":46,"value":619},{"type":40,"tag":307,"props":5469,"children":5470},{"class":309,"line":550},[5471,5475,5479,5483,5488,5492],{"type":40,"tag":307,"props":5472,"children":5473},{"style":492},[5474],{"type":46,"value":1625},{"type":40,"tag":307,"props":5476,"children":5477},{"style":465},[5478],{"type":46,"value":130},{"type":40,"tag":307,"props":5480,"children":5481},{"style":465},[5482],{"type":46,"value":604},{"type":40,"tag":307,"props":5484,"children":5485},{"style":320},[5486],{"type":46,"value":5487},"Delete a file",{"type":40,"tag":307,"props":5489,"children":5490},{"style":465},[5491],{"type":46,"value":614},{"type":40,"tag":307,"props":5493,"children":5494},{"style":465},[5495],{"type":46,"value":619},{"type":40,"tag":307,"props":5497,"children":5498},{"class":309,"line":589},[5499,5503,5507,5511,5515,5519,5523,5527,5532,5536,5540,5544,5548,5552,5556,5560],{"type":40,"tag":307,"props":5500,"children":5501},{"style":492},[5502],{"type":46,"value":1655},{"type":40,"tag":307,"props":5504,"children":5505},{"style":465},[5506],{"type":46,"value":130},{"type":40,"tag":307,"props":5508,"children":5509},{"style":459},[5510],{"type":46,"value":1436},{"type":40,"tag":307,"props":5512,"children":5513},{"style":465},[5514],{"type":46,"value":509},{"type":40,"tag":307,"props":5516,"children":5517},{"style":476},[5518],{"type":46,"value":1672},{"type":40,"tag":307,"props":5520,"children":5521},{"style":459},[5522],{"type":46,"value":484},{"type":40,"tag":307,"props":5524,"children":5525},{"style":465},[5526],{"type":46,"value":489},{"type":40,"tag":307,"props":5528,"children":5529},{"style":492},[5530],{"type":46,"value":5531}," path",{"type":40,"tag":307,"props":5533,"children":5534},{"style":465},[5535],{"type":46,"value":130},{"type":40,"tag":307,"props":5537,"children":5538},{"style":459},[5539],{"type":46,"value":1436},{"type":40,"tag":307,"props":5541,"children":5542},{"style":465},[5543],{"type":46,"value":509},{"type":40,"tag":307,"props":5545,"children":5546},{"style":476},[5547],{"type":46,"value":1702},{"type":40,"tag":307,"props":5549,"children":5550},{"style":459},[5551],{"type":46,"value":1707},{"type":40,"tag":307,"props":5553,"children":5554},{"style":465},[5555],{"type":46,"value":528},{"type":40,"tag":307,"props":5557,"children":5558},{"style":459},[5559],{"type":46,"value":533},{"type":40,"tag":307,"props":5561,"children":5562},{"style":465},[5563],{"type":46,"value":619},{"type":40,"tag":307,"props":5565,"children":5566},{"class":309,"line":622},[5567,5572,5576,5582,5586],{"type":40,"tag":307,"props":5568,"children":5569},{"style":492},[5570],{"type":46,"value":5571},"  requireApproval",{"type":40,"tag":307,"props":5573,"children":5574},{"style":465},[5575],{"type":46,"value":130},{"type":40,"tag":307,"props":5577,"children":5579},{"style":5578},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[5580],{"type":46,"value":5581}," true",{"type":40,"tag":307,"props":5583,"children":5584},{"style":465},[5585],{"type":46,"value":939},{"type":40,"tag":307,"props":5587,"children":5588},{"style":907},[5589],{"type":46,"value":5590}," \u002F\u002F or a function: (toolCall, context) => boolean\n",{"type":40,"tag":307,"props":5592,"children":5593},{"class":309,"line":652},[5594,5598,5602,5606,5610,5614,5618,5622,5626,5631],{"type":40,"tag":307,"props":5595,"children":5596},{"style":476},[5597],{"type":46,"value":1813},{"type":40,"tag":307,"props":5599,"children":5600},{"style":465},[5601],{"type":46,"value":130},{"type":40,"tag":307,"props":5603,"children":5604},{"style":453},[5605],{"type":46,"value":1822},{"type":40,"tag":307,"props":5607,"children":5608},{"style":465},[5609],{"type":46,"value":1827},{"type":40,"tag":307,"props":5611,"children":5612},{"style":1830},[5613],{"type":46,"value":5531},{"type":40,"tag":307,"props":5615,"children":5616},{"style":465},[5617],{"type":46,"value":1837},{"type":40,"tag":307,"props":5619,"children":5620},{"style":453},[5621],{"type":46,"value":1842},{"type":40,"tag":307,"props":5623,"children":5624},{"style":465},[5625],{"type":46,"value":862},{"type":40,"tag":307,"props":5627,"children":5628},{"style":907},[5629],{"type":46,"value":5630}," \u002F* ... *\u002F",{"type":40,"tag":307,"props":5632,"children":5633},{"style":465},[5634],{"type":46,"value":4894},{"type":40,"tag":307,"props":5636,"children":5637},{"class":309,"line":668},[5638,5642,5646],{"type":40,"tag":307,"props":5639,"children":5640},{"style":465},[5641],{"type":46,"value":528},{"type":40,"tag":307,"props":5643,"children":5644},{"style":459},[5645],{"type":46,"value":533},{"type":40,"tag":307,"props":5647,"children":5648},{"style":465},[5649],{"type":46,"value":538},{"type":40,"tag":289,"props":5651,"children":5653},{"id":5652},"turn-lifecycle-callbacks",[5654],{"type":46,"value":5655},"Turn Lifecycle Callbacks",{"type":40,"tag":296,"props":5657,"children":5659},{"className":442,"code":5658,"language":15,"meta":301,"style":301},"const result = client.callModel({\n  model: 'openai\u002Fgpt-5-nano',\n  input: 'Complex task',\n  tools: [myTool],\n  onTurnStart: async (context) => {\n    console.log(`Starting turn ${context.numberOfTurns}`);\n  },\n  onTurnEnd: async (context, response) => {\n    console.log(`Turn ${context.numberOfTurns} complete`);\n  },\n});\n",[5660],{"type":40,"tag":55,"props":5661,"children":5662},{"__ignoreMap":301},[5663,5698,5725,5753,5772,5809,5871,5878,5923,5988,5995],{"type":40,"tag":307,"props":5664,"children":5665},{"class":309,"line":310},[5666,5670,5674,5678,5682,5686,5690,5694],{"type":40,"tag":307,"props":5667,"children":5668},{"style":453},[5669],{"type":46,"value":456},{"type":40,"tag":307,"props":5671,"children":5672},{"style":459},[5673],{"type":46,"value":560},{"type":40,"tag":307,"props":5675,"children":5676},{"style":465},[5677],{"type":46,"value":468},{"type":40,"tag":307,"props":5679,"children":5680},{"style":459},[5681],{"type":46,"value":569},{"type":40,"tag":307,"props":5683,"children":5684},{"style":465},[5685],{"type":46,"value":509},{"type":40,"tag":307,"props":5687,"children":5688},{"style":476},[5689],{"type":46,"value":60},{"type":40,"tag":307,"props":5691,"children":5692},{"style":459},[5693],{"type":46,"value":484},{"type":40,"tag":307,"props":5695,"children":5696},{"style":465},[5697],{"type":46,"value":586},{"type":40,"tag":307,"props":5699,"children":5700},{"class":309,"line":366},[5701,5705,5709,5713,5717,5721],{"type":40,"tag":307,"props":5702,"children":5703},{"style":492},[5704],{"type":46,"value":595},{"type":40,"tag":307,"props":5706,"children":5707},{"style":465},[5708],{"type":46,"value":130},{"type":40,"tag":307,"props":5710,"children":5711},{"style":465},[5712],{"type":46,"value":604},{"type":40,"tag":307,"props":5714,"children":5715},{"style":320},[5716],{"type":46,"value":609},{"type":40,"tag":307,"props":5718,"children":5719},{"style":465},[5720],{"type":46,"value":614},{"type":40,"tag":307,"props":5722,"children":5723},{"style":465},[5724],{"type":46,"value":619},{"type":40,"tag":307,"props":5726,"children":5727},{"class":309,"line":550},[5728,5732,5736,5740,5745,5749],{"type":40,"tag":307,"props":5729,"children":5730},{"style":492},[5731],{"type":46,"value":628},{"type":40,"tag":307,"props":5733,"children":5734},{"style":465},[5735],{"type":46,"value":130},{"type":40,"tag":307,"props":5737,"children":5738},{"style":465},[5739],{"type":46,"value":604},{"type":40,"tag":307,"props":5741,"children":5742},{"style":320},[5743],{"type":46,"value":5744},"Complex task",{"type":40,"tag":307,"props":5746,"children":5747},{"style":465},[5748],{"type":46,"value":614},{"type":40,"tag":307,"props":5750,"children":5751},{"style":465},[5752],{"type":46,"value":619},{"type":40,"tag":307,"props":5754,"children":5755},{"class":309,"line":589},[5756,5760,5764,5768],{"type":40,"tag":307,"props":5757,"children":5758},{"style":492},[5759],{"type":46,"value":2315},{"type":40,"tag":307,"props":5761,"children":5762},{"style":465},[5763],{"type":46,"value":130},{"type":40,"tag":307,"props":5765,"children":5766},{"style":459},[5767],{"type":46,"value":4348},{"type":40,"tag":307,"props":5769,"children":5770},{"style":465},[5771],{"type":46,"value":619},{"type":40,"tag":307,"props":5773,"children":5774},{"class":309,"line":622},[5775,5780,5784,5788,5792,5797,5801,5805],{"type":40,"tag":307,"props":5776,"children":5777},{"style":476},[5778],{"type":46,"value":5779},"  onTurnStart",{"type":40,"tag":307,"props":5781,"children":5782},{"style":465},[5783],{"type":46,"value":130},{"type":40,"tag":307,"props":5785,"children":5786},{"style":453},[5787],{"type":46,"value":1822},{"type":40,"tag":307,"props":5789,"children":5790},{"style":465},[5791],{"type":46,"value":2139},{"type":40,"tag":307,"props":5793,"children":5794},{"style":1830},[5795],{"type":46,"value":5796},"context",{"type":40,"tag":307,"props":5798,"children":5799},{"style":465},[5800],{"type":46,"value":533},{"type":40,"tag":307,"props":5802,"children":5803},{"style":453},[5804],{"type":46,"value":1842},{"type":40,"tag":307,"props":5806,"children":5807},{"style":465},[5808],{"type":46,"value":1847},{"type":40,"tag":307,"props":5810,"children":5811},{"class":309,"line":652},[5812,5817,5821,5826,5830,5835,5840,5845,5849,5853,5858,5863,5867],{"type":40,"tag":307,"props":5813,"children":5814},{"style":459},[5815],{"type":46,"value":5816},"    console",{"type":40,"tag":307,"props":5818,"children":5819},{"style":465},[5820],{"type":46,"value":509},{"type":40,"tag":307,"props":5822,"children":5823},{"style":476},[5824],{"type":46,"value":5825},"log",{"type":40,"tag":307,"props":5827,"children":5828},{"style":492},[5829],{"type":46,"value":484},{"type":40,"tag":307,"props":5831,"children":5832},{"style":465},[5833],{"type":46,"value":5834},"`",{"type":40,"tag":307,"props":5836,"children":5837},{"style":320},[5838],{"type":46,"value":5839},"Starting turn ",{"type":40,"tag":307,"props":5841,"children":5842},{"style":465},[5843],{"type":46,"value":5844},"${",{"type":40,"tag":307,"props":5846,"children":5847},{"style":459},[5848],{"type":46,"value":5796},{"type":40,"tag":307,"props":5850,"children":5851},{"style":465},[5852],{"type":46,"value":509},{"type":40,"tag":307,"props":5854,"children":5855},{"style":459},[5856],{"type":46,"value":5857},"numberOfTurns",{"type":40,"tag":307,"props":5859,"children":5860},{"style":465},[5861],{"type":46,"value":5862},"}`",{"type":40,"tag":307,"props":5864,"children":5865},{"style":492},[5866],{"type":46,"value":533},{"type":40,"tag":307,"props":5868,"children":5869},{"style":465},[5870],{"type":46,"value":538},{"type":40,"tag":307,"props":5872,"children":5873},{"class":309,"line":668},[5874],{"type":40,"tag":307,"props":5875,"children":5876},{"style":465},[5877],{"type":46,"value":1922},{"type":40,"tag":307,"props":5879,"children":5880},{"class":309,"line":676},[5881,5886,5890,5894,5898,5902,5906,5911,5915,5919],{"type":40,"tag":307,"props":5882,"children":5883},{"style":476},[5884],{"type":46,"value":5885},"  onTurnEnd",{"type":40,"tag":307,"props":5887,"children":5888},{"style":465},[5889],{"type":46,"value":130},{"type":40,"tag":307,"props":5891,"children":5892},{"style":453},[5893],{"type":46,"value":1822},{"type":40,"tag":307,"props":5895,"children":5896},{"style":465},[5897],{"type":46,"value":2139},{"type":40,"tag":307,"props":5899,"children":5900},{"style":1830},[5901],{"type":46,"value":5796},{"type":40,"tag":307,"props":5903,"children":5904},{"style":465},[5905],{"type":46,"value":939},{"type":40,"tag":307,"props":5907,"children":5908},{"style":1830},[5909],{"type":46,"value":5910}," response",{"type":40,"tag":307,"props":5912,"children":5913},{"style":465},[5914],{"type":46,"value":533},{"type":40,"tag":307,"props":5916,"children":5917},{"style":453},[5918],{"type":46,"value":1842},{"type":40,"tag":307,"props":5920,"children":5921},{"style":465},[5922],{"type":46,"value":1847},{"type":40,"tag":307,"props":5924,"children":5925},{"class":309,"line":1589},[5926,5930,5934,5938,5942,5946,5951,5955,5959,5963,5967,5971,5976,5980,5984],{"type":40,"tag":307,"props":5927,"children":5928},{"style":459},[5929],{"type":46,"value":5816},{"type":40,"tag":307,"props":5931,"children":5932},{"style":465},[5933],{"type":46,"value":509},{"type":40,"tag":307,"props":5935,"children":5936},{"style":476},[5937],{"type":46,"value":5825},{"type":40,"tag":307,"props":5939,"children":5940},{"style":492},[5941],{"type":46,"value":484},{"type":40,"tag":307,"props":5943,"children":5944},{"style":465},[5945],{"type":46,"value":5834},{"type":40,"tag":307,"props":5947,"children":5948},{"style":320},[5949],{"type":46,"value":5950},"Turn ",{"type":40,"tag":307,"props":5952,"children":5953},{"style":465},[5954],{"type":46,"value":5844},{"type":40,"tag":307,"props":5956,"children":5957},{"style":459},[5958],{"type":46,"value":5796},{"type":40,"tag":307,"props":5960,"children":5961},{"style":465},[5962],{"type":46,"value":509},{"type":40,"tag":307,"props":5964,"children":5965},{"style":459},[5966],{"type":46,"value":5857},{"type":40,"tag":307,"props":5968,"children":5969},{"style":465},[5970],{"type":46,"value":528},{"type":40,"tag":307,"props":5972,"children":5973},{"style":320},[5974],{"type":46,"value":5975}," complete",{"type":40,"tag":307,"props":5977,"children":5978},{"style":465},[5979],{"type":46,"value":5834},{"type":40,"tag":307,"props":5981,"children":5982},{"style":492},[5983],{"type":46,"value":533},{"type":40,"tag":307,"props":5985,"children":5986},{"style":465},[5987],{"type":46,"value":538},{"type":40,"tag":307,"props":5989,"children":5990},{"class":309,"line":1619},[5991],{"type":40,"tag":307,"props":5992,"children":5993},{"style":465},[5994],{"type":46,"value":1922},{"type":40,"tag":307,"props":5996,"children":5997},{"class":309,"line":1649},[5998,6002,6006],{"type":40,"tag":307,"props":5999,"children":6000},{"style":465},[6001],{"type":46,"value":528},{"type":40,"tag":307,"props":6003,"children":6004},{"style":459},[6005],{"type":46,"value":533},{"type":40,"tag":307,"props":6007,"children":6008},{"style":465},[6009],{"type":46,"value":538},{"type":40,"tag":109,"props":6011,"children":6012},{},[],{"type":40,"tag":113,"props":6014,"children":6016},{"id":6015},"all-subpath-exports",[6017],{"type":46,"value":6018},"All Subpath Exports",{"type":40,"tag":49,"props":6020,"children":6021},{},[6022,6027],{"type":40,"tag":55,"props":6023,"children":6025},{"className":6024},[],[6026],{"type":46,"value":84},{"type":46,"value":6028}," provides granular subpath imports:",{"type":40,"tag":736,"props":6030,"children":6031},{},[6032,6048],{"type":40,"tag":740,"props":6033,"children":6034},{},[6035],{"type":40,"tag":744,"props":6036,"children":6037},{},[6038,6043],{"type":40,"tag":748,"props":6039,"children":6040},{},[6041],{"type":46,"value":6042},"Subpath",{"type":40,"tag":748,"props":6044,"children":6045},{},[6046],{"type":46,"value":6047},"Exports",{"type":40,"tag":759,"props":6049,"children":6050},{},[6051,6067,6089,6110,6130,6170,6213,6235,6269,6295,6321,6356,6379,6407,6435,6456],{"type":40,"tag":744,"props":6052,"children":6053},{},[6054,6062],{"type":40,"tag":766,"props":6055,"children":6056},{},[6057],{"type":40,"tag":55,"props":6058,"children":6060},{"className":6059},[],[6061],{"type":46,"value":84},{"type":40,"tag":766,"props":6063,"children":6064},{},[6065],{"type":46,"value":6066},"Barrel: all exports below",{"type":40,"tag":744,"props":6068,"children":6069},{},[6070,6079],{"type":40,"tag":766,"props":6071,"children":6072},{},[6073],{"type":40,"tag":55,"props":6074,"children":6076},{"className":6075},[],[6077],{"type":46,"value":6078},"@openrouter\u002Fagent\u002Fclient",{"type":40,"tag":766,"props":6080,"children":6081},{},[6082,6087],{"type":40,"tag":55,"props":6083,"children":6085},{"className":6084},[],[6086],{"type":46,"value":9},{"type":46,"value":6088}," class",{"type":40,"tag":744,"props":6090,"children":6091},{},[6092,6100],{"type":40,"tag":766,"props":6093,"children":6094},{},[6095],{"type":40,"tag":55,"props":6096,"children":6098},{"className":6097},[],[6099],{"type":46,"value":886},{"type":40,"tag":766,"props":6101,"children":6102},{},[6103,6108],{"type":40,"tag":55,"props":6104,"children":6106},{"className":6105},[],[6107],{"type":46,"value":60},{"type":46,"value":6109}," standalone function",{"type":40,"tag":744,"props":6111,"children":6112},{},[6113,6121],{"type":40,"tag":766,"props":6114,"children":6115},{},[6116],{"type":40,"tag":55,"props":6117,"children":6119},{"className":6118},[],[6120],{"type":46,"value":2553},{"type":40,"tag":766,"props":6122,"children":6123},{},[6124,6129],{"type":40,"tag":55,"props":6125,"children":6127},{"className":6126},[],[6128],{"type":46,"value":68},{"type":46,"value":161},{"type":40,"tag":744,"props":6131,"children":6132},{},[6133,6142],{"type":40,"tag":766,"props":6134,"children":6135},{},[6136],{"type":40,"tag":55,"props":6137,"children":6139},{"className":6138},[],[6140],{"type":46,"value":6141},"@openrouter\u002Fagent\u002Ftool-types",{"type":40,"tag":766,"props":6143,"children":6144},{},[6145,6150,6151,6156,6157,6162,6163,6168],{"type":40,"tag":55,"props":6146,"children":6148},{"className":6147},[],[6149],{"type":46,"value":243},{"type":46,"value":62},{"type":40,"tag":55,"props":6152,"children":6154},{"className":6153},[],[6155],{"type":46,"value":250},{"type":46,"value":62},{"type":40,"tag":55,"props":6158,"children":6160},{"className":6159},[],[6161],{"type":46,"value":257},{"type":46,"value":62},{"type":40,"tag":55,"props":6164,"children":6166},{"className":6165},[],[6167],{"type":46,"value":264},{"type":46,"value":6169},", type guards",{"type":40,"tag":744,"props":6171,"children":6172},{},[6173,6181],{"type":40,"tag":766,"props":6174,"children":6175},{},[6176],{"type":40,"tag":55,"props":6177,"children":6179},{"className":6178},[],[6180],{"type":46,"value":2601},{"type":40,"tag":766,"props":6182,"children":6183},{},[6184,6189,6190,6195,6196,6201,6202,6207,6208],{"type":40,"tag":55,"props":6185,"children":6187},{"className":6186},[],[6188],{"type":46,"value":172},{"type":46,"value":62},{"type":40,"tag":55,"props":6191,"children":6193},{"className":6192},[],[6194],{"type":46,"value":179},{"type":46,"value":62},{"type":40,"tag":55,"props":6197,"children":6199},{"className":6198},[],[6200],{"type":46,"value":186},{"type":46,"value":62},{"type":40,"tag":55,"props":6203,"children":6205},{"className":6204},[],[6206],{"type":46,"value":193},{"type":46,"value":62},{"type":40,"tag":55,"props":6209,"children":6211},{"className":6210},[],[6212],{"type":46,"value":200},{"type":40,"tag":744,"props":6214,"children":6215},{},[6216,6225],{"type":40,"tag":766,"props":6217,"children":6218},{},[6219],{"type":40,"tag":55,"props":6220,"children":6222},{"className":6221},[],[6223],{"type":46,"value":6224},"@openrouter\u002Fagent\u002Fmodel-result",{"type":40,"tag":766,"props":6226,"children":6227},{},[6228,6233],{"type":40,"tag":55,"props":6229,"children":6231},{"className":6230},[],[6232],{"type":46,"value":278},{"type":46,"value":6234}," response wrapper",{"type":40,"tag":744,"props":6236,"children":6237},{},[6238,6247],{"type":40,"tag":766,"props":6239,"children":6240},{},[6241],{"type":40,"tag":55,"props":6242,"children":6244},{"className":6243},[],[6245],{"type":46,"value":6246},"@openrouter\u002Fagent\u002Fasync-params",{"type":40,"tag":766,"props":6248,"children":6249},{},[6250,6255,6256,6262,6263],{"type":40,"tag":55,"props":6251,"children":6253},{"className":6252},[],[6254],{"type":46,"value":271},{"type":46,"value":62},{"type":40,"tag":55,"props":6257,"children":6259},{"className":6258},[],[6260],{"type":46,"value":6261},"hasAsyncFunctions",{"type":46,"value":62},{"type":40,"tag":55,"props":6264,"children":6266},{"className":6265},[],[6267],{"type":46,"value":6268},"resolveAsyncFunctions",{"type":40,"tag":744,"props":6270,"children":6271},{},[6272,6281],{"type":40,"tag":766,"props":6273,"children":6274},{},[6275],{"type":40,"tag":55,"props":6276,"children":6278},{"className":6277},[],[6279],{"type":46,"value":6280},"@openrouter\u002Fagent\u002Fanthropic-compat",{"type":40,"tag":766,"props":6282,"children":6283},{},[6284,6289,6290],{"type":40,"tag":55,"props":6285,"children":6287},{"className":6286},[],[6288],{"type":46,"value":211},{"type":46,"value":62},{"type":40,"tag":55,"props":6291,"children":6293},{"className":6292},[],[6294],{"type":46,"value":218},{"type":40,"tag":744,"props":6296,"children":6297},{},[6298,6307],{"type":40,"tag":766,"props":6299,"children":6300},{},[6301],{"type":40,"tag":55,"props":6302,"children":6304},{"className":6303},[],[6305],{"type":46,"value":6306},"@openrouter\u002Fagent\u002Fchat-compat",{"type":40,"tag":766,"props":6308,"children":6309},{},[6310,6315,6316],{"type":40,"tag":55,"props":6311,"children":6313},{"className":6312},[],[6314],{"type":46,"value":225},{"type":46,"value":62},{"type":40,"tag":55,"props":6317,"children":6319},{"className":6318},[],[6320],{"type":46,"value":232},{"type":40,"tag":744,"props":6322,"children":6323},{},[6324,6333],{"type":40,"tag":766,"props":6325,"children":6326},{},[6327],{"type":40,"tag":55,"props":6328,"children":6330},{"className":6329},[],[6331],{"type":46,"value":6332},"@openrouter\u002Fagent\u002Fconversation-state",{"type":40,"tag":766,"props":6334,"children":6335},{},[6336,6342,6343,6349,6350],{"type":40,"tag":55,"props":6337,"children":6339},{"className":6338},[],[6340],{"type":46,"value":6341},"createInitialState",{"type":46,"value":62},{"type":40,"tag":55,"props":6344,"children":6346},{"className":6345},[],[6347],{"type":46,"value":6348},"updateState",{"type":46,"value":62},{"type":40,"tag":55,"props":6351,"children":6353},{"className":6352},[],[6354],{"type":46,"value":6355},"appendToMessages",{"type":40,"tag":744,"props":6357,"children":6358},{},[6359,6368],{"type":40,"tag":766,"props":6360,"children":6361},{},[6362],{"type":40,"tag":55,"props":6363,"children":6365},{"className":6364},[],[6366],{"type":46,"value":6367},"@openrouter\u002Fagent\u002Fnext-turn-params",{"type":40,"tag":766,"props":6369,"children":6370},{},[6371,6377],{"type":40,"tag":55,"props":6372,"children":6374},{"className":6373},[],[6375],{"type":46,"value":6376},"nextTurnParams",{"type":46,"value":6378}," utilities",{"type":40,"tag":744,"props":6380,"children":6381},{},[6382,6391],{"type":40,"tag":766,"props":6383,"children":6384},{},[6385],{"type":40,"tag":55,"props":6386,"children":6388},{"className":6387},[],[6389],{"type":46,"value":6390},"@openrouter\u002Fagent\u002Fstream-transformers",{"type":40,"tag":766,"props":6392,"children":6393},{},[6394,6400,6401],{"type":40,"tag":55,"props":6395,"children":6397},{"className":6396},[],[6398],{"type":46,"value":6399},"extractUnsupportedContent",{"type":46,"value":62},{"type":40,"tag":55,"props":6402,"children":6404},{"className":6403},[],[6405],{"type":46,"value":6406},"getUnsupportedContentSummary",{"type":40,"tag":744,"props":6408,"children":6409},{},[6410,6419],{"type":40,"tag":766,"props":6411,"children":6412},{},[6413],{"type":40,"tag":55,"props":6414,"children":6416},{"className":6415},[],[6417],{"type":46,"value":6418},"@openrouter\u002Fagent\u002Ftool-context",{"type":40,"tag":766,"props":6420,"children":6421},{},[6422,6428,6429],{"type":40,"tag":55,"props":6423,"children":6425},{"className":6424},[],[6426],{"type":46,"value":6427},"buildToolExecuteContext",{"type":46,"value":62},{"type":40,"tag":55,"props":6430,"children":6432},{"className":6431},[],[6433],{"type":46,"value":6434},"ToolContextStore",{"type":40,"tag":744,"props":6436,"children":6437},{},[6438,6447],{"type":40,"tag":766,"props":6439,"children":6440},{},[6441],{"type":40,"tag":55,"props":6442,"children":6444},{"className":6443},[],[6445],{"type":46,"value":6446},"@openrouter\u002Fagent\u002Ftool-event-broadcaster",{"type":40,"tag":766,"props":6448,"children":6449},{},[6450],{"type":40,"tag":55,"props":6451,"children":6453},{"className":6452},[],[6454],{"type":46,"value":6455},"ToolEventBroadcaster",{"type":40,"tag":744,"props":6457,"children":6458},{},[6459,6468],{"type":40,"tag":766,"props":6460,"children":6461},{},[6462],{"type":40,"tag":55,"props":6463,"children":6465},{"className":6464},[],[6466],{"type":46,"value":6467},"@openrouter\u002Fagent\u002Fturn-context",{"type":40,"tag":766,"props":6469,"children":6470},{},[6471],{"type":40,"tag":55,"props":6472,"children":6474},{"className":6473},[],[6475],{"type":46,"value":6476},"buildTurnContext",{"type":40,"tag":6478,"props":6479,"children":6480},"style",{},[6481],{"type":46,"value":6482},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":6484,"total":1941},[6485,6500,6510,6526,6532,6543,6552,6564,6576,6585,6596,6605],{"slug":6486,"name":6486,"fn":6487,"description":6488,"org":6489,"tags":6490,"stars":23,"repoUrl":24,"updatedAt":6499},"create-agent-tui","scaffold terminal agents with OpenRouter","Scaffolds a complete agent TUI in TypeScript using @openrouter\u002Fagent — like create-react-app for terminal agents. Generates a customizable terminal interface with three input styles, four tool display modes, ASCII banners, streaming output, session persistence, and configurable tools. Use when building an agent, creating a TUI, scaffolding an agent project, or building a coding assistant.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6491,6494,6497,6498],{"name":6492,"slug":6493,"type":16},"Agents","agents",{"name":6495,"slug":6496,"type":16},"CLI","cli",{"name":9,"slug":8,"type":16},{"name":14,"slug":15,"type":16},"2026-07-14T05:38:18.849741",{"slug":6501,"name":6501,"fn":6502,"description":6503,"org":6504,"tags":6505,"stars":23,"repoUrl":24,"updatedAt":6509},"create-headless-agent","scaffold headless agents with OpenRouter","Scaffolds a headless agent in TypeScript using @openrouter\u002Fagent and Bun — for CLI tools, API servers, queue workers, and pipelines. No terminal UI. Use when building a headless agent, programmatic agent, CLI tool that uses AI, batch agent, pipeline agent, API agent, agent without a UI, or agent service.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6506,6507,6508],{"name":6492,"slug":6493,"type":16},{"name":6495,"slug":6496,"type":16},{"name":14,"slug":15,"type":16},"2026-07-14T05:38:30.178029",{"slug":6511,"name":6511,"fn":6512,"description":6513,"org":6514,"tags":6515,"stars":23,"repoUrl":24,"updatedAt":6525},"open-responses","implement Open Responses-compliant APIs","This skill should be used when implementing, consuming, or debugging an Open Responses-compliant API — the open standard for multi-provider LLM interoperability. Covers protocol, items, state machines, streaming events, tools, the agentic loop pattern, and extensions. Triggers on: Open Responses, open-responses, \u002Fv1\u002Fresponses endpoint, multi-provider LLM API, Open Responses compliance.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6516,6519,6522],{"name":6517,"slug":6518,"type":16},"API Development","api-development",{"name":6520,"slug":6521,"type":16},"Interoperability","interoperability",{"name":6523,"slug":6524,"type":16},"LLM","llm","2026-07-14T05:38:13.153467",{"slug":4,"name":4,"fn":5,"description":6,"org":6527,"tags":6528,"stars":23,"repoUrl":24,"updatedAt":25},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6529,6530,6531],{"name":18,"slug":19,"type":16},{"name":21,"slug":22,"type":16},{"name":14,"slug":15,"type":16},{"slug":6533,"name":6533,"fn":6534,"description":6535,"org":6536,"tags":6537,"stars":23,"repoUrl":24,"updatedAt":6542},"openrouter-analytics","analyze OpenRouter usage and spend","Answer natural-language questions about a user's OpenRouter usage data — spend, request volume, model breakdown, latency, token usage, and cost optimization. Use when the user asks about their API usage, billing, costs, top models, traffic patterns, or wants to optimize their OpenRouter spend.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6538,6541],{"name":6539,"slug":6540,"type":16},"Analytics","analytics",{"name":9,"slug":8,"type":16},"2026-07-30T05:30:15.098344",{"slug":6544,"name":6544,"fn":6545,"description":6546,"org":6547,"tags":6548,"stars":23,"repoUrl":24,"updatedAt":6551},"openrouter-analytics-query","execute analytics queries against OpenRouter","Construct and execute analytics queries against the OpenRouter API — full parameter reference for metrics, dimensions, filters, time ranges, ordering, and pagination. Use when building or debugging an analytics query, understanding the request\u002Fresponse shape, or handling query errors.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6549,6550],{"name":6539,"slug":6540,"type":16},{"name":6517,"slug":6518,"type":16},"2026-07-14T05:38:26.402047",{"slug":6553,"name":6553,"fn":6554,"description":6555,"org":6556,"tags":6557,"stars":23,"repoUrl":24,"updatedAt":6563},"openrouter-analytics-schema","query OpenRouter analytics schema","Discover the OpenRouter analytics schema — available metrics, dimensions, filter operators, and granularities. Use when you need to know what analytics data is queryable, what dimensions you can break down by, or how to map a user's question to the right metric\u002Fdimension combination.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6558,6559,6560],{"name":6539,"slug":6540,"type":16},{"name":6523,"slug":6524,"type":16},{"name":6561,"slug":6562,"type":16},"Reporting","reporting","2026-07-14T05:38:32.721796",{"slug":6565,"name":6565,"fn":6566,"description":6567,"org":6568,"tags":6569,"stars":23,"repoUrl":24,"updatedAt":6575},"openrouter-benchmarks","query OpenRouter model benchmarks","Query OpenRouter's Benchmarks API for model benchmark rankings and scores. Use when the user asks for benchmark-backed model selection, model rankings by coding\u002Fintelligence\u002Fagentic ability, Artificial Analysis or Design Arena ELO\u002Fwin-rate results, benchmark citations, or wants to call GET \u002Fapi\u002Fv1\u002Fbenchmarks. Also use alongside openrouter-models when the user asks what model should power an app, product, workflow, or use case and benchmark evidence could inform or rule out part of the recommendation, including creative writing, editing, coding, design, agentic, or intelligence-heavy apps. Do not use for OpenRouter usage analytics, billing\u002Fspend analysis, generation metadata, provider uptime\u002Flatency, generic model pricing\u002Fcapability lookup without any selection or benchmark-relevance decision, or creating an evaluation suite for a local app.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6570,6571,6574],{"name":6539,"slug":6540,"type":16},{"name":6572,"slug":6573,"type":16},"Benchmarking","benchmarking",{"name":6523,"slug":6524,"type":16},"2026-07-14T05:38:27.658475",{"slug":6577,"name":6577,"fn":6578,"description":6579,"org":6580,"tags":6581,"stars":23,"repoUrl":24,"updatedAt":6584},"openrouter-generations","retrieve metadata for OpenRouter generations","Retrieve detailed metadata and stored content for individual OpenRouter generations. Use when the user wants to inspect a specific request — its cost, latency, token usage, provider routing, or the actual prompt\u002Fcompletion text — or is debugging a failed or unexpected generation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6582,6583],{"name":6523,"slug":6524,"type":16},{"name":9,"slug":8,"type":16},"2026-07-14T05:38:25.132801",{"slug":6586,"name":6586,"fn":6587,"description":6588,"org":6589,"tags":6590,"stars":23,"repoUrl":24,"updatedAt":6595},"openrouter-images","generate images with OpenRouter","Generate images from text prompts and edit existing images using OpenRouter's dedicated Image API. Use when the user asks to create, generate, or make an image, picture, or illustration from a description, or wants to edit, modify, transform, or alter an existing image with a text prompt.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6591,6594],{"name":6592,"slug":6593,"type":16},"Image Generation","image-generation",{"name":9,"slug":8,"type":16},"2026-07-14T05:38:21.393411",{"slug":6597,"name":6597,"fn":6598,"description":6599,"org":6600,"tags":6601,"stars":23,"repoUrl":24,"updatedAt":6604},"openrouter-models","query OpenRouter model metadata and pricing","Query OpenRouter for available AI models, pricing, capabilities, throughput, and provider performance. Use when the user asks about available OpenRouter models, model pricing, model context lengths, model capabilities, provider latency or uptime, throughput limits, supported parameters, wants to search\u002Ffilter\u002Fcompare models, or find the fastest provider for a model.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6602,6603],{"name":6523,"slug":6524,"type":16},{"name":9,"slug":8,"type":16},"2026-07-14T05:38:22.650307",{"slug":6606,"name":6606,"fn":6607,"description":6608,"org":6609,"tags":6610,"stars":23,"repoUrl":24,"updatedAt":6618},"openrouter-oauth","implement OpenRouter OAuth authentication","Implement \"Sign In with OpenRouter\" using OAuth PKCE — framework-agnostic, no SDK or client registration required. Use when the user wants to add OpenRouter login, authentication, sign-in buttons, OAuth, or AI model inference API keys for browser-based apps. No client registration, no backend, no secrets required.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6611,6614,6617],{"name":6612,"slug":6613,"type":16},"Auth","auth",{"name":6615,"slug":6616,"type":16},"OAuth","oauth",{"name":9,"slug":8,"type":16},"2026-07-14T05:38:20.116308",{"items":6620,"total":1941},[6621,6628,6634,6640,6646,6651,6656],{"slug":6486,"name":6486,"fn":6487,"description":6488,"org":6622,"tags":6623,"stars":23,"repoUrl":24,"updatedAt":6499},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6624,6625,6626,6627],{"name":6492,"slug":6493,"type":16},{"name":6495,"slug":6496,"type":16},{"name":9,"slug":8,"type":16},{"name":14,"slug":15,"type":16},{"slug":6501,"name":6501,"fn":6502,"description":6503,"org":6629,"tags":6630,"stars":23,"repoUrl":24,"updatedAt":6509},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6631,6632,6633],{"name":6492,"slug":6493,"type":16},{"name":6495,"slug":6496,"type":16},{"name":14,"slug":15,"type":16},{"slug":6511,"name":6511,"fn":6512,"description":6513,"org":6635,"tags":6636,"stars":23,"repoUrl":24,"updatedAt":6525},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6637,6638,6639],{"name":6517,"slug":6518,"type":16},{"name":6520,"slug":6521,"type":16},{"name":6523,"slug":6524,"type":16},{"slug":4,"name":4,"fn":5,"description":6,"org":6641,"tags":6642,"stars":23,"repoUrl":24,"updatedAt":25},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6643,6644,6645],{"name":18,"slug":19,"type":16},{"name":21,"slug":22,"type":16},{"name":14,"slug":15,"type":16},{"slug":6533,"name":6533,"fn":6534,"description":6535,"org":6647,"tags":6648,"stars":23,"repoUrl":24,"updatedAt":6542},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6649,6650],{"name":6539,"slug":6540,"type":16},{"name":9,"slug":8,"type":16},{"slug":6544,"name":6544,"fn":6545,"description":6546,"org":6652,"tags":6653,"stars":23,"repoUrl":24,"updatedAt":6551},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6654,6655],{"name":6539,"slug":6540,"type":16},{"name":6517,"slug":6518,"type":16},{"slug":6553,"name":6553,"fn":6554,"description":6555,"org":6657,"tags":6658,"stars":23,"repoUrl":24,"updatedAt":6563},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[6659,6660,6661],{"name":6539,"slug":6540,"type":16},{"name":6523,"slug":6524,"type":16},{"name":6561,"slug":6562,"type":16}]