Skip to content

Support BYOK/Custom Models for Inline Code Completions #318545

Open

Description

Problem
VS Code's GitHub Copilot extension currently supports BYOK (Bring Your Own Key) models for chat via chatLanguageModels.json (VS Code insiders) or with other openAI compatible provider extensions like the Unify Chat Provider, but not for inline code completions.

When setting "github.copilot.selectedCompletionModel" to a custom model ID (e.g., a local model served via OpenAI-compatible API), the setting is silently ignored because the model ID is not in the list returned by GitHub's API. The extension falls back to the default Copilot cloud model (gpt-41-copilot), and completions always go through proxy.business.githubcopilot.com.

This means:
Chat works with local models ✅
Inline code completions always require GitHub's cloud ❌
Disconnecting from the internet disables completions entirely ❌

Current Behavior

if (!genericModels.includes(userSelectedCompletionModel)) {

if (!genericModels.includes(userSelectedCompletionModel)) {   
 // Silently falls back to default model    
 userSelectedCompletionModel = null;}

The fallback is silent — no warning or error is shown to the user. Completions continue to go to GitHub's cloud proxy.

Expected Behavior
Users should be able to configure a custom/OpenAI-compatible endpoint for inline code completions, similar to how chat completions work with chatLanguageModels.json or the Unify Chat Provider. This would enable:

Fully offline code completions
Use of self-hosted local models (llama.cpp, FastFlowLM, vLLM, etc.)
BYOK models for organizations that cannot use GitHub's cloud

Activity

  1. GitSparTV commented on May 29, 2026

    @GitSparTV

    Usual case for local autocompletion is Ollama with qwen2.5-coder.
    Currently only Continue is able to use local models for autocompletion. Kilo code uses cloud models

  2. Arifursdev commented on Jun 10, 2026

    @Arifursdev
  3. hu3bi commented on Jun 10, 2026

    @hu3bi

    #313468 #309009

    Maybe we can close 2 of those issues as duplicate and merge relevant comments into 1 issue. At least 3 issues open for the same thing.


    hope it is ok to ping you guys
    Ulugbek Abdullaev (@ulugbekna) Vritant Bhardwaj (@vritant24)

  4. GitSparTV commented on Jun 10, 2026

    @GitSparTV

    This issue has 30 likes, first one that is not a duplicate has 3.

    Move your likes there, guys

  5. vritant24 commented on Jun 10, 2026

    @vritant24
    Member

    This issue has 30 likes, first one that is not a duplicate has 3.

    Move your likes there, guys

    Apologies, thanks for pointing that out. I'll open this up and dedupe the other to this one

  6. 72 remaining items

  7. unbadfish commented on Sep 30, 2026

    @unbadfish

    Notice

    1. As commit 18755e8 deleted jointInlineCompletionProvider.ts , a key file for BYOK FIM service, any PR whose base commit is before this commit, may need to be re-written.
    2. the patch in Support BYOK/Custom Models for Inline Code Completions #318545 (comment) , for the same reason, would need to be re-written.
    3. As the commit 18755e8 was commit by Ulugbek Abdullaev (Ulugbek Abdullaev (@ulugbekna)), an "Assignees" to issue Support BYOK/Custom Models for Inline Code Completions #318545, I have to say that the only "acceptable" (for vscode team) way for the community to use BYOK FIM is a 3-rd patch.

    Thus, I think a smart way to union the community is to release (and continuously update) a patch (base on the former patch mentioned before) in a separate repo. I would soon do that . . .

  8. DrkWzrd commented on Oct 16, 2026

    @DrkWzrd

    So... this is dead.

    Nice. Just force your users to put a shitty extension in your not-as-fast-today IDE.

  9. GitSparTV commented on Oct 16, 2026

    @GitSparTV

    If you really need one right now, Continue extension is probably the only one supporting any model you want.

  10. SettingPrompter commented on Oct 17, 2026

    @SettingPrompter

    except it doesnt, seems like you haven't used it well

  11. GitSparTV commented on Oct 17, 2026

    @GitSparTV

    SettingPrompter I use it every day with Ollama Qwen3.5-3b. It detects FIM mode where model does a better job at autocompleting.
    But I agree the multiline mode sucks and I have to set maximum token limit just in case

  12. SettingPrompter commented on Oct 17, 2026

    @SettingPrompter

    its unironically ass yeah, thats why i've been seeking for a normal one and ended up here using the patch 😭

  13. sitjac commented on Nov 3, 2026

    @sitjac

    Another real-world use case for this feature:

    Our organization provides Claude / DeepSeek / GLM models through an internal OpenAI/Anthropic-compatible gateway, registered in VS Code via the BYOK customendpoint provider. Chat, Inline Chat, and Agent mode all work great with these custom models.

    However, inline completions (ghost text) cannot use them. Setting "github.copilot.selectedCompletionModel" to our custom model ID is silently ignored — the extension logs User selected model <id> is not in the list of generic models ... falling back to default model at trace level only, with no visible warning. From a user's perspective it looks like the setting simply doesn't work, especially since the settings UI accepts any string.

    Two asks:

    1. Support BYOK/custom endpoints for inline completions (e.g. an opt-in completionsUrl per model, as explored in Support BYOK endpoints for Inline suggestions (fix #318545) #330816).
    2. Until then, at least surface a visible warning (or validate the setting) when the selected completion model is not available, instead of silently falling back.

    For enterprises whose policies route all LLM traffic through an internal gateway, this is currently the only Copilot surface that cannot comply. Thanks!

  14. SettingPrompter commented on Nov 4, 2026

    @SettingPrompter

    have u fixed the patch? do u need help with it? i could take a look if its required
    unbadfish

  15. unbadfish commented on Nov 4, 2026

    @unbadfish

    have u fixed the patch? do u need help with it? i could take a look if its required

    SettingPrompter Apologize for my delay. I will release my patch on Saturday night (UTC +8). I managed to intergrade inline FIM and next edit suggestion into one patch, but both still need improve.

  16. SettingPrompter commented on Nov 4, 2026

    @SettingPrompter

    bet

  17. unbadfish commented on Nov 4, 2026

    @unbadfish

    A usable patch for vscode 1.145.0, ~2k lines. Much longer than 300 lines provided by the "ghost".

    I develop this patch in 1.140.0, edited in 1.142, 1.143, 1.144.1, when vscode bumped from 1.144.1 to 1.145.0, this patch can be cleanly used.

    Inline-FIM_NES-1.145.0.patch


    Settings and playground:

    inline.zip

    In short:

    FIM
    everything lives in .vscode/settings.json under ghost_text.providers[].

    • Supports prompt/suffix: "mode": "fim_completions", prompt/suffix sent as-is.
    • Chat-only gateway: "mode": "chat_completions" + messages, and delete prompt/suffix via requestDelete.
    • Client-side templating(ollama?): "mode": "fim_tokens" + template_kind. UNTESTED

    NES
    Add an endpoint to the active profile's chatLanguageModels.json (vendor + name + models[].id/url/apiKey).
    settings.json reference it as vendor/name/id. Whichever apiType it uses (chat-completions, responses or messages) should be set in chatLanguageModels.json.


    Screenshot (UI in Chinese):

    FIM
    FIM

    NES
    NES1
    NES2

  18. SettingPrompter commented on Nov 4, 2026

    @SettingPrompter

    took a look, looks fine to me, the mentioned 2k lines is just splitting into files, the backbone has been kept tiny which is the most important part, thanks

  19. balabommablock-cpu commented on Nov 8, 2026

    @balabommablock-cpu

    A product view, since this thread mixes three different asks and they need different amounts of work.

    The three asks

    1. "My setting does nothing." github.copilot.selectedCompletionModel accepts any string, and if the model isn't in the server list it quietly falls back (completions-core/.../openai/model.ts, around line 139, logged at INFO only). ɔɐſʇı̣s (@sitjac)'s report above is exactly this.
    2. Local or offline ghost text (Ollama, llama.cpp, vLLM).
    3. Company gateway for all LLM traffic. Chat, inline chat and agent already go through BYOK; completions are the one surface that can't.

    What already exists

    • Chat BYOK keeps url + apiKey per model in chatLanguageModels.json.
    • Next Edit Suggestions already has xtabProvider.url / apiKey overrides, but they're defineTeamInternalSetting, so only the team can use them.

    So the plumbing is mostly there. The missing piece is one public way to say "use this model for completions".

    A small path, in order

    1. Stop the silent fallback (days, not months). If the selected completion model isn't available, say so: a warning on the setting or one line in the Copilot status menu, like "Completions model x isn't available, using the default." This alone would close a lot of confused reports.
    2. Let a BYOK model opt into completions. In chatLanguageModels.json, a model can declare a completions endpoint and a format: fim (sends prompt + suffix) or chat (for gateways that only speak chat). It then shows up in the completions model picker. Keys stay in one place, same as chat. The patches shared here (Support BYOK endpoints for Inline suggestions (fix #318545) #330816, unbadfish's 1.145 patch) show these two formats cover most setups.
    3. NES on BYOK later, by making the xtab overrides public for models that speak that prompt format, marked experimental, since quality depends heavily on the model.

    One line of UI that helps everyone: show "Completions: <model> at <host>" in the status menu. Local users can see it's really local, and enterprise users can show their security team where traffic goes.

    A question for the team: is the blocker product policy or quality? Either answer helps. If it's quality, step 2 can ship as "experimental, your model, your results". If it's policy, a clear "not planned" would save this thread a lot of waiting, which is kinder than a quiet backlog.

    Step 1 seems worth doing whatever the answer is.

  20. SettingPrompter commented on Nov 8, 2026

    @SettingPrompter

    what?

  21. SettingPrompter commented on Nov 8, 2026

    @SettingPrompter

    unbadfish what model have you ended up using with nes and autocomplete?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requestmodel-byok

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions