Skip to content

AI provider configuration: bring your own key and endpoint, off by default #402

Open

Description

@imshashank

Current status, September 22

Implementation is open in #448. The remaining review finding is that cancelling a compressed response leaves the upstream HTTP connection open; fix and test that before merge. This provider is required by in-app inference features such as #216, while external MCP agent identity and sessions in #215 and #404 do not require an Orbit-configured model.

Original requirements

Every AI feature Orbit has discussed (#215, #216, #217) assumes an admin can point the workspace at an inference provider. Nothing does that today: there is no provider setting, no key, no endpoint, and no outbound call to any model anywhere in the repository. That is correct as a default, and it is also why none of those issues can start.

This issue is the prerequisite. It carries the rules that used to live in the AI epic (#214), because they apply to every consumer:

  • Off by default. With nothing configured the affordances are absent, not broken, the same way integrations already behave.
  • Bring your own key and your own endpoint. OpenAI-compatible chat completions as the first shape, so a local endpoint works. Anthropic native as the second.
  • Nothing leaves without consent. The settings page says plainly what is sent (issue titles, descriptions, comments) and where. Sending is a workspace decision an admin makes explicitly.
  • The output is a suggestion. Nothing a model produces is applied without a person accepting it.

What to build

  • A provider row per workspace: kind, base URL, model, an encrypted key. integration may fit if the provider is treated as one more integration; say which in the design comment.
  • A client in packages/services/src/ai/ with one complete(prompt, options) entry point, a bounded timeout, and no retries by default.
  • A settings surface under apps/web/src/app/(app)/settings/ limited to admins through packages/shared/src/policy, with a "test connection" action.
  • Usage counting per workspace (calls, tokens where the provider reports them), shown on the same page, because a feature with an invoice attached needs to be visible.
  • A capability check the rest of the app reads: aiEnabled(principal) false means no AI affordance renders anywhere.

Not in scope

Any feature that uses the provider. Those are #216 (triage suggestions) and the summary work that will reopen when this lands.

Tests

Provider off means no affordance and no outbound request. Provider on with a failing endpoint degrades to the same state with a visible error for admins only. The key never appears in a log line, an error payload, or a realtime event.

Activity

  1. added
    enhancement
    help wanted
    needs design
    p1 high
    area: ai
    size: large
    points: 8
    on Sep 6, 2026
  2. Pallavikumarimdb commented on Sep 6, 2026

    @Pallavikumarimdb
    Contributor

    @imshashank I’m taking this one. I’ll post updates here

  3. imshashank commented on Sep 7, 2026

    @imshashank
    ContributorAuthor

    @Pallavikumarimdb thanks, it is yours. It is labelled needs design on purpose, so before code please post a short comment here with three things: the storage shape (a row on integration versus its own table, and how the key is encrypted at rest), the client boundary in packages/services/src/ai/ with its one entry point and timeout, and how aiEnabled(principal) is exposed so every consumer reads one check. Once that is agreed the implementation is straightforward. You also have #394 and #428 in flight, so take them in whatever order suits you; none of the three blocks another.

  4. Pallavikumarimdb commented on Sep 7, 2026

    @Pallavikumarimdb
    Contributor

    @imshashank Thanks! I’ll take them in the order that makes the most sense.

    Design proposal

    I’ve looked at the existing patterns and my proposed approach is:

    1. Storage & Encryption

      • Reuse the existing integration model (provider: 'ai', externalId: 'default') for the workspace AI provider rather than introducing a separate table.
      • Store provider configuration separately from credentials, with the API key encrypted at rest using AES-256-GCM with HKDF key derivation from BETTER_AUTH_SECRET and per-tenant authenticated data.
      • Keep decrypted keys server-side only; keys are never returned to the client or leaked in logs/errors.
    2. AI client boundary

      • Add packages/services/src/ai/ with a single entry point: completePrompt(options).
      • Hides provider-specific details behind a common interface, supporting both OpenAI-compatible endpoints and Anthropic.
      • Requests use a bounded timeout (15s default, 1s–60s range) and no retries by default.
      • Redacts API keys from error messages and logs.
    3. Capability check

      • Expose a centralized aiEnabled(principal) capability check from packages/services/src/ai/capability.ts.
      • Returns false by default when no valid AI provider is configured/enabled, so consumers can consistently check AI availability.
      • AI provider configuration in settings remains admin-only.

    If this direction looks good, I’ll proceed with the PR for review.

  5. added
    work in progress
    schema change
    and removed
    help wanted
    needs design
    on Sep 22, 2026
  6. github-actions commented on Nov 22, 2026

    @github-actions

    This issue has had no activity for 60 days, so it is being marked stale.

    If it still matters, say so and it stays open. Adding what you have
    learned since filing it helps more than a bump on its own. Otherwise it
    will close in 14 days, and closing is not a judgement, it just keeps the
    list honest about what is actually being worked on. Reopening is always
    fine.

  7. added
    stale
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area: aienhancementp1 highpoints: 8schema changesize: largestalework in progress

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions