Skip to content

Feature Request: Support OpenAI-compatible base URL override (OPENAI_BASE_URL) for custom/local model routing #2283

@AeonDave

Description

@AeonDave

Describe the feature or problem you'd like to solve

Copilot CLI cannot be routed through OpenAI-compatible proxies (e.g., headroom, LiteLLM, Ollama) because it uses proprietary GitHub endpoints and ignores standard environment variables like OPENAI_BASE_URL. This prevents use with local/self-hosted models and breaks interoperability with existing AI tooling ecosystems that rely on OpenAI-compatible APIs. HTTPS_PROXY does not reliably intercept model traffic, so there is currently no clean way to redirect requests.

Proposed solution

Add support for an environment variable such as OPENAI_BASE_URL or COPILOT_BASE_URL to override the default API endpoint. When set, Copilot CLI should send model requests to the specified base URL using an OpenAI-compatible schema, while optionally preserving GitHub authentication where needed.

Benefits:

  • Enables integration with local models (Ollama, LM Studio)
  • Allows use of proxy layers (headroom, LiteLLM)
  • Improves privacy and offline capabilities
  • Aligns Copilot CLI with the broader OpenAI-compatible ecosystem

Example prompts or workflows

  1. Route Copilot CLI through a local model:

OPENAI_BASE_URL=http://localhost:11434/v1 -> copilot "explain this function"

  1. Use headroom for request routing and logging:

OPENAI_BASE_URL=http://localhost:8000/v1 -> copilot "refactor this code"

  1. Switch between providers dynamically:

OPENAI_BASE_URL=https://api.custom-llm.com/v1 -> copilot "generate tests"

  1. Offline development workflow:

Run Copilot CLI fully against a local LLM without external API calls

Additional context

  • Current behavior bypasses OPENAI_BASE_URL entirely
  • HTTPS_PROXY does not intercept model requests (verified: zero traffic observed in proxy tools like headroom)
  • Other tools (Aider, Cursor, Claude Code) already support this pattern
  • Similar feature requests exist in related Copilot ecosystems but not yet addressed in CLI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions