Skip to content

Add OPENAI_BASE_URL environment variable support#176

Merged
tnm merged 2 commits intomainfrom
openai-base-url-env-var
Jan 5, 2026
Merged

Add OPENAI_BASE_URL environment variable support#176
tnm merged 2 commits intomainfrom
openai-base-url-env-var

Conversation

@tnm
Copy link
Contributor

@tnm tnm commented Jan 5, 2026

Summary

Adds support for the OPENAI_BASE_URL environment variable, allowing users to configure custom OpenAI API endpoints for use with:

  • Internal enterprise proxies
  • API gateways
  • OpenAI-compatible providers (OpenRouter, Grok, Together AI, etc.)

This addresses the need for organizations with internal proxy URLs to access OpenAI models through Kit's MCP server.

Changes

  • OpenAIConfig.base_url now reads from OPENAI_BASE_URL env var by default
  • Works automatically with MCP server and all Kit LLM features
  • Added 2 tests for env var configuration
  • Documentation updates:
    • README: Brief mention in MCP section
    • MCP docs: Added to Cursor and Claude Desktop examples
    • LLM configuration: New "Enterprise Proxies & Custom Endpoints" section

Usage

export OPENAI_API_KEY="your-key"
export OPENAI_BASE_URL="https://your-proxy.company.com/v1"

Or in MCP config:

{
  "mcpServers": {
    "kit-dev-mcp": {
      "command": "uvx",
      "args": ["--from", "cased-kit", "kit-dev-mcp"],
      "env": {
        "OPENAI_API_KEY": "your-key",
        "OPENAI_BASE_URL": "https://your-proxy.company.com/v1"
      }
    }
  }
}

Test plan

  • Unit tests for env var reading
  • Existing tests pass
  • Manual test with custom endpoint

tnm added 2 commits January 5, 2026 12:56
Allow users to configure custom OpenAI API endpoints via the
OPENAI_BASE_URL environment variable, enabling use with internal
proxies, enterprise gateways, and OpenAI-compatible providers.

- OpenAIConfig now reads base_url from OPENAI_BASE_URL env var
- Works automatically with MCP server and all kit LLM features
- Added tests for env var configuration
- Updated docs: README, MCP server docs, LLM configuration guide
@tnm tnm merged commit 365e4fc into main Jan 5, 2026
2 checks passed
tnm added a commit that referenced this pull request Jan 5, 2026
- Add OPENAI_BASE_URL environment variable support (#176)
tnm added a commit that referenced this pull request Jan 5, 2026
- Add OPENAI_BASE_URL environment variable support (#176)
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.

1 participant