A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
feat(ai): replace GitHub Models with GitHub Copilot (#10750)
Shahmir Varqha10ae5023314a
diff --git a/docs/guides/configuration/llm_providers.md b/docs/guides/configuration/llm_providers.mdindex 1a50c8526c..6a3f953eb9 100644--- a/docs/guides/configuration/llm_providers.md+++ b/docs/guides/configuration/llm_providers.md@@ -59,10 +59,10 @@ Some providers use a default environment variable when `api_key` is not set.| Provider | Environment variable || --- | --- || OpenAI | `OPENAI_API_KEY` |+| GitHub Copilot | `GITHUB_COPILOT_API_KEY` || Anthropic | `ANTHROPIC_API_KEY` || Google AI | `GEMINI_API_KEY`, then `GOOGLE_API_KEY` || Azure OpenAI | `AZURE_API_KEY` |-| GitHub | `GITHUB_TOKEN` || OpenRouter | `OPENROUTER_API_KEY` || Weights & Biases | `WANDB_API_KEY` || OpenCode Go | `OPENCODE_API_KEY` |@@ -111,7 +111,6 @@ You can configure the following providers:* Anthropic* AWS Bedrock-* GitHub* Google AI* DeepSeek* xAI@@ -119,6 +118,7 @@ You can configure the following providers:* Mistral* Ollama* OpenAI+* GitHub Copilot* OpenCode Go* OpenRouter* Weights & Biases@@ -243,7 +243,7 @@ For details and advanced configuration, see the `google-genai` Python client docThere are two offerings for serving LLMs on Azure-**Azure OpenAI**+#### Azure OpenAI```toml title="marimo.toml"[ai.models]@@ -256,9 +256,9 @@ base_url = "https://<your-resource-name>.openai.azure.com/openai/deployments/<deThe deployment name is typically the model name.-**Azure AI Foundry**+#### Microsoft Foundry-AI Foundry uses OpenAI-compatible models. You can configure it as a custom provider:+Microsoft Foundry uses OpenAI-compatible models. You can configure it as a custom provider:```toml title="marimo.toml"[ai.models]@@ -272,33 +272,40 @@ base_url = "https://<your-resource-name>.services.ai.azure.com/openai/v1"### GitHub Copilot-Use Copilot for code refactoring or the chat panel (Copilot subscription required).+You can use models from your Copilot subscription in marimo's AI assistant.**Requirements**-* Install the [gh CLI](https://cli.github.com/)-* Get a token: `gh auth token`+* Install `pydantic-ai-slim[openai]>=2.42.0`.+* Install the [GitHub CLI](https://cli.github.com/).+* Sign in with `gh auth login`.+* Get your OAuth token with `gh auth token`.**Configuration**+The available models depend on your Copilot subscription.++Add an available model to `custom_models`. Use the `github/` prefix.+```toml title="marimo.toml"[ai.models]-chat_model = "github/gpt-4o-mini"+custom_models = ["github/gpt-5.4"]+chat_model = "github/gpt-5.4"[ai.github]-api_key = "gho_..."+api_key = "env:GITHUB_COPILOT_API_KEY"```-??? question "My token starts with `ghp_` instead of `gho_`?"-- This usually happens when you previously authenticated `gh` by pasting a _personal_ access token (`ghp_...`). However, GitHub Copilot is not available through `ghp_...`, and you will encounter errors such as:+Set the token before you start marimo:- > bad request: Personal Access Tokens are not supported for this endpoint-- To resolve this issue, you could switch to an _OAuth_ access token (`gho_...`):+```bash+export GITHUB_COPILOT_API_KEY="$(gh auth token)"+```- 1. Re-authenticate by running `gh auth login`.- 2. Choose _Login with a web browser_ (instead of _Paste an authentication token_) this time.+You can also set `GITHUB_COPILOT_API_TOKEN` or `COPILOT_GITHUB_TOKEN`.+GitHub Copilot supports chat completions only. See the+[Pydantic AI GitHub Copilot guide](https://pydantic.dev/docs/ai/models/github-copilot/)+for authentication details and current limitations.### OpenRouterdiff --git a/docs/guides/editor_features/ai_completion.md b/docs/guides/editor_features/ai_completion.mdindex 887cea31f3..076233d499 100644--- a/docs/guides/editor_features/ai_completion.md+++ b/docs/guides/editor_features/ai_completion.md@@ -153,10 +153,10 @@ your `marimo.toml` configuration file. **Prefer going through the notebook settiYou can configure the following providers:* OpenAI+* GitHub Copilot* Anthropic* AWS Bedrock* Google AI-* GitHub* Ollama* and any OpenAI-compatible providerdiff --git a/frontend/src/components/ai/ai-provider-icon.tsx b/frontend/src/components/ai/ai-provider-icon.tsxindex 00ec3a257b..11629d2a2f 100644--- a/frontend/src/components/ai/ai-provider-icon.tsx+++ b/frontend/src/components/ai/ai-provider-icon.tsx@@ -5,8 +5,8 @@ import BedrockIcon from "@marimo-team/llm-info/icons/aws.svg?inline";import AzureIcon from "@marimo-team/llm-info/icons/azure.svg?inline";import CursorIcon from "@marimo-team/llm-info/icons/cursor.svg?inline";import DeepseekIcon from "@marimo-team/llm-info/icons/deepseek.svg?inline";-import GitHubIcon from "@marimo-team/llm-info/icons/github.svg?inline";import GeminiIcon from "@marimo-team/llm-info/icons/googlegemini.svg?inline";+import GitHubIcon from "@marimo-team/llm-info/icons/github.svg?inline";import OllamaIcon from "@marimo-team/llm-info/icons/ollama.svg?inline";import OpenAIIcon from "@marimo-team/llm-info/icons/openai.svg?inline";import OpencodeIcon from "@marimo-team/llm-info/icons/opencode-logo-light.svg?inline";@@ -21,6 +21,7 @@ import type { ExternalAgentId } from "../chat/acp/state";const icons: Record<ProviderId | ExternalAgentId, string> = {openai: OpenAIIcon,+ github: GitHubIcon,anthropic: AnthropicIcon,claude: AnthropicIcon,gemini: GeminiIcon,@@ -30,7 +31,6 @@ const icons: Record<ProviderId | ExternalAgentId, string> = {azure: AzureIcon,bedrock: BedrockIcon,deepseek: DeepseekIcon,- github: GitHubIcon,openrouter: OpenRouterIcon,wandb: WandbIcon,"opencode-go": OpencodeIcon,diff --git a/frontend/src/components/ai/ai-utils.ts b/frontend/src/components/ai/ai-utils.tsindex 915ab4e333..239d2bb92c 100644--- a/frontend/src/components/ai/ai-utils.ts+++ b/frontend/src/components/ai/ai-utils.ts@@ -15,9 +15,9 @@ type CredentialChecker = (ai: AiConfig | undefined) => boolean;*/const CREDENTIAL_CHECKERS: Record<KnownProviderId, CredentialChecker> = {openai: (ai) => Boolean(ai?.open_ai?.api_key),+ github: (ai) => Boolean(ai?.github?.api_key),anthropic: (ai) => Boolean(ai?.anthropic?.api_key),google: (ai) => Boolean(ai?.google?.api_key),- github: (ai) => Boolean(ai?.github?.api_key),openrouter: (ai) => Boolean(ai?.openrouter?.api_key),azure: (ai) => Boolean(ai?.azure?.api_key && ai?.azure?.base_url),wandb: (ai) => Boolean(ai?.wandb?.api_key),diff --git a/frontend/src/components/app-config/ai-config.tsx b/frontend/src/components/app-config/ai-config.tsxindex e9e9a15469..b4ef69285b 100644--- a/frontend/src/components/app-config/ai-config.tsx+++ b/frontend/src/components/app-config/ai-config.tsx@@ -65,7 +65,6 @@ import {AccordionItem,AccordionTrigger,} from "../ui/accordion";-import { Alert, AlertDescription } from "../ui/alert";import { Button } from "../ui/button";import { Checkbox } from "../ui/checkbox";import { DropdownMenuSeparator } from "../ui/dropdown-menu";@@ -969,6 +968,39 @@ export const AiProvidersConfig: React.FC<AiConfigProps> = ({/></AccordionFormItem>+ <AccordionFormItem+ title="GitHub Copilot"+ provider="github"+ isConfigured={hasValue("ai.github.api_key")}+ >+ <ApiKey+ form={form}+ config={config}+ name="ai.github.api_key"+ placeholder="gho_..."+ testId="ai-github-copilot-api-key-input"+ description={+ <>+ Your GitHub OAuth token. Run{" "}+ <Kbd className="inline">gh auth token</Kbd> after you sign in+ with the GitHub CLI. A GitHub Copilot subscription is required.+ See the{" "}+ <ExternalLink href="https://pydantic.dev/docs/ai/models/github-copilot/">+ authentication guide+ </ExternalLink>+ .+ </>+ }+ />+ <BaseUrl+ form={form}+ config={config}+ name="ai.github.base_url"+ placeholder="https://api.githubcopilot.com"+ testId="ai-github-copilot-base-url-input"+ />+ </AccordionFormItem>+<AccordionFormItemtitle="Anthropic"provider="anthropic"@@ -1029,42 +1061,6 @@ export const AiProvidersConfig: React.FC<AiConfigProps> = ({/></AccordionFormItem>- <AccordionFormItem- title="GitHub"- provider="github"- isConfigured={hasValue("ai.github.api_key")}- >- <Alert variant="warning" className="py-1.5 px-3 text-xs">- <AlertDescription>- Free tier models have low token limits which can cause errors with- larger prompts.{" "}- <ExternalLink href="https://docs.github.com/en/github-models/prototyping-with-ai-models#rate-limits">- Learn more- </ExternalLink>- </AlertDescription>- </Alert>- <ApiKey- form={form}- config={config}- name="ai.github.api_key"- placeholder="gho_..."- testId="ai-github-api-key-input"- description={- <>- Your GitHub API token from{" "}- <Kbd className="inline">gh auth token</Kbd>.- </>- }- />- <BaseUrl- form={form}- config={config}- name="ai.github.base_url"- placeholder="https://models.github.ai/inference"- testId="ai-github-base-url-input"- />- </AccordionFormItem>-<AccordionFormItemtitle="OpenRouter"provider="openrouter"diff --git a/frontend/src/components/app-config/user-config-form.tsx b/frontend/src/components/app-config/user-config-form.tsxindex 2e03a12f36..ea6ee2126e 100644--- a/frontend/src/components/app-config/user-config-form.tsx+++ b/frontend/src/components/app-config/user-config-form.tsx@@ -1304,7 +1304,7 @@ export const UserConfigForm: React.FC = () => {<IsOverridden override={override} /><FormDescription>Enable experimental external agents such as Claude Code and- Gemini CLI. Learn more in the{" "}+ Codex. Learn more in the{" "}<ExternalLink href="https://docs.marimo.io/guides/editor_features/agents/">docs</ExternalLink>diff --git a/frontend/src/components/ui/links.tsx b/frontend/src/components/ui/links.tsxindex b853b41571..1041e7f195 100644--- a/frontend/src/components/ui/links.tsx+++ b/frontend/src/components/ui/links.tsx@@ -16,7 +16,8 @@ export const ExternalLink = ({| `https://links.marimo.app/${string}`| `https://wandb.ai/${string}`| `https://portal.azure.com/${string}`- | `https://opencode.ai/${string}`;+ | `https://opencode.ai/${string}`+ | `https://pydantic.dev/${string}`;children: React.ReactNode;}) => {return (diff --git a/frontend/src/core/ai/ids/__tests__/ids.test.ts b/frontend/src/core/ai/ids/__tests__/ids.test.tsindex 07d57f5084..685d3dfd24 100644--- a/frontend/src/core/ai/ids/__tests__/ids.test.ts+++ b/frontend/src/core/ai/ids/__tests__/ids.test.ts@@ -26,7 +26,6 @@ describe("AiModelId", () => {"google","ollama","bedrock",- "github",];providers.forEach((provider) => {@@ -68,12 +67,6 @@ describe("AiModelId", () => {expect(modelId.shortModelId).toBe("titan-text");});- it("should parse github qualified id", () => {- const modelId = AiModelId.parse("github/gpt-4o");- expect(modelId.providerId).toBe("github");- expect(modelId.shortModelId).toBe("gpt-4o");- });-it("should handle multiple slashes", () => {const modelId = AiModelId.parse("openai/gpt-4/turbo");expect(modelId.providerId).toBe("openai");@@ -178,7 +171,6 @@ describe("AiModelId", () => {"google","ollama","bedrock",- "github",];providers.forEach((provider) => {diff --git a/frontend/src/core/ai/ids/ids.ts b/frontend/src/core/ai/ids/ids.tsindex 82b67f7db6..ce25b70355 100644--- a/frontend/src/core/ai/ids/ids.ts+++ b/frontend/src/core/ai/ids/ids.ts@@ -4,13 +4,13 @@ import type { TypedString } from "@/utils/typed";export const KNOWN_PROVIDERS = ["openai",+ "github","anthropic","google","ollama","bedrock","deepseek","azure",- "github","openrouter","wandb","opencode-go",diff --git a/frontend/src/core/config/config-schema.ts b/frontend/src/core/config/config-schema.tsindex 350cbde940..2c17043a35 100644--- a/frontend/src/core/config/config-schema.ts+++ b/frontend/src/core/config/config-schema.ts@@ -171,6 +171,7 @@ export const UserConfigSchema = zinline_tooltip: z.boolean().prefault(false),allow_provider_config: z.boolean().prefault(true),open_ai: AiConfigSchema.optional(),+ github: AiConfigSchema.optional(),anthropic: AiConfigSchema.optional(),google: AiConfigSchema.optional(),ollama: AiConfigSchema.optional(),diff --git a/marimo/_config/config.py b/marimo/_config/config.pyindex 4aa5d76d0a..a1b6486137 100644--- a/marimo/_config/config.py+++ b/marimo/_config/config.py@@ -323,7 +323,7 @@ class AiConfig(TypedDict, total=False):- `bedrock`: the Bedrock config- `azure`: the Azure config- `ollama`: the Ollama config- - `github`: the GitHub config+ - `github`: the GitHub Copilot config- `openrouter`: the OpenRouter config- `wandb`: the Weights & Biases config- `opencode_go`: the OpenCode Go config@@ -425,18 +425,18 @@ class BedrockConfig(TypedDict, total=False):@dataclassclass GitHubConfig(TypedDict, total=False):- """Configuration options for GitHub.+ """Configuration options for GitHub Copilot.**Keys.**- - `api_key`: the GitHub API token or an `env:` reference- - `base_url`: the base URL for the API+ - `api_key`: a GitHub Copilot token or an `env:` reference+ - `base_url`: the base URL for the GitHub Copilot API- `copilot_settings`: configuration settings for GitHub Copilot LSP.Supports settings like `http` (proxy configuration), `telemetry`,and `github-enterprise` (enterprise URI)."""- api_key: str+ api_key: NotRequired[str]base_url: NotRequired[str]copilot_settings: NotRequired[dict[str, Any]]diff --git a/marimo/_server/ai/config.py b/marimo/_server/ai/config.pyindex 828146e6b2..990f9a550b 100644--- a/marimo/_server/ai/config.py+++ b/marimo/_server/ai/config.py@@ -22,8 +22,6 @@ from marimo._server.ai.tools.tool_manager import get_tool_managerfrom marimo._server.ai.tools.types import ToolDefinitionfrom marimo._utils.http import HTTPStatus-# https://github.com/pydantic/pydantic-ai/blob/8b9ac2bde2355b0d431abea6cf210a36fffe0c43/pydantic_ai_slim/pydantic_ai/providers/github.py#L41C17-L41C51-GITHUB_COPILOT_BASE_URL = "https://models.github.ai/inference"ENV_SECRET_PREFIX = "env:"SecretResolver = Callable[[str], str | None]@@ -143,40 +141,6 @@ class AnyProviderConfig:secret_resolver=secret_resolver,)- @classmethod- def for_github(- cls,- config: AiConfig,- *,- secret_resolver: SecretResolver | None = None,- ) -> AnyProviderConfig:- fallback_key = cls._resolve_secret("GITHUB_TOKEN", secret_resolver)- result = cls._for_openai_like(- config,- "github",- "GitHub",- fallback_key=fallback_key,- # Default base URL for GitHub Copilot, taken from- fallback_base_url=GITHUB_COPILOT_BASE_URL,- require_key=True,- secret_resolver=secret_resolver,- )-- # Add default extra headers for GitHub, but allow user to override- default_headers = {- "editor-version": "vscode/1.95.0",- "Copilot-Integration-Id": "vscode-chat",- }-- # Merge: user headers override defaults- if result.extra_headers:- merged_headers = {**default_headers, **result.extra_headers}- else:- merged_headers = default_headers-- result.extra_headers = merged_headers- return result-@classmethoddef for_openrouter(cls,@@ -236,6 +200,34 @@ class AnyProviderConfig:secret_resolver=secret_resolver,)+ @classmethod+ def for_github(+ cls,+ config: AiConfig,+ *,+ secret_resolver: SecretResolver | None = None,+ ) -> AnyProviderConfig:+ fallback_key = (+ cls._resolve_secret("GITHUB_COPILOT_API_KEY", secret_resolver)+ or cls._resolve_secret("GITHUB_COPILOT_API_TOKEN", secret_resolver)+ or cls._resolve_secret("COPILOT_GITHUB_TOKEN", secret_resolver)+ )+ fallback_base_url = (+ cls._resolve_secret("GITHUB_COPILOT_BASE_URL", secret_resolver)+ or cls._resolve_secret("COPILOT_API_URL", secret_resolver)+ or cls._resolve_secret("GITHUB_COPILOT_API_BASE", secret_resolver)+ or "https://api.githubcopilot.com"+ )+ return cls._for_openai_like(+ config,+ "github",+ "GitHub Copilot",+ fallback_key=fallback_key,+ fallback_base_url=fallback_base_url,+ require_key=True,+ secret_resolver=secret_resolver,+ )+@classmethoddef _for_openai_like(cls,diff --git a/marimo/_server/ai/providers.py b/marimo/_server/ai/providers.pyindex c59447f284..06e06f4fdc 100644--- a/marimo/_server/ai/providers.py+++ b/marimo/_server/ai/providers.py@@ -27,6 +27,7 @@ from marimo._ai._pydantic_ai_utils import (profile_get,)from marimo._dependencies.dependencies import Dependency, DependencyManager+from marimo._dependencies.errors import ManyModulesNotFoundErrorfrom marimo._plugins.ui._impl.chat.chat import (AI_SDK_VERSION,)@@ -872,6 +873,63 @@ def _infer_provider_name_from_base_url(base_url: str | None) -> str | None:return _known_provider_base_urls().get(normalized)+GITHUB_COPILOT_PACKAGE = "pydantic-ai-slim[openai]>=2.42.0"+GITHUB_COPILOT_DEPENDENCY = Dependency(+ "pydantic_ai",+ min_version="2.42.0",+ pkg_name_to_install=GITHUB_COPILOT_PACKAGE,+)+++def _require_github_copilot_dependency() -> None:+ if GITHUB_COPILOT_DEPENDENCY.has_required_version(+ quiet=True+ ) and DependencyManager.openai.has(quiet=True):+ return++ raise ManyModulesNotFoundError(+ [GITHUB_COPILOT_PACKAGE],+ f"GitHub Copilot requires {GITHUB_COPILOT_PACKAGE}.",+ source="server",+ )+++class GitHubCopilotProvider(PydanticProvider["Provider"]):+ """Use Pydantic AI's GitHub Copilot provider and chat model."""++ def __init__(self, model: str, config: AnyProviderConfig):+ _require_github_copilot_dependency()+ super().__init__(model, config, [DependencyManager.openai])++ @override+ def create_provider(self, config: AnyProviderConfig) -> Provider:+ from pydantic_ai.providers.github_copilot import ( # type: ignore[import-not-found]+ GitHubCopilotProvider as PydanticGitHubCopilotProvider,+ )++ return cast(+ "Provider",+ PydanticGitHubCopilotProvider(+ api_key=config.api_key,+ base_url=config.base_url,+ ),+ )++ @override+ def create_model(self) -> Model:+ from pydantic_ai.models.github_copilot import ( # type: ignore[import-not-found]+ GitHubCopilotModel,+ )++ return cast(+ "Model",+ GitHubCopilotModel(+ model_name=self.model,+ provider=self.provider,+ ),+ )++class CustomProvider(OpenAIClientMixin, PydanticProvider["Provider"]):"""Support for custom providers which may or may not be OpenAI-compatible.@@ -1189,5 +1247,7 @@ def get_completion_provider(return OpenAIProvider(model_id.model, config, [DependencyManager.openai])+ elif model_id.provider == "github":+ return GitHubCopilotProvider(model_id.model, config)else:return CustomProvider(model_id, config, [DependencyManager.openai])diff --git a/marimo/_smoke_tests/ai/github_model_check.py b/marimo/_smoke_tests/ai/github_model_check.pydeleted file mode 100644index 4e7ebca41c..0000000000--- a/marimo/_smoke_tests/ai/github_model_check.py+++ /dev/null@@ -1,108 +0,0 @@-# /// script-# dependencies = [-# "marimo",-# "openai==1.99.9",-# ]-# [tool.marimo.runtime]-# auto_instantiate = false-# ///--import marimo--__generated_with = "0.18.0"-app = marimo.App(width="medium")--[email protected](hide_code=True)-def _():- import marimo as mo- import openai- import os- import httpx- return httpx, mo, openai---def _(mo):- # Set up OpenAI API key- api_key = mo.ui.text(- value="", label="GitHub API Key. Use `gh auth token`", full_width=True- )- api_key- return (api_key,)---def _(mo):- with_headers = mo.ui.checkbox(label="With Headers")- with_headers- return (with_headers,)---def _(api_key, httpx, openai, with_headers):- client = openai.Client(- base_url="https://models.github.ai/inference",- api_key=api_key.value,- http_client=httpx.Client(verify=False),- default_headers={- "editor-version": "vscode/1.95.0",- "Copilot-Integration-Id": "vscode-chat",- }- if with_headers.value- else {},- )- models = client.models.list().model_dump()- return client, models---def _(models):- ids = [item["id"] for item in models["data"]]- ids- return (ids,)---def _(mo):- # Button to trigger API call- run_button = mo.ui.run_button(label="Generate Response")- run_button- return (run_button,)---def _(client, ids, run_button):- results = {}- if run_button.value:- for model in ids:- try:- response = client.chat.completions.create(- model=model,- messages=[{"role": "user", "content": "hi"}],- max_tokens=100,- )- msg = (- "✅ Model "- + model- + " passed: "- + response.choices[0].message.content- )- print(msg)- results[model] = msg- except:- msg = "❌ Model " + model + " failed"- print(msg)- results[model] = msg- return (results,)---def _(mo, results):- mo.stop(not results)- mo.ui.table(results, selection=None)- return---if __name__ == "__main__":- app.run()diff --git a/packages/llm-info/data/models.yml b/packages/llm-info/data/models.ymlindex 0ecbf6dc92..58379582a3 100644--- a/packages/llm-info/data/models.yml+++ b/packages/llm-info/data/models.yml@@ -780,107 +780,6 @@ azure:release_date: 2026-04-24cost: {input: 1.74, output: 3.48}-github:- - name: DeepSeek-R1-0528- model: deepseek/deepseek-r1-0528- description: "May 28th update to DeepSeek R1, with performance on par with OpenAI o1 but open-sourced and with fully open reasoning tokens"- roles: [chat, edit]- capabilities: [thinking, tool_calling]- input_types: [text]- output_types: [text]- release_date: 2025-05-28- cost: {input: 0, output: 0}-- - name: Mistral Medium 3 (25.05)- model: mistral-ai/mistral-medium-2505- description: "Enterprise language model designed for strong performance at reduced operational cost"- roles: [chat, edit]- capabilities: [thinking, tool_calling]- input_types: [text, image]- output_types: [text]- release_date: 2025-05-01- cost: {input: 0, output: 0}-- - name: GPT-4.1- model: openai/gpt-4.1- description: "Flagship large language model optimized for advanced instruction following, real-world software engineering, and long-context reasoning"- roles: [chat, edit]- capabilities: [tool_calling]- input_types: [text, image]- output_types: [text]- release_date: 2025-04-14- cost: {input: 0, output: 0}-- - name: GPT-4.1-mini- model: openai/gpt-4.1-mini- description: "Mid-sized model delivering performance competitive with GPT-4o at substantially lower latency and cost"- roles: [chat, edit]- capabilities: [tool_calling]- input_types: [text, image]- output_types: [text]- release_date: 2025-04-14- cost: {input: 0, output: 0}-- - name: GPT-4.1-nano- model: openai/gpt-4.1-nano- description: "For tasks that demand low latency, GPT‑4.1 nano is the fastest and cheapest model in the GPT-4.1 series"- roles: [chat, edit]- capabilities: [tool_calling]- input_types: [text, image]- output_types: [text]- release_date: 2025-04-14- cost: {input: 0, output: 0}-- - name: DeepSeek-V3-0324- model: deepseek/deepseek-v3-0324- description: "DeepSeek V3 update with improved instruction following and coding capabilities"- roles: [chat, edit]- capabilities: [thinking, tool_calling]- input_types: [text]- output_types: [text]- release_date: 2025-03-24- cost: {input: 0, output: 0}-- - name: Mistral Small 3.1- model: mistral-ai/mistral-small-2503- description: "Upgraded variant of Mistral Small 3 (2501), featuring 24 billion parameters with advanced multimodal capabilities"- roles: [chat, edit]- capabilities: [thinking, tool_calling]- input_types: [text, image]- output_types: [text]- release_date: 2025-03-01- cost: {input: 0, output: 0}-- - name: Llama 4 Maverick 17B 128E Instruct FP8- model: meta/llama-4-maverick-17b-128e-instruct-fp8- description: "High-capacity multimodal language model from Meta, built on a mixture-of-experts (MoE) architecture with 128 experts and 17 billion active parameters per forward"- roles: [chat, edit]- capabilities: [thinking, tool_calling]- input_types: [text, image]- output_types: [text]- release_date: 2025-01-31- cost: {input: 0, output: 0}-- - name: Llama 4 Scout 17B 16E Instruct- model: meta/llama-4-scout-17b-16e-instruct- description: "Mixture-of-experts (MoE) language model developed by Meta, activating 17 billion parameters out of a total of 109B"- roles: [chat, edit]- capabilities: [thinking, tool_calling]- input_types: [text, image]- output_types: [text]- release_date: 2025-01-31- cost: {input: 0, output: 0}-- - name: OpenAI o3- model: openai/o3- description: "Well-rounded reasoning model setting a new standard for math, science, coding, and visual reasoning tasks"- roles: [chat, edit]- capabilities: [thinking]- input_types: [text, image]- output_types: [text]- release_date: 2025-01-31- cost: {input: 0, output: 0}-ollama:- name: GLM-5.3-Flashmodel: glm-5.3-flashdiff --git a/packages/llm-info/data/providers.yml b/packages/llm-info/data/providers.ymlindex 3d64659e36..810f2b1a2e 100644--- a/packages/llm-info/data/providers.yml+++ b/packages/llm-info/data/providers.yml@@ -3,6 +3,11 @@description: OpenAI's API for GPT models, including GPT-3.5 and GPT-4.url: https://platform.openai.com/+- name: GitHub Copilot+ id: github+ description: GitHub Copilot provides model inference through a Copilot subscription.+ url: https://pydantic.dev/docs/ai/models/github-copilot/+- name: Amazon Bedrockid: bedrockdescription: Amazon Bedrock provides access to foundation models from Amazon and leading AI startups via a unified API.@@ -28,11 +33,6 @@description: Ollama is a lightweight, open-source model server for running and sharing LLMs.url: https://ollama.ai/-- name: GitHub- id: github- description: GitHub's API for GPT models with GitHub-hosted models.- url: https://github.com/features/copilot-- name: marimoid: marimodescription: marimo's hosted models.diff --git a/packages/llm-info/src/index.ts b/packages/llm-info/src/index.tsindex 00546c54ac..6cadd52ecb 100644--- a/packages/llm-info/src/index.ts+++ b/packages/llm-info/src/index.ts@@ -39,7 +39,6 @@ export type SyncableProviderId =| "google"| "bedrock"| "azure"- | "github"| "ollama"| "wandb"| "opencode-go";diff --git a/packages/llm-info/src/sources/merge.ts b/packages/llm-info/src/sources/merge.tsindex 899fbc9bd2..ecfa56b192 100644--- a/packages/llm-info/src/sources/merge.ts+++ b/packages/llm-info/src/sources/merge.ts@@ -20,7 +20,6 @@ export const PROVIDER_MAP = {"google-vertex": "google","amazon-bedrock": "bedrock",azure: "azure",- "github-models": "github","ollama-cloud": "ollama",wandb: "wandb","opencode-go": "opencode-go",diff --git a/packages/openapi/api.yaml b/packages/openapi/api.yamlindex d70e8aa4fd..c7c35d0616 100644--- a/packages/openapi/api.yaml+++ b/packages/openapi/api.yaml@@ -129,11 +129,11 @@ components:\ AI completions\n - `open_ai`: the OpenAI config\n - `anthropic`: the\\ Anthropic config\n - `google`: the Google AI config\n - `bedrock`:\\ the Bedrock config\n - `azure`: the Azure config\n - `ollama`: the\- \ Ollama config\n - `github`: the GitHub config\n - `openrouter`: the\- \ OpenRouter config\n - `wandb`: the Weights & Biases config\n - `opencode_go`:\- \ the OpenCode Go config\n - `custom_providers`: a dict of custom OpenAI-compatible\- \ providers\n - `open_ai_compatible`: the OpenAI-compatible config (deprecated,\- \ use custom_providers)"+ \ Ollama config\n - `github`: the GitHub Copilot config\n - `openrouter`:\+ \ the OpenRouter config\n - `wandb`: the Weights & Biases config\n -\+ \ `opencode_go`: the OpenCode Go config\n - `custom_providers`: a dict\+ \ of custom OpenAI-compatible providers\n - `open_ai_compatible`: the OpenAI-compatible\+ \ config (deprecated, use custom_providers)"properties:allow_provider_config:type: boolean@@ -2536,11 +2536,12 @@ components:title: GetCacheInfoRequesttype: objectGitHubConfig:- description: "Configuration options for GitHub.\n\n **Keys.**\n\n - `api_key`:\- \ the GitHub API token or an `env:` reference\n - `base_url`: the base\- \ URL for the API\n - `copilot_settings`: configuration settings for GitHub\- \ Copilot LSP.\n Supports settings like `http` (proxy configuration),\- \ `telemetry`,\n and `github-enterprise` (enterprise URI)."+ description: "Configuration options for GitHub Copilot.\n\n **Keys.**\n\n\+ \ - `api_key`: a GitHub Copilot token or an `env:` reference\n - `base_url`:\+ \ the base URL for the GitHub Copilot API\n - `copilot_settings`: configuration\+ \ settings for GitHub Copilot LSP.\n Supports settings like `http`\+ \ (proxy configuration), `telemetry`,\n and `github-enterprise` (enterprise\+ \ URI)."properties:api_key:type: stringdiff --git a/packages/openapi/src/api.ts b/packages/openapi/src/api.tsindex 33b22ff0e2..64d681a6cb 100644--- a/packages/openapi/src/api.ts+++ b/packages/openapi/src/api.ts@@ -3771,7 +3771,7 @@ export interface components {* - `bedrock`: the Bedrock config* - `azure`: the Azure config* - `ollama`: the Ollama config- * - `github`: the GitHub config+ * - `github`: the GitHub Copilot config* - `openrouter`: the OpenRouter config* - `wandb`: the Weights & Biases config* - `opencode_go`: the OpenCode Go config@@ -5222,12 +5222,12 @@ export interface components {GetCacheInfoRequest: Record<string, any>;/*** GitHubConfig- * @description Configuration options for GitHub.+ * @description Configuration options for GitHub Copilot.** **Keys.***- * - `api_key`: the GitHub API token or an `env:` reference- * - `base_url`: the base URL for the API+ * - `api_key`: a GitHub Copilot token or an `env:` reference+ * - `base_url`: the base URL for the GitHub Copilot API* - `copilot_settings`: configuration settings for GitHub Copilot LSP.* Supports settings like `http` (proxy configuration), `telemetry`,* and `github-enterprise` (enterprise URI).diff --git a/tests/_config/test_config.py b/tests/_config/test_config.pyindex 7100726cef..0fc03962ca 100644--- a/tests/_config/test_config.py+++ b/tests/_config/test_config.py@@ -126,7 +126,6 @@ def test_configure_github_with_copilot_settings() -> None:PartialMarimoConfig(ai={"github": {- "api_key": "test-github-key","copilot_settings": {"http": {"proxy": "http://proxy.example.com:8888",@@ -143,7 +142,6 @@ def test_configure_github_with_copilot_settings() -> None:)github_config = config.get("ai", {}).get("github", {})- assert github_config.get("api_key") == "test-github-key"assert github_config.get("copilot_settings") is not Nonecopilot_settings = github_config.get("copilot_settings", {})assert (diff --git a/tests/_server/ai/test_ai_config.py b/tests/_server/ai/test_ai_config.pyindex d52804c140..f349ae9d7b 100644--- a/tests/_server/ai/test_ai_config.py+++ b/tests/_server/ai/test_ai_config.py@@ -12,9 +12,7 @@ from marimo._config.config import (AiConfig,MarimoConfig,)-from marimo._dependencies.dependencies import DependencyManagerfrom marimo._server.ai.config import (- GITHUB_COPILOT_BASE_URL,AnyProviderConfig,_get_ai_config,_get_base_url,@@ -142,117 +140,6 @@ class TestAnyProviderConfig:assert provider_config.api_key == "ollama-placeholder"assert provider_config.base_url == "http://127.0.0.1:11434/v1"- def test_for_github(self):- """Test GitHub configuration."""- config: AiConfig = {- "github": {- "api_key": "test-github-key",- "base_url": "https://some-base-url",- }- }-- provider_config = AnyProviderConfig.for_github(config)-- assert provider_config.api_key == "test-github-key"- assert provider_config.base_url == "https://some-base-url"-- def test_for_github_with_fallback_base_url(self):- """Test GitHub configuration uses fallback base URL when not specified."""- config: AiConfig = {- "github": {- "api_key": "test-github-key",- }- }-- provider_config = AnyProviderConfig.for_github(config)-- assert provider_config.api_key == "test-github-key"- assert provider_config.base_url == "https://models.github.ai/inference"-- @pytest.mark.skipif(- not DependencyManager.pydantic_ai.has(),- reason="pydantic-ai is not installed",- )- def test_github_default_base_url_matches_pydantic_ai(self):- """Test GitHub configuration base URL matches pydantic-ai."""- from pydantic_ai.providers.github import GitHubProvider-- assert (- GitHubProvider(api_key="dummy").base_url == GITHUB_COPILOT_BASE_URL- )-- def test_for_github_default_extra_headers(self):- """Test GitHub configuration includes default extra headers."""- config: AiConfig = {- "github": {- "api_key": "test-github-key",- }- }-- provider_config = AnyProviderConfig.for_github(config)-- assert provider_config.extra_headers is not None- assert (- provider_config.extra_headers["editor-version"] == "vscode/1.95.0"- )- assert (- provider_config.extra_headers["Copilot-Integration-Id"]- == "vscode-chat"- )-- def test_for_github_user_headers_override_defaults(self):- """Test GitHub configuration allows user headers to override defaults."""- config: AiConfig = {- "github": {- "api_key": "test-github-key",- "extra_headers": {- "editor-version": "custom-editor/2.0.0",- "X-Custom-Header": "custom-value",- },- }- }-- provider_config = AnyProviderConfig.for_github(config)-- assert provider_config.extra_headers is not None- # User header should override default- assert (- provider_config.extra_headers["editor-version"]- == "custom-editor/2.0.0"- )- # Default header not overridden should remain- assert (- provider_config.extra_headers["Copilot-Integration-Id"]- == "vscode-chat"- )- # Custom user header should be preserved- assert (- provider_config.extra_headers["X-Custom-Header"] == "custom-value"- )-- def test_for_github_with_copilot_settings(self):- """Test GitHub configuration with copilot_settings is accepted."""- config: AiConfig = {- "github": {- "api_key": "test-github-key",- "copilot_settings": {- "http": {- "proxy": "http://proxy.example.com:8888",- "proxyStrictSSL": True,- },- "telemetry": {"telemetryLevel": "off"},- },- }- }-- # Should not raise an error - copilot_settings is a valid field- provider_config = AnyProviderConfig.for_github(config)-- # Note: copilot_settings is stored in config but not used by AnyProviderConfig- # It's used by the frontend LSP client- assert provider_config.api_key == "test-github-key"- assert provider_config.base_url == "https://models.github.ai/inference"-def test_for_openrouter(self):"""Test OpenRouter configuration."""config: AiConfig = {@@ -345,6 +232,19 @@ class TestAnyProviderConfig:assert provider_config.api_key == "test-opencode-key"assert provider_config.base_url == "https://opencode.ai/zen/go/v1/"+ def test_for_github(self) -> None:+ config: AiConfig = {+ "github": {+ "api_key": "gho_test-token",+ "base_url": "https://copilot.example.com",+ }+ }++ provider_config = AnyProviderConfig.for_github(config)++ assert provider_config.api_key == "gho_test-token"+ assert provider_config.base_url == "https://copilot.example.com"+def test_for_openai_with_project(self):"""Test OpenAI configuration with project field."""config: AiConfig = {@@ -431,12 +331,12 @@ class TestAnyProviderConfig:assert provider_config.api_key == "test-anthropic-key"def test_for_model_github(self) -> None:- """Test for_model with GitHub model."""- config: AiConfig = {"github": {"api_key": "test-github-key"}}+ config: AiConfig = {"github": {"api_key": "gho_test-token"}}- provider_config = AnyProviderConfig.for_model("github/gpt-4o", config)+ provider_config = AnyProviderConfig.for_model("github/gpt-5.4", config)- assert provider_config.api_key == "test-github-key"+ assert provider_config.api_key == "gho_test-token"+ assert provider_config.base_url == "https://api.githubcopilot.com"def test_for_model_openrouter(self) -> None:"""Test for_model with OpenRouter model."""@@ -743,35 +643,6 @@ class TestProviderConfigWithFallback:ssl_verify=True,)- @patch.dict(os.environ, {"GITHUB_TOKEN": "env-github-token"})- def test_for_github_with_fallback_key(self) -> None:- """Test GitHub config uses fallback key when config is missing api_key."""- config: AiConfig = {"github": {}}-- provider_config = AnyProviderConfig.for_github(config)-- assert provider_config.api_key == "env-github-token"-- @patch.dict(os.environ, {"GITHUB_TOKEN": "env-github-token"})- def test_for_github_config_key_takes_precedence(self) -> None:- """Test GitHub config key takes precedence over environment variable."""- config: AiConfig = {"github": {"api_key": "config-github-token"}}-- provider_config = AnyProviderConfig.for_github(config)-- assert provider_config.api_key == "config-github-token"-- @patch.dict(os.environ, {}, clear=True)- def test_for_github_no_fallback_available(self) -> None:- """Test GitHub config fails when no config key and no env var."""- config: AiConfig = {"github": {}}-- with pytest.raises(HTTPException) as exc_info:- AnyProviderConfig.for_github(config)-- assert exc_info.value.status_code == HTTPStatus.BAD_REQUEST- assert "GitHub API key not configured" in str(exc_info.value.detail)-@patch.dict(os.environ, {"OPENROUTER_API_KEY": "env-openrouter-token"})def test_for_openrouter_with_fallback_key(self) -> None:"""Test OpenRouter config uses fallback key when config is missing api_key."""@@ -854,6 +725,46 @@ class TestProviderConfigWithFallback:exc_info.value.detail)+ @pytest.mark.parametrize(+ "variable",+ [+ "GITHUB_COPILOT_API_KEY",+ "GITHUB_COPILOT_API_TOKEN",+ "COPILOT_GITHUB_TOKEN",+ ],+ )+ def test_for_github_copilot_with_fallback_key(self, variable: str) -> None:+ with patch.dict(os.environ, {variable: "gho_env-token"}, clear=True):+ provider_config = AnyProviderConfig.for_github({})++ assert provider_config.api_key == "gho_env-token"++ @patch.dict(+ os.environ,+ {+ "GITHUB_COPILOT_API_KEY": "gho_env-token",+ "GITHUB_COPILOT_BASE_URL": "https://copilot.example.com",+ },+ clear=True,+ )+ def test_for_github_copilot_with_environment_base_url(self) -> None:+ provider_config = AnyProviderConfig.for_github({})++ assert provider_config.base_url == "https://copilot.example.com"++ @patch.dict(+ os.environ,+ {"GITHUB_TOKEN": "generic-token", "GH_TOKEN": "generic-token"},+ clear=True,+ )+ def test_for_github_copilot_ignores_generic_github_tokens(self) -> None:+ with pytest.raises(HTTPException) as exc_info:+ AnyProviderConfig.for_github({})++ assert "GitHub Copilot API key not configured" in str(+ exc_info.value.detail+ )+class TestGetKey:"""Tests for _get_key function."""@@ -1293,7 +1204,6 @@ class TestSSLConfiguration:("provider_name", "provider_method", "api_key_config"),[("openai", "for_openai", {"open_ai": {"api_key": "test-key"}}),- ("github", "for_github", {"github": {"api_key": "test-key"}}),("ollama", "for_ollama", {"ollama": {"api_key": "test-key"}}),],)@@ -1327,24 +1237,14 @@ class TestSSLConfiguration:assert provider_config.client_pem == "/custom/path/to/client.pem", (f"{provider_name}: client_pem should match")- # GitHub includes default headers that are merged with user headers- if provider_name == "github":- assert provider_config.extra_headers is not None- assert "X-Custom" in provider_config.extra_headers- assert provider_config.extra_headers["X-Custom"] == "header"- # GitHub should also include default headers- assert "editor-version" in provider_config.extra_headers- assert "Copilot-Integration-Id" in provider_config.extra_headers- else:- assert provider_config.extra_headers == {"X-Custom": "header"}, (- f"{provider_name}: extra_headers should match"- )+ assert provider_config.extra_headers == {"X-Custom": "header"}, (+ f"{provider_name}: extra_headers should match"+ )@pytest.mark.parametrize(("provider_name", "provider_method", "api_key_config"),[("openai", "for_openai", {"open_ai": {"api_key": "test-key"}}),- ("github", "for_github", {"github": {"api_key": "test-key"}}),("ollama", "for_ollama", {"ollama": {"api_key": "test-key"}}),],)@@ -1454,16 +1354,6 @@ class TestEdgeCases:config) == AnyProviderConfig(base_url=None, api_key="", ssl_verify=True)- def test_github_config_missing(self):- """Test error when GitHub config is missing."""- config: AiConfig = {}-- with pytest.raises(HTTPException) as exc_info:- AnyProviderConfig.for_github(config)-- assert exc_info.value.status_code == HTTPStatus.BAD_REQUEST- assert "GitHub API key not configured" in str(exc_info.value.detail)-def test_tools_empty_list(self):"""Test that tools are not included when empty list."""provider_config = AnyProviderConfig(diff --git a/tests/_server/ai/test_providers.py b/tests/_server/ai/test_providers.pyindex 1cd0b029cc..8fafbd1379 100644--- a/tests/_server/ai/test_providers.py+++ b/tests/_server/ai/test_providers.py@@ -12,6 +12,7 @@ from pydantic import ValidationErrorfrom marimo._config.config import AiConfigfrom marimo._dependencies.dependencies import Dependency, DependencyManager+from marimo._dependencies.errors import ManyModulesNotFoundErrorfrom marimo._server.ai.completion_output import (CELL_COMPLETION_DATA_TYPE,NOTEBOOK_CELLS_COMPLETION_DATA_TYPE,@@ -25,12 +26,14 @@ from marimo._server.ai.providers import (AzureOpenAIProvider,BedrockProvider,CustomProvider,+ GitHubCopilotProvider,GoogleProvider,OpenAIClientMixin,OpenAIProvider,StreamOptions,_infer_provider_name_from_base_url,_normalize_base_url,+ _require_github_copilot_dependency,_structured_completion_finish_reason,get_completion_provider,)@@ -397,6 +400,38 @@ def test_get_completion_provider(assert isinstance(provider, provider_type)+def test_get_github_copilot_completion_provider() -> None:+ config = AnyProviderConfig(+ api_key="gho_test-token", base_url="https://api.githubcopilot.com"+ )++ with (+ patch(+ "marimo._server.ai.providers._require_github_copilot_dependency"+ ),+ patch.object(+ GitHubCopilotProvider,+ "create_provider",+ return_value=MagicMock(),+ ),+ ):+ provider = get_completion_provider(config, "github/gpt-5.4")++ assert isinstance(provider, GitHubCopilotProvider)+++def test_github_copilot_requires_supported_pydantic_ai() -> None:+ with patch(+ "marimo._server.ai.providers."+ "GITHUB_COPILOT_DEPENDENCY.has_required_version",+ return_value=False,+ ):+ with pytest.raises(ManyModulesNotFoundError) as exc_info:+ _require_github_copilot_dependency()++ assert exc_info.value.package_names == ["pydantic-ai-slim[openai]>=2.42.0"]++@pytest.mark.requires("pydantic_ai")async def test_azure_openai_provider() -> None:"""Test that Azure OpenAI provider uses correct parameters."""@@ -958,8 +993,8 @@ def test_custom_provider_agent_omits_max_tokens_when_none() -> None:id="path_before_v1",),pytest.param(- "https://models.github.ai/inference",- "models.github.ai/inference",+ "https://inference.example.com/custom-path",+ "inference.example.com/custom-path",id="path_without_v1",),pytest.param(