text stringlengths 0 59.1k |
|---|
``` |
</TabItem> |
<TabItem value="xAI" label="xAI"> |
```ts |
import { Agent } from "@voltagent/core"; |
const agent = new Agent({ |
name: "grok-ideas", |
instructions: "Brainstorm five product names.", |
model: "xai/grok-3-mini", |
}); |
``` |
</TabItem> |
<TabItem value="OpenRouter" label="OpenRouter"> |
```ts |
import { Agent } from "@voltagent/core"; |
const agent = new Agent({ |
name: "openrouter-agent", |
instructions: "Answer in short paragraphs.", |
model: "openrouter/anthropic/claude-3.5-haiku", |
}); |
``` |
</TabItem> |
</Tabs> |
## Provider directory |
Browse provider pages in the left navigation or visit the [Providers directory](/models-docs/providers/overview) for the full list. |
For full model inventories per provider, see each provider page or explore [models.dev](https://models.dev). |
## Type-safe model IDs |
Use `ModelRouterModelId` to get IDE autocomplete for model strings: |
```ts |
import type { ModelRouterModelId } from "@voltagent/core"; |
const modelId: ModelRouterModelId = "openai/gpt-4.1-mini"; |
``` |
## Split workloads across models |
Assign cheaper models to throughput-heavy steps and stronger models to critical analysis: |
```ts |
import { Agent } from "@voltagent/core"; |
const ingestAgent = new Agent({ |
name: "ingest-agent", |
instructions: "Extract entities and key facts from raw notes.", |
model: "google/gemini-2.0-flash", |
}); |
const reviewAgent = new Agent({ |
name: "review-agent", |
instructions: "Review the summary and flag risks or gaps.", |
model: "anthropic/claude-3-5-sonnet", |
}); |
``` |
## Runtime model selection |
Pick a model based on request context: |
```ts |
const agent = new Agent({ |
name: "runtime-router", |
model: ({ context }) => { |
const tier = (context.get("tier") as string) || "fast"; |
return tier === "fast" ? "openai/gpt-4.1-mini" : "anthropic/claude-3-5-sonnet"; |
}, |
}); |
``` |
## Provider options |
Pass provider-specific options per request when you need them: |
```ts |
const analyst = new Agent({ |
name: "analyst", |
instructions: "Explain tradeoffs clearly and concisely.", |
model: "openai/o3-mini", |
}); |
const response = await analyst.generateText("Compare JWTs vs cookies for auth.", { |
providerOptions: { |
openai: { reasoningEffort: "high" }, |
}, |
}); |
``` |
## Custom headers |
If you need custom headers, pass an ai-sdk `LanguageModel` directly: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.