Skip to content

BYOK Copilot CLI not working anymore with Deepseek #4840

Open

Description

@Bude2408

Describe the bug

BYOK is not working in Copilot CLI anymore. GPT5.4 is selected and an error is coming: 400 Failed to deserialize the JSON body into the target type: tools[4].type: unknownvariant custom, expected function at line 1 column 47113

export COPILOT_PROVIDER_BASE_URL=https://api.deepseek.com
export COPILOT_MODEL=deepseek-flash
export COPILOT_MODEL=deepseek-v4-pro
export COPILOT_PROVIDER_API_KEY=....
copilot

Affected version

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

Activity

  1. added theissue type on Sep 14, 2026
  2. changed the title [-]BYOK Copilot CLI not working anymore[/-] [+]BYOK Copilot CLI not working anymore with Deepseek[/+] on Sep 14, 2026
  3. Rogn commented on Sep 22, 2026

    @Rogn

    I’ve configured DeepSeek as a custom model in Copilot CLI, and it worked until version 1.0.83. Since upgrading, I can still see deepseek-flash (custom) under Recent models, but selecting it does not switch to the model.

    Is anyone else seeing this with custom models? The screenshots show my custom model configuration and what appears in the model selector.

    Image Image

    My current workaround is to start Copilot using:
    copilot --prefer-version 1.0.83 --no-auto-update

  4. Lerbaek commented on Sep 24, 2026

    @Lerbaek

    It works for me, though I did have to do some reconfiguration around the same time.

    Try following the official instructions.

    As per your specific configuration:

    export COPILOT_PROVIDER_BASE_URL=https://api.deepseek.com/

    The base URL should be https://api.deepseek.com/anthropic

    export COPILOT_MODEL=deepseek-flash

    Official docs say deepseek-v4-flash, though I also believe I had to remove the -v4 part (at least it works with deepseek-flash), so this should be good.

    export COPILOT_MODEL=deepseek-v4-pro

    This overrides the previous line - you're not appending configurations, you're setting an environment variable for the session. Copilot CLI will be running v4 Pro after this.

  5. timomta commented on Oct 2, 2026

    @timomta

    I’m seeing what looks like the same BYOK custom request-shape failure, but against Azure OpenAI.

    Environment

    • GitHub Copilot CLI: 1.0.91
    • OS: Windows 11
    • Provider: Azure OpenAI
    • Azure deployment/model: gpt-4.1-mini
    • Model version: 2025-04-14
    • Deployment capabilities include:
      • chatCompletion=true
      • responses=true
      • agentsV2=true
      • assistants=true
    • Current deployment limits: 500k TPM / 500 RPM

    Env vars

    COPILOT_OFFLINE=true
    COPILOT_PROVIDER_TYPE=azure
    COPILOT_PROVIDER_BASE_URL=https://aoai-cnt-general-dev-va.openai.azure.us
    COPILOT_PROVIDER_API_KEY=<redacted>
    COPILOT_PROVIDER_MAX_PROMPT_TOKENS=128000
    COPILOT_PROVIDER_MAX_OUTPUT_TOKENS=4096
    COPILOT_PROVIDER_WIRE_API=completions
    COPILOT_PROVIDER_MODEL_ID=gpt-4
    COPILOT_PROVIDER_WIRE_MODEL=gpt-4.1-mini

    I also tested with COPILOT_MODEL=gpt-4.1-mini, and with COPILOT_PROVIDER_MODEL_ID=gpt-4o-mini plus COPILOT_PROVIDER_WIRE_MODEL=gpt-4.1-mini. All failed the same way.

    Symptom

    On the first prompt, Copilot CLI fails with:

    400 Invalid value: 'custom'.
    

    Debug log observations

    With --log-level all, the runtime logs show the model still being treated as custom/uncataloged even when COPILOT_PROVIDER_MODEL_ID is set:

    turn tool surface resolved {
      "model": "gpt-4.1-mini",
      "builtin_path": false,
      "model_config_enabled": false,
      "model_tool_calls_allowed": true,
      "tool_count": 17
    }

    The emitted wire request includes:

    {
      "model": "gpt-4.1-mini",
      "reasoning_effort": "medium",
      "temperature": 1,
      "stream_options": {
        "include_usage": true
      },
      "stream": true
    }

    The wire request did not include a top-level tools array in my captured log, but it did include this Copilot-specific field:

    "copilotToolsFingerprint": {
      "count": 17,
      "deferred": 0,
      "digest": "...",
      "canonicalDigest": "...",
      "tools": [...]
    }

    Immediately after connecting to the Azure OpenAI host, the log records model.call_failure.

    Why this seems related

    This issue reports a BYOK request being rejected because custom is being sent in a place the provider expects a standard OpenAI-compatible shape. My Azure case also fails with Invalid value: 'custom', and the logs suggest Copilot CLI continues to classify the model/provider path as custom despite the documented COPILOT_PROVIDER_MODEL_ID / COPILOT_PROVIDER_WIRE_MODEL split.

    It also looks related to the broader class of bugs where BYOK requests include model options unsupported by the target model/provider, e.g. reasoning_effort: "medium" being sent to non-reasoning models.

    Expected behavior

    For Azure BYOK with COPILOT_PROVIDER_MODEL_ID=gpt-4 and COPILOT_PROVIDER_WIRE_MODEL=gpt-4.1-mini, I would expect Copilot CLI to use the known model ID only for internal capability/profile selection and send an Azure-compatible chat-completions request to the wire model/deployment, without unsupported custom/tool/reasoning fields.

  6. added
    area:models
    and removed on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:models

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions