[FEATURE]: Add BYOK (Bring Your Own Key) Support in Claude Code for OpenAI, Gemini, OpenRouter, Azure OpenAI, and Other AI Providers

Open 💬 2 comments Opened Jun 16, 2026 by bloodykheeng

Title

Claude Code: Add BYOK (Bring Your Own Key) Support to Claude Code for OpenAI, Gemini, OpenRouter, Azure OpenAI, and Other AI Providers

Description

Summary

Please add BYOK (Bring Your Own Key) support to Claude Code so users can connect their own API keys and use models from other AI providers while continuing to use the Claude Code interface and workflow.

Supported providers could include:

  • Anthropic (custom API key)
  • OpenAI
  • Google Gemini
  • OpenRouter
  • Azure OpenAI
  • Ollama
  • LM Studio
  • Other OpenAI-compatible APIs
  • Self-hosted model endpoints

Problem

Claude Code currently only supports Anthropic-hosted models. While Claude models are excellent, many developers and organizations already have subscriptions, credits, or infrastructure built around other providers.

This creates several challenges:

  • Developers cannot use Claude Code as a single interface for all coding models.
  • Organizations with existing OpenAI, Gemini, or Azure AI budgets cannot leverage them within Claude Code.
  • Users must constantly switch between multiple tools and extensions depending on which model they want to use.
  • There is no straightforward way to compare model outputs inside the same workflow.
  • Users who have already purchased API credits elsewhere must pay for an additional AI service to use Claude Code.

Proposed Solution

Introduce a Bring Your Own Key (BYOK) configuration system that allows users to configure one or more AI providers.

Example settings:

{
  "providers": {
    "anthropic": {
      "apiKey": "YOUR_API_KEY"
    },
    "openai": {
      "apiKey": "YOUR_API_KEY"
    },
    "gemini": {
      "apiKey": "YOUR_API_KEY"
    },
    "openrouter": {
      "apiKey": "YOUR_API_KEY"
    }
  },
  "defaultProvider": "openai",
  "defaultModel": "gpt-5"
}

Desired Features

Provider Selection

Allow users to choose:

  • Anthropic
  • OpenAI
  • Gemini
  • OpenRouter
  • Azure OpenAI
  • Ollama
  • LM Studio
  • Custom/OpenAI-compatible endpoint

Model Selection

Allow users to select models such as:

  • Claude models
  • GPT models
  • Gemini models
  • Open-source models exposed through OpenRouter
  • Local models running through Ollama or LM Studio

Workspace-Level Configuration

Support:

  • Global default provider
  • Per-workspace provider settings
  • Per-project model selection

This would be especially useful for organizations that standardize on different AI providers for different projects.

Custom Endpoints

Allow users to specify:

{
  "provider": "custom",
  "baseUrl": "https://api.example.com/v1",
  "apiKey": "YOUR_API_KEY"
}

This would enable support for:

  • Self-hosted models
  • Enterprise gateways
  • OpenAI-compatible APIs
  • Internal company AI infrastructure

Secure Credential Storage

Store API keys securely using:

  • Windows Credential Manager
  • macOS Keychain
  • Linux Secret Service / Keyring

instead of plain-text storage wherever possible.

Benefits

For Developers

  • One coding interface for all major AI providers.
  • Easier experimentation and model comparison.
  • Ability to use existing API credits.
  • Reduced context switching between tools.

For Teams

  • Better alignment with company AI policies.
  • Ability to use approved enterprise providers.
  • Easier migration between model vendors.

For Claude Code

  • Increased adoption among developers.
  • Reduced vendor lock-in concerns.
  • More attractive for enterprise customers.
  • Ability to become a best-in-class AI coding interface regardless of model provider.

Example Use Cases

Use Case 1

A developer wants:

  • Claude Opus for architecture discussions.
  • GPT-5 for code generation.
  • Gemini for large-context analysis.

All within Claude Code.

Use Case 2

A company already spends thousands of dollars monthly on Azure OpenAI and wants developers to use Claude Code as the coding interface without purchasing additional subscriptions.

Use Case 3

A user runs local models through Ollama and wants to use them for routine coding tasks while reserving premium cloud models for more complex work.

Use Case 4

A developer uses OpenRouter to access multiple providers and wants Claude Code to work with their existing OpenRouter API key.

Why This Matters

Claude Code has one of the best AI-assisted development experiences available today. Adding BYOK support would make it significantly more flexible and accessible by allowing developers to use the models and providers that best fit their requirements, budgets, and organizational constraints.

This feature would position Claude Code as a leading AI development environment rather than a tool limited to a single provider ecosystem.

Additional Notes

This request is not about replacing Claude models. Claude should remain the default and first-class experience.

The goal is to give developers the flexibility to choose the provider and model that best suits their workflow while continuing to benefit from Claude Code's excellent tooling, terminal integration, workflow automation, and developer experience.

Thank you for considering this feature request.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗