VS Code integration
VS Code Copilot Chat with Claude, GPT, Gemini and Kimi via Plan2API
VS Code 1.144 runs Plan2API models in chat through its Custom Endpoint provider: run Chat: Manage Language Models, choose Add Models > Custom Endpoint, pick the Chat Completions API type and point each model at https://api.plan2api.com/v1/chat/completions. In Local sessions this needs no Copilot plan and no GitHub sign-in.
- Provider
- Custom Endpoint
- API type
- Chat Completions
- Endpoint path
- /
v1/ chat/ completions - Copilot plan needed
- No, in Local sessions
Updated
VS Code settings at a glance
Here is every value the VS Code custom endpoint provider needs to run your models in chat.
Choose Chat Completions, never Responses or Messages, because Plan2API only serves the Chat Completions format.
| Setting | Value |
|---|---|
| Provider | Add Models > Custom Endpoint |
| API type | Chat Completions (chat-completions) |
| Model url | https:// |
| API key | Your p2a_ key |
| Model ids | claude/, openai/, more |
| Config file | chatLanguageModels.json |
Add Plan2API to VS Code
- Sign up at Plan2API, connect a Claude, ChatGPT, Google AI or Kimi subscription, and copy your
p2a_key. - Open the Language Models editor by clicking
Manage Language Models(the gear icon) in the chat model picker, or runChat: Manage Language Modelsfrom the Command Palette. - Select
Add Modelsand then pickCustom Endpoint. - Enter a group name like
Plan2API, which is the label that shows up in the model picker and the Language Models editor. - Type in a display name for your first model and paste your
p2a_key. - Select
Chat Completionsas the API type. - VS Code opens
chatLanguageModels.jsonwith your new provider entry, so update themodelsarray to match the example in the next section and save the file. - Pick one of your Plan2API models from the chat model picker, and restart VS Code if it isn't showing up yet.
chatLanguageModels.json for Plan2API
Each entry in models points straight at the full https://api.plan2api.com/v1/chat/completions URL, since VS Code will otherwise append a path segment itself if you just give it a base URL. Every model has toolCalling set to true so Agent mode can run tools, and vision is true on the Claude, Gemini and Kimi entries because those accept image input.
When you set contextWindow, VS Code subtracts maxOutputTokens from it to get the model's input budget (maxInputTokens). The 128000 window on openai/gpt-6.1-sol and the maxOutputTokens numbers (32000 for Claude, 16000 for the others) are conservative defaults because Plan2API doesn't publish a context window for Codex models or output limits for Codex, Gemini or Kimi. The apiKey line uses an input variable, ${input:plan2apiKey}, instead of the raw key, as VS Code's docs recommend. Since Codex requests run on your own ChatGPT plan, swap openai/gpt-6.1-sol for a model your plan includes if it isn't on your plan.
[
{
"name": "Plan2API",
"vendor": "customendpoint",
"apiKey": "${input:plan2apiKey}",
"apiType": "chat-completions",
"models": [
{
"id": "claude/claude-sonnet-5",
"name": "Claude Sonnet 5 (Plan2API)",
"url": "https://api.plan2api.com/v1/chat/completions",
"toolCalling": true,
"vision": true,
"contextWindow": 1000000,
"maxOutputTokens": 32000
},
{
"id": "openai/gpt-6.1-sol",
"name": "GPT-6.1 Sol (Plan2API)",
"url": "https://api.plan2api.com/v1/chat/completions",
"toolCalling": true,
"contextWindow": 128000,
"maxOutputTokens": 16000
},
{
"id": "gemini/gemini-3.8-flash-high",
"name": "Gemini 3.8 Flash (Plan2API)",
"url": "https://api.plan2api.com/v1/chat/completions",
"toolCalling": true,
"vision": true,
"contextWindow": 1048576,
"maxOutputTokens": 16000
},
{
"id": "kimi/k3",
"name": "Kimi K3 (Plan2API)",
"url": "https://api.plan2api.com/v1/chat/completions",
"toolCalling": true,
"vision": true,
"contextWindow": 1048576,
"maxOutputTokens": 16000
}
]
}
]Use it without a Copilot plan
In Local harness sessions, VS Code BYOK models work right away without a GitHub sign-in and without a Copilot plan. If you want to use them inside Copilot harness sessions (which covers the Chat view and the Agents window), you have to turn on the experimental setting chat.agentHost.byokModels.enabled.
You pick the harness using the Session Target control when you start a new session, though it only lists targets whose requirements are met. If Local doesn't show up in an unmanaged editor, the settings below make it visible and stop VS Code from defaulting to the Copilot harness (an organization policy can still override them).
Without a GitHub sign-in, VS Code's built-in utility models aren't available for background tasks. Open the Settings editor and point chat.utilityModel and chat.utilitySmallModel at your Plan2API models, or set chat.byokUtilityModelDefault to Main Agent Model, so you still get generated chat titles and commit messages. If you're on Copilot Business or Enterprise, your admin needs to enable the Bring Your Own Language Model Key in VS Code policy on GitHub.com first.
{
"chat.editor.localAgent.enabled": true,
"chat.defaultToCopilotHarness": false,
"chat.editor.preferCopilotHarness": false
}What works and what doesn't
- The built-in Ask, Agent and Plan agents work with Plan2API models in
Localsessions, and inCopilotsessions oncechat.agentHost.byokModels.enabledis turned on. - Tool calling and streaming work across Claude, Codex, Gemini and Kimi models.
- Image input works on Claude, Gemini and Kimi models when
visionis set totrue. - A Thinking Effort picker shows up in chat when you add
supportsReasoningEffortwithreasoningEffortFormatset tochat-completions, which sends the top-levelreasoning_effortfield that Plan2API accepts (kimi/k3only takeslow,highormax). - Inline suggestions, semantic search and features that need embeddings don't work through BYOK, and Plan2API has no
/v1/completionsor/v1/embeddingsendpoint anyway. - The
ClaudeandCodexharnesses in Session Target use their own credentials or sign-ins (likeANTHROPIC_API_KEYor a direct ChatGPT login) rather than Custom Endpoint models. - Setting
temperatureinsidemodelOptionsonly affects Gemini models, since Claude and Codex ignore it and Kimi locks it at1.
Fix Plan2API errors in VS Code
If requests fail or a model won't show up in the picker, match what you're seeing to the table below.
If every request fails right after setup, check apiType and url in chatLanguageModels.json before anything else.
| Symptom | Cause | Fix |
|---|---|---|
| Model missing from the picker | Harness or picker not refreshed | Restart VS Code, use a Local session |
| Every request fails | Wrong apiType or url | Use chat-completions and the full url |
401 invalid_ | Wrong or partial key | Re-enter the full p2a_ key |
403 no_ | No subscription for that provider | Connect it or pick another model |
400 model_ | Typo in the model id | Copy an id from GET / |
400 unsupported_ | JSON response_ on a Claude model | Use a GPT, Gemini or Kimi model |
| Prompt to configure utility models | Not signed in to GitHub | Set chat.utilityModel and chat.utilitySmallModel |
| Add Models has no BYOK option | Business or Enterprise policy off | Ask your Copilot admin |
Use your Claude or ChatGPT plan in VS Code
Plan2API takes a Claude Pro or Max, ChatGPT (through Codex), Google AI Pro or Ultra, or Kimi subscription you already pay for and turns it into one p2a_ key, so a single Custom Endpoint group in VS Code covers all four providers. It doesn't turn a GitHub Copilot subscription into an API.
You keep paying your provider for your plan, and Plan2API never bills you per token. Your subscription's normal usage limits still apply, and keep in mind that Agent mode sends many requests for a single task. You can compare the full plan limits on the pricing page:
- Free is $0 for 1 connected subscription and 50 chat requests a day (resetting at 00:00 UTC), with no card needed.
- Pro is $12 a month or $99 a year for 3 connected subscriptions and no daily request cap.
- Scale is $29 a month or $249 a year for 25 connected subscriptions and no daily request cap.
Use the AI subscriptions you already pay for as one OpenAI-compatible API key.
- Free: 1 subscription, 50 requests a day, no card
- Pro: $12 a month
FAQ
Do I need a GitHub Copilot plan to use Plan2API models in VS Code?
No. In Local harness sessions, BYOK models run without a Copilot plan and without signing in to GitHub. You still need a GitHub account for inline suggestions, semantic search and features that use embeddings.
Can I use Claude in GitHub Copilot Chat with my Claude Pro subscription?
Yes, through Plan2API. Add claude/claude-sonnet-5 as a Custom Endpoint model in chatLanguageModels.json and select it from the chat model picker, and it will run against your Claude plan's own usage limits.
Does Plan2API turn GitHub Copilot into an API?
No. Plan2API connects Claude, ChatGPT, Google AI and Kimi subscriptions, not GitHub Copilot. It gives you one OpenAI-compatible API key for those four providers that you can use in VS Code or in your own code.
Which API type do I choose for Plan2API in VS Code?
Choose Chat Completions. Plan2API has no /v1/responses or Anthropic /v1/messages endpoint, so picking Responses or Messages will fail.
Can Plan2API power Copilot's inline code completions?
No. VS Code only uses BYOK models for chat and utility tasks, not inline code completions, and Plan2API doesn't have a /v1/completions endpoint.
Sources
- VS Code docs: language models and BYOKcode.visualstudio.com
- VS Code docs: agent harnessescode.visualstudio.com
- VS Code 1.144 release notescode.visualstudio.com