Skip to content

feat(agents): support AI gateway and OpenAI-compatible base-URL overrides (#253) - #279

Open
Clowraider wants to merge 1 commit into
cabinetai:mainfrom
Clowraider:feat/253-openai-gateway-overrides
Open

feat(agents): support AI gateway and OpenAI-compatible base-URL overrides (#253)#279
Clowraider wants to merge 1 commit into
cabinetai:mainfrom
Clowraider:feat/253-openai-gateway-overrides

Conversation

@Clowraider

Copy link
Copy Markdown

Summary

Implements Option A for #253, enabling users to point Cabinet's agent CLIs at AI gateways (OpenRouter, LiteLLM) or self-hosted OpenAI-compatible endpoints (vLLM, llama.cpp, custom proxies) directly from Settings.

What changed:

  1. Configuration & Persistence:

    • Extended ProviderSettings with customConfigs?: Record<string, CustomProviderConfig> (baseURL, apiKeyEnvVar) in provider-settings.ts and provider-management.ts.
    • API keys are stored securely in .cabinet.env.
  2. Runtime Environment Injection:

    • In withAdapterRuntimeEnv, provider-runtime.ts, and server/pty/manager.ts, automatically inject OPENAI_BASE_URL & OPENAI_API_KEY (or ANTHROPIC_* for Claude) from provider settings and .cabinet.env into spawned CLI processes.
  3. Dynamic HTTP Model Discovery:

    • GET /api/agents/providers/[id]/models now queries ${baseURL}/models via HTTP when a custom baseURL is set, returning live gateway models to the composer and model combobox with 60s caching and ?refresh=1 support.
  4. Settings UI:

    • Added GatewayCustomConfig in Settings -> Providers and in the provider setup dialog, with live model discovery, "Test & Discover Models", and a default model selector.
  5. Fixes & Hardening:

    • Repaired getDaemonUrl() to normalize ws:///wss:// schemes to http:///https:// during internal HTTP daemon health checks.

Verification:

  • npm test passing 100% (411/411 unit tests).
  • Verified live end-to-end against an OpenAI-compatible gateway with custom models.

…ides (cabinetai#253)

- Add customConfigs to ProviderSettings for base-URL and API key overrides
- Inject OPENAI_BASE_URL/OPENAI_API_KEY and ANTHROPIC_* into CLI runtime env
- Add dynamic HTTP model discovery against /v1/models in providers API
- Add GatewayCustomConfig UI section in Settings -> Providers and setup dialog
- Fix daemon URL normalization for HTTP health checks when public WS is set
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