Skip to content

feat: support OpenAI-compatible endpoints via backends.openai.baseUrl - #17

Merged
vannt-dev merged 2 commits into
mainfrom
feat/openai-base-url
Oct 20, 2026
Merged

vannt-dev merged 2 commits into
mainfrom
feat/openai-base-url

Conversation

@vannt-dev

Copy link
Copy Markdown
Owner

Summary

The openai advisory backend can now talk to any OpenAI-compatible server: OpenRouter, Ollama,
LM Studio, Gemini's OpenAI endpoint, and similar.

  • New optional backends.openai.baseUrl (default stays https://api.openai.com/v1). Trailing
    slashes are ignored; it must be http(s) and may not contain credentials, a query or a fragment.
  • JUNTO_OPENAI_BASE_URL overrides it per machine/shell (follows the existing JUNTO_* naming;
    OPENAI_BASE_URL is not reused so other tools' settings don't silently redirect junto's calls).
  • The backend already uses Chat Completions (<baseUrl>/chat/completions), which these servers
    implement, so no API switch was needed.
  • Local servers: for a localhost, 127.0.0.1 or [::1] baseUrl the key is optional and no
    Authorization header is sent without one. Remote endpoints still require the key.
  • Responses without usage/model (some compatible servers) no longer throw; they count as 0 tokens.
  • Errors name the endpoint host, never the key. baseUrl on backends.anthropic is rejected.
  • README: new "OpenAI-compatible endpoints" section with OpenRouter, Ollama, LM Studio and Gemini.
  • CLAUDE.md "Current status" now describes the 0.6.2 release instead of 0.4.0.

Verification

  • pnpm typecheck passes; pnpm test: 396 passed, 4 skipped (new mocked-fetch tests for URL
    building, header omission, env override, loopback key rule, validation, schema).
  • pnpm build, rebuilt plugin/hooks and plugin/mcp committed;
    git diff --exit-code -- plugin/hooks plugin/mcp is clean.
  • No real endpoints or keys were used; manual testing against a real server is still to do.

The openai backend can now call any server that implements Chat Completions,
such as OpenRouter, Ollama, LM Studio or Gemini's OpenAI endpoint.

- backends.openai.baseUrl (http(s) only, no credentials, query or fragment);
  JUNTO_OPENAI_BASE_URL overrides it. The default stays api.openai.com.
- No key is needed for a localhost/127.0.0.1/[::1] baseUrl; no Authorization
  header is sent without one. Remote endpoints still require the key.
- Responses without usage or model no longer throw.
- README documents the four servers; CLAUDE.md status now describes 0.6.2.
@vannt-dev
vannt-dev merged commit db1a6a6 into main Oct 20, 2026
5 checks passed
@vannt-dev vannt-dev mentioned this pull request Oct 20, 2026
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