Skip to content

feat: add OpenAI-compatible provider for local LLMs and custom APIs#73

Open
d33pstatetech-stack wants to merge 2 commits intoviperrcrypto:mainfrom
d33pstatetech-stack:feat/openai-compatible-provider
Open

feat: add OpenAI-compatible provider for local LLMs and custom APIs#73
d33pstatetech-stack wants to merge 2 commits intoviperrcrypto:mainfrom
d33pstatetech-stack:feat/openai-compatible-provider

Conversation

@d33pstatetech-stack
Copy link
Copy Markdown

Add a new 'Custom (OpenAI-Compatible)' provider option that supports any service implementing the OpenAI chat completions API:

  • Local LLMs: Ollama, llama.cpp, vLLM, LM Studio, LocalAI
  • Cloud APIs: Together AI, Groq, Fireworks, Deepseek, Mistral, etc.

Changes:

  • lib/openai-compatible-auth.ts: New auth module (flexible base URL, optional API key)
  • lib/ai-client.ts: OpenAICompatibleClient class, updated AIProviderType
  • lib/settings.ts: New provider type, free-form model getter
  • app/api/settings/route.ts: CRUD for base URL, model name, API key
  • app/api/settings/test/route.ts: Connection test with friendly errors
  • app/settings/page.tsx: New provider tab with config UI and test button
  • .env.example: Documented new env vars with common endpoint examples

Summary

Changes

Related Issues

Checklist

  • Tested locally
  • npx tsc --noEmit passes
  • No new warnings

Add a new 'Custom (OpenAI-Compatible)' provider option that supports
any service implementing the OpenAI chat completions API:

- Local LLMs: Ollama, llama.cpp, vLLM, LM Studio, LocalAI
- Cloud APIs: Together AI, Groq, Fireworks, Deepseek, Mistral, etc.

Changes:
- lib/openai-compatible-auth.ts: New auth module (flexible base URL, optional API key)
- lib/ai-client.ts: OpenAICompatibleClient class, updated AIProviderType
- lib/settings.ts: New provider type, free-form model getter
- app/api/settings/route.ts: CRUD for base URL, model name, API key
- app/api/settings/test/route.ts: Connection test with friendly errors
- app/settings/page.tsx: New provider tab with config UI and test button
- .env.example: Documented new env vars with common endpoint examples
…ble input types

Address Codex review feedback:
- Render the 'Custom' button in ProviderToggle so users can actually
  switch to the openai_compatible provider from the UI
- Add typeof string checks on openaiCompatibleModel, openaiCompatibleBaseUrl,
  and openaiCompatibleApiKey before calling .trim(), matching the pattern
  used by the existing key handlers to return 400 instead of 500 on
  malformed payloads
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