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.

VS Code Custom Endpoint values for Plan2API
SettingValue
ProviderAdd Models > Custom Endpoint
API typeChat Completions (chat-completions)
Model urlhttps://api.plan2api.com/v1/chat/completions
API keyYour p2a_ key
Model idsclaude/claude-sonnet-5, openai/gpt-6.1-sol, more
Config filechatLanguageModels.json

Add Plan2API to VS Code

  1. Sign up at Plan2API, connect a Claude, ChatGPT, Google AI or Kimi subscription, and copy your p2a_ key.
  2. Open the Language Models editor by clicking Manage Language Models (the gear icon) in the chat model picker, or run Chat: Manage Language Models from the Command Palette.
  3. Select Add Models and then pick Custom Endpoint.
  4. Enter a group name like Plan2API, which is the label that shows up in the model picker and the Language Models editor.
  5. Type in a display name for your first model and paste your p2a_ key.
  6. Select Chat Completions as the API type.
  7. VS Code opens chatLanguageModels.json with your new provider entry, so update the models array to match the example in the next section and save the file.
  8. 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.

JSON
[
  {
    "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.

JSON
{
  "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 Local sessions, and in Copilot sessions once chat.agentHost.byokModels.enabled is turned on.
  • Tool calling and streaming work across Claude, Codex, Gemini and Kimi models.
  • Image input works on Claude, Gemini and Kimi models when vision is set to true.
  • A Thinking Effort picker shows up in chat when you add supportsReasoningEffort with reasoningEffortFormat set to chat-completions, which sends the top-level reasoning_effort field that Plan2API accepts (kimi/k3 only takes low, high or max).
  • Inline suggestions, semantic search and features that need embeddings don't work through BYOK, and Plan2API has no /v1/completions or /v1/embeddings endpoint anyway.
  • The Claude and Codex harnesses in Session Target use their own credentials or sign-ins (like ANTHROPIC_API_KEY or a direct ChatGPT login) rather than Custom Endpoint models.
  • Setting temperature inside modelOptions only affects Gemini models, since Claude and Codex ignore it and Kimi locks it at 1.

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.

VS Code Custom Endpoint errors with Plan2API
SymptomCauseFix
Model missing from the pickerHarness or picker not refreshedRestart VS Code, use a Local session
Every request failsWrong apiType or urlUse chat-completions and the full url
401 invalid_api_keyWrong or partial keyRe-enter the full p2a_ key
403 no_credentialsNo subscription for that providerConnect it or pick another model
400 model_not_foundTypo in the model idCopy an id from GET /v1/models
400 unsupported_parameterJSON response_format on a Claude modelUse a GPT, Gemini or Kimi model
Prompt to configure utility modelsNot signed in to GitHubSet chat.utilityModel and chat.utilitySmallModel
Add Models has no BYOK optionBusiness or Enterprise policy offAsk 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

  1. VS Code docs: language models and BYOKcode.visualstudio.com
  2. VS Code docs: agent harnessescode.visualstudio.com
  3. VS Code 1.144 release notescode.visualstudio.com