Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 30, 2025

This PR adds support for custom API endpoints to the OpenAI provider, allowing users to connect to OpenAI-compatible APIs such as Azure OpenAI, local LLM servers (Ollama, LM Studio), or other hosted services.

Changes Made

Configuration Enhancement:

  • Added base_url field to the ProviderConfig struct
  • Extended config management with GetBaseURL() and SetBaseURL() functions
  • Updated YAML configuration to support the new base_url parameter

Provider Updates:

  • Enhanced OpenAIProvider with NewOpenAIProviderWithBaseURL() function
  • Maintains backward compatibility with existing NewOpenAIProvider() function
  • Custom base URL is passed through to the OpenAI client when specified

CLI Improvements:

  • Interactive config (lazycommit config set) now prompts for custom base URL when using OpenAI provider
  • lazycommit config get displays the configured base URL when set
  • Fixed missing openrouter case in the commit command

Documentation:

  • Updated README with configuration examples for Azure OpenAI and local servers
  • Added dedicated "Custom Endpoints" section with practical examples
  • Clarified that OpenAI provider supports custom endpoints via base_url

Usage Examples

Azure OpenAI:

providers:
  openai:
    api_key: "$AZURE_OPENAI_API_KEY"
    model: "gpt-4"
    base_url: "https://your-resource.openai.azure.com/openai/deployments/your-deployment/chat/completions"

Local LLM Server:

providers:
  openai:
    api_key: "dummy-key"
    model: "llama2"
    base_url: "http://localhost:11434/v1"

The feature maintains full backward compatibility - existing configurations continue to work unchanged, and the base URL is optional.

Fixes #17.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] Custom endpoint? Add custom endpoint support for OpenAI-compatible APIs Aug 30, 2025
@Copilot Copilot AI requested a review from m7medVision August 30, 2025 19:23
Copilot finished work on behalf of m7medVision August 30, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom endpoint?
2 participants