> Discover all available pages from the documentation index: https://mastra.zisheng.pro/llms.txt # ![GitHub Models 标志](https://models.dev/logos/github-models.svg)GitHub Models 通过 Mastra 的模型路由器访问 55 个 GitHub Models 模型。系统会自动使用 `GITHUB_TOKEN` 环境变量完成身份验证。 更多信息请参阅[GitHub Models 文档](https://docs.github.com/en/github-models)。 ```bash GITHUB_TOKEN=your-api-token ``` ```typescript import { Agent } from '@mastra/core/agent' const agent = new Agent({ id: 'my-agent', name: 'My Agent', instructions: 'You are a helpful assistant', model: 'github-models/ai21-labs/ai21-jamba-1.5-large', }) // Generate a response const response = await agent.generate('Hello!') // Stream a response const stream = await agent.stream('Tell me a story') for await (const chunk of stream) { console.log(chunk) } ``` > **信息:** Mastra 使用兼容 OpenAI 的 `/chat/completions` endpoint。部分 Provider 特有功能可能不可用,详情请参阅[GitHub Models 文档](https://docs.github.com/en/github-models)。 ## 模型 | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M | | ----------------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- | | `github-models/ai21-labs/ai21-jamba-1.5-large` | 256K | | | | | | — | — | | `github-models/ai21-labs/ai21-jamba-1.5-mini` | 256K | | | | | | — | — | | `github-models/cohere/cohere-command-a` | 128K | | | | | | — | — | | `github-models/cohere/cohere-command-r` | 128K | | | | | | — | — | | `github-models/cohere/cohere-command-r-08-2024` | 128K | | | | | | — | — | | `github-models/cohere/cohere-command-r-plus` | 128K | | | | | | — | — | | `github-models/cohere/cohere-command-r-plus-08-2024` | 128K | | | | | | — | — | | `github-models/core42/jais-30b-chat` | 8K | | | | | | — | — | | `github-models/deepseek/deepseek-r1` | 66K | | | | | | — | — | | `github-models/deepseek/deepseek-r1-0528` | 66K | | | | | | — | — | | `github-models/deepseek/deepseek-v3-0324` | 128K | | | | | | — | — | | `github-models/meta/llama-3.2-11b-vision-instruct` | 128K | | | | | | — | — | | `github-models/meta/llama-3.2-90b-vision-instruct` | 128K | | | | | | — | — | | `github-models/meta/llama-3.3-70b-instruct` | 128K | | | | | | — | — | | `github-models/meta/llama-4-maverick-17b-128e-instruct-fp8` | 128K | | | | | | — | — | | `github-models/meta/llama-4-scout-17b-16e-instruct` | 128K | | | | | | — | — | | `github-models/meta/meta-llama-3-70b-instruct` | 8K | | | | | | — | — | | `github-models/meta/meta-llama-3-8b-instruct` | 8K | | | | | | — | — | | `github-models/meta/meta-llama-3.1-405b-instruct` | 128K | | | | | | — | — | | `github-models/meta/meta-llama-3.1-70b-instruct` | 128K | | | | | | — | — | | `github-models/meta/meta-llama-3.1-8b-instruct` | 128K | | | | | | — | — | | `github-models/microsoft/mai-ds-r1` | 66K | | | | | | — | — | | `github-models/microsoft/phi-3-medium-128k-instruct` | 128K | | | | | | — | — | | `github-models/microsoft/phi-3-medium-4k-instruct` | 4K | | | | | | — | — | | `github-models/microsoft/phi-3-mini-128k-instruct` | 128K | | | | | | — | — | | `github-models/microsoft/phi-3-mini-4k-instruct` | 4K | | | | | | — | — | | `github-models/microsoft/phi-3-small-128k-instruct` | 128K | | | | | | — | — | | `github-models/microsoft/phi-3-small-8k-instruct` | 8K | | | | | | — | — | | `github-models/microsoft/phi-3.5-mini-instruct` | 128K | | | | | | — | — | | `github-models/microsoft/phi-3.5-moe-instruct` | 128K | | | | | | — | — | | `github-models/microsoft/phi-3.5-vision-instruct` | 128K | | | | | | — | — | | `github-models/microsoft/phi-4` | 16K | | | | | | — | — | | `github-models/microsoft/phi-4-mini-instruct` | 128K | | | | | | — | — | | `github-models/microsoft/phi-4-mini-reasoning` | 128K | | | | | | — | — | | `github-models/microsoft/phi-4-multimodal-instruct` | 128K | | | | | | — | — | | `github-models/microsoft/phi-4-reasoning` | 128K | | | | | | — | — | | `github-models/mistral-ai/codestral-2501` | 32K | | | | | | — | — | | `github-models/mistral-ai/ministral-3b` | 128K | | | | | | — | — | | `github-models/mistral-ai/mistral-large-2411` | 128K | | | | | | — | — | | `github-models/mistral-ai/mistral-medium-2505` | 128K | | | | | | — | — | | `github-models/mistral-ai/mistral-nemo` | 128K | | | | | | — | — | | `github-models/mistral-ai/mistral-small-2503` | 128K | | | | | | — | — | | `github-models/openai/gpt-4.1` | 128K | | | | | | — | — | | `github-models/openai/gpt-4.1-mini` | 128K | | | | | | — | — | | `github-models/openai/gpt-4.1-nano` | 128K | | | | | | — | — | | `github-models/openai/gpt-4o` | 128K | | | | | | — | — | | `github-models/openai/gpt-4o-mini` | 128K | | | | | | — | — | | `github-models/openai/o1` | 200K | | | | | | — | — | | `github-models/openai/o1-mini` | 128K | | | | | | — | — | | `github-models/openai/o1-preview` | 128K | | | | | | — | — | | `github-models/openai/o3` | 200K | | | | | | — | — | | `github-models/openai/o3-mini` | 200K | | | | | | — | — | | `github-models/openai/o4-mini` | 200K | | | | | | — | — | | `github-models/xai/grok-3` | 128K | | | | | | — | — | | `github-models/xai/grok-3-mini` | 128K | | | | | | — | — | ## 高级配置 ### 自定义请求头 ```typescript const agent = new Agent({ id: 'custom-agent', name: 'custom-agent', model: { url: 'https://models.github.ai/inference', id: 'github-models/ai21-labs/ai21-jamba-1.5-large', apiKey: process.env.GITHUB_TOKEN, headers: { 'X-Custom-Header': 'value', }, }, }) ``` ### 动态选择模型 ```typescript const agent = new Agent({ id: 'dynamic-agent', name: 'Dynamic Agent', model: ({ requestContext }) => { const useAdvanced = requestContext.task === 'complex' return useAdvanced ? 'github-models/xai/grok-3-mini' : 'github-models/ai21-labs/ai21-jamba-1.5-large' }, }) ```