Skip to content

AI: user-defined OpenAI-compatible provider (custom base URL) #241

Description

@remcostoeten

Seven of the eleven providers are already just CompatSpec consts in apps/desktop/src-tauri/src/database/services/ai/compat.rs (OpenAI, Groq, DeepSeek, Kimi, GLM, Qwen, OpenRouter) — base URL, model list URL and sampling defaults, no client code. The natural next step is to let a user supply that spec themselves instead of waiting on a release to add their endpoint.

Covers: self-hosted vLLM / llama.cpp / LM Studio / TGI, Together, Fireworks, Cerebras, Azure OpenAI deployments, corporate gateways.

Proposed work:

  • New AIProvider::Custom arm whose spec is read from settings rather than a const: base URL, optional models URL, default model, temperature.
  • Store the key through the existing key pool (key_pool.rs) under a CUSTOM prefix so rotation and ai_keys_test_provider work unchanged.
  • build_client returns OpenAiCompatClient with the runtime spec — no new client type.
  • Frontend: a "Custom (OpenAI-compatible)" entry in PROVIDER_OPTIONS (ai-provider-section.tsx) that reveals base-URL and model fields; reuse the existing key-test button for validation.
  • Model list: fall back to free-text model entry when the endpoint has no /models.
  • Usage pricing (usage.rs) has no rates for a custom endpoint — record tokens, show cost as unknown.

Depends on nothing; this is mostly config plumbing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions