Repository navigation
Closed
Description
Summary
Maka already has most of the runtime primitives needed for custom relay / aggregator usage: model connections store a baseUrl, IPC validates http/https service URLs, and many ready providers use OpenAI-compatible adapters. In practice, the first-run UX still makes relay usage hard:
- the Models page asks users to pick a named provider first, so “I have a custom OpenAI-compatible relay URL + key” is not obvious;
- providers with a default
baseUrlopen the quick API-key dialog, hiding the service URL field even though relay users need to override it; - there is no cc-switch-style “provider profile” affordance that treats endpoint + key + model + protocol as one reusable configuration;
- new users looking for a中转站/relay入口 have to know implementation details such as which built-in provider is OpenAI-compatible and where to edit the endpoint after creation.
Reference: cc-switch behavior to borrow, not blindly clone
I inspected farion1231/cc-switch and SaladDay/cc-switch-cli before filing this. Relevant patterns:
- Provider profiles are the primary object: users add/list/switch providers rather than manually editing hidden config files.
- The provider form exposes endpoint, API key, model, and API format as explicit fields; presets seed common providers but do not hide custom endpoint setup.
- Provider switching is operationally simple (
provider list,provider switch,use <id>,start <app> <id>), while storage stays separate from live app config. - cc-switch differentiates protocol/API format (
anthropic, OpenAI Chat, OpenAI Responses, Gemini Native) because relays often need a route/transform layer. - It also offers model fetch / speed or stream checks as provider-profile actions.
For Maka, the right first step is smaller: keep Maka's existing connection store and permission/security boundaries, but make relay setup obvious and first-class in the Models UI.
Proposed first slice
Add a first-class “Custom relay / OpenAI-compatible” entry to the Models provider catalog:
- Surface it in Recommended and/or Aggregators so a first-time user can find it without searching for a named vendor.
- Open the full provider form, not the quick API-key-only dialog.
- Require a service URL and API key; seed a safe default model placeholder or let the user enter the model before connecting.
- Label the UX in Chinese/English as “自定义中转站 / Custom relay” and explain examples such as OpenAI-compatible relay, OpenRouter-like gateways, self-hosted LiteLLM/vLLM, etc.
- After creation, keep existing behavior: test connection, fetch models, choose enabled models, set default.
- Preserve existing IPC validation: only
http:/https:URLs, no renderer secret exposure, no OAuth provider baseUrl overrides.
Non-goals for the first PR
- Do not add a local proxy/router like cc-switch.
- Do not write external Claude/Codex/Hermes config files.
- Do not implement multi-protocol transforms in this slice.
- Do not change existing named providers' runtime adapters.
- Do not auto-import cc-switch profiles yet.
Follow-ups
- Add Anthropic-compatible custom relay profile if the runtime supports enough protocol metadata.
- Add provider-profile import/export or cc-switch import.
- Add speed/stream health check beyond the current connection test.
- Allow an explicit protocol selector when Maka can route OpenAI Chat vs Responses vs Anthropic safely.
Acceptance criteria
- A fresh user can open Settings → Models and find a clearly labeled Custom relay entry.
- Creating the connection requires entering service URL + API key in one dialog.
- The resulting connection persists
providerType,baseUrl, credential, default model, and enabled model ids through the existing store. - Existing named providers and OAuth account flows are unchanged.
- Focused tests cover the catalog entry and creation payload.
Metadata
Metadata
Assignees
Labels
No labels
Activity
zly-idleness commentedon Jul 22, 2026
Follow-up clarification after comparing the current Maka runtime seams with cc-switch more closely:
connections:fetchModelscallsfetchProviderModels, reads the provider's model endpoint, persistsmodels / modelSource / modelsFetchedAt, and the Models detail UI renders those entries. The first PR should use that path automatically after a custom relay connection is created, so users do not have to find the manual “Update model catalog” action before seeing models.openai-compatibleprovider is OpenAI Chat Completions compatible, not OpenAI Responses. Runtime currently usescreateOpenAICompatible(...).chatModel(modelId)for this adapter. The issue/PR should not describe it as Responses.createOpenAI({ baseURL }).responses(modelId)), because it is not the same wire protocol as@ai-sdk/openai-compatible().chatModel()./v1/modelsdiscovery path. It should not be hidden behind the OpenAI-compatible profile; cc-switch'sapiFormatsplit is the right conceptual model.Revised first PR scope: expose and improve the existing Custom OpenAI Chat-compatible relay setup, auto-fetch models after creation, and label the protocol clearly. Follow-ups: Custom Anthropic-compatible relay and Custom OpenAI Responses relay / protocol selector.
zly-idleness commentedon Jul 22, 2026
Scope update from PR #1340 after validating the implementation path:
The custom relay work is now intentionally split into three first-class provider/protocol entries rather than one overloaded generic OpenAI-compatible path:
openai-compatible— Custom relay (OpenAI Chat), using the OpenAI Chat Completions-compatible adapter.openai-responses-compatible— Custom relay (OpenAI Responses), using the OpenAI Responses wire explicitly.anthropic-compatible— Custom relay (Anthropic), using the Anthropic Messages wire explicitly.This keeps the protocol selector visible to the user, matches the cc-switch-style profile model, and avoids presenting OpenAI Responses or Anthropic-compatible relays as if they were the existing OpenAI Chat-compatible path.
PR #1340 also gates automatic model discovery to custom relays only and requires a default model id until the detail screen has a separate manual model-entry recovery path.
feat(models): surface custom relay setup (#1340)
Astro-Han commentedon Jul 23, 2026
Closing: all acceptance criteria are met by #1340 (merged), which also covered two of the follow-ups: the Anthropic-compatible relay and the protocol split (OpenAI Chat / OpenAI Responses / Anthropic as separate first-class entries).
Remaining follow-ups, not blocking this issue, to be filed separately if needed: