Skip to content

Spec OpenAI-compatible BYOK endpoints - #9620

Open
kenrogers wants to merge 2 commits into
warpdotdev:masterfrom
kenrogers:ken/openai-compatible-byok-spec
Open

kenrogers wants to merge 2 commits into
warpdotdev:masterfrom
kenrogers:ken/openai-compatible-byok-spec

Conversation

@kenrogers

@kenrogers kenrogers commented Apr 30, 2026 •

Copy link
Copy Markdown

Description

Adds a draft product spec and tech spec for issue #4687: a generic OpenAI-compatible BYOK endpoint flow.

The spec frames OpenRouter as the proof case, but keeps the proposed implementation generic: provider label, base URL, API key, and model ID. That avoids a one-off provider button while still making OpenRouter, LiteLLM/internal proxies, and local OpenAI-compatible gateways possible through the same surface.

It also calls out how this relates to #9253: OpenRouter-specific BYOK is useful partial progress, but the broader issue still needs custom endpoint/model metadata instead of relying only on server-approved model choices.

Linked Issue

Fixes #4687 after approval and implementation.

  • The linked issue is labeled ready-to-spec or ready-to-implement.

Note: #4687 is currently enhancement/triaged but not ready-to-spec. I am opening this as a draft spec PR to give maintainers a concrete scope to accept, edit, or reject before any code implementation.

Screenshots / Videos

Not applicable; spec-only PR.

Testing

  • git diff --cached --check
  • git show --check --stat --oneline HEAD

No runtime tests were run because this PR only adds Markdown specs and does not change application code.

@cla-bot

cla-bot Bot commented Apr 30, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @kenrogers on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment @cla-bot check to trigger another check.

@kenrogers

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label Apr 30, 2026
@cla-bot

cla-bot Bot commented Apr 30, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@kenrogers
kenrogers marked this pull request as ready for review April 30, 2026 16:42
@warp-for-oss

warp-for-oss Bot commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

@kenrogers

I'm starting a first review of this spec-only pull request.

You can view the conversation on Warp.

I completed the review and posted feedback on this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss warp-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR adds product and tech specs for a generic OpenAI-compatible BYOK endpoint flow, including Settings > AI configuration, synthetic model picker entries, and request-time endpoint metadata.

Concerns

  • The specs promise local OpenAI-compatible servers while preserving the current backend-routed BYOK architecture, which makes localhost/private endpoints ambiguous or unreachable.
  • Backend routing to arbitrary user-provided URLs needs explicit SSRF/egress controls, redirect/DNS rebinding handling, timeouts, and secret redaction rules.
  • The tech spec is ambiguous about clearing stored endpoint config when BYOK becomes disabled, which conflicts with the product spec's non-destructive gating behavior.
  • The backend request contract remains unresolved enough to block implementation handoff.

Verdict

Found: 2 critical, 2 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread specs/GH4687/product.md Outdated

## Summary

Users should be able to configure a custom OpenAI-compatible model endpoint for Warp Agent by entering a provider label, base URL, API key, and model ID. This gives users a narrow, predictable way to use OpenRouter, LiteLLM, internal OpenAI-compatible gateways, and local OpenAI-compatible servers without requiring Warp to add a bespoke provider integration for each one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 [CRITICAL] This promises local OpenAI-compatible servers, but the tech flow sends endpoint metadata to Warp's backend; localhost would resolve from the backend, not the user's machine. Specify client-side/local routing for local endpoints or remove local servers from the first-version scope.

Comment thread specs/GH4687/tech.md

Validation:

- Parse base URL with `url::Url`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 [CRITICAL] Syntax-only URL validation is not enough for a backend-routed arbitrary endpoint. The spec needs server-side egress rules for private/link-local/metadata IPs, redirects, DNS rebinding, timeouts, and redaction of the URL/API key from logs before implementation.

Comment thread specs/GH4687/tech.md Outdated

- On blur or Enter, persist the full config via `ApiKeyManager`.
- Empty base URL, API key, or model ID keeps the config incomplete.
- If BYOK is disabled for the workspace, clear/disable the endpoint editors using the same `UserWorkspacesEvent::TeamsChanged` handling as the fixed provider key fields.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] clear/disable conflicts with the product spec's non-destructive gating. Specify that BYOK-disabled workspaces preserve the stored custom endpoint but disable editing/selection unless the user explicitly deletes it.

Comment thread specs/GH4687/product.md Outdated
## Open questions

1. Should the first implementation support exactly one custom endpoint, or should the persistence shape support a list immediately while the UI initially exposes one?
2. Should custom endpoint metadata live in the existing `api_keys` request payload or a distinct `custom_model_endpoint` request field?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] The request contract is still an open question even though implementation depends on it. Resolve whether endpoint metadata is a distinct request field or part of ApiKeys, including versioning/backward compatibility with the backend.

@captainsafia captainsafia added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label Apr 30, 2026 — with Warp Agent Staging
@kenrogers

Copy link
Copy Markdown
Author

/oz-review

@warp-for-oss

warp-for-oss Bot commented May 1, 2026 •

Copy link
Copy Markdown
Contributor

@kenrogers

I'm re-reviewing this spec-only pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss warp-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR adds product and technical specs for a generic OpenAI-compatible BYOK endpoint flow. The specs cover the main UX, request-routing shape, validation expectations, testing plan, and several backend SSRF mitigations.

Concerns

  • The spec leaves arbitrary custom endpoint use governed only by the existing BYOK gate, without defining whether enterprise/workspace admins can disable or restrict user-supplied endpoint domains even though agent context can leave Warp for an arbitrary third party.
  • Custom model identity is not specified firmly enough; treating a stable prefix or marker as optional can collide with server-provided model IDs and make routing/selection ambiguous.
  • Execution profile behavior is underspecified when the custom endpoint is edited, made incomplete, or deleted after selection.

Security

  • Arbitrary endpoint egress expands the data-exfiltration trust boundary beyond fixed BYOK providers; the spec should define the admin policy/control surface before implementation.
  • The request payload carries a user API key to the backend; the spec should explicitly state request-scoped handling and no server-side persistence.

Verdict

Found: 0 critical, 3 important, 1 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread specs/GH4687/product.md
3. Supporting `localhost`, private-network, link-local, or otherwise client-local model endpoints in the first version. Those require a separate client-side/local routing design because backend-routed requests cannot reach the user's machine as `localhost`.
4. Supporting non-OpenAI-compatible protocols in this feature.
5. Guaranteeing every model behind a compatible endpoint supports all Warp Agent tools.
6. Changing the paid plan or workspace policy that gates BYOK access.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] [SECURITY] Treating workspace policy as unchanged leaves arbitrary endpoint egress governed only by the existing BYOK gate; specify whether admins can disallow custom endpoints or restrict allowed domains because prompts and terminal context can be sent to user-supplied third parties.

Comment thread specs/GH4687/product.md
4. Base URL validation is lightweight and user-facing in the client: the value must parse as an absolute `https` URL and must not use obvious local/private hosts such as `localhost` or loopback IPs. Warp does not perform a network validation request when the user saves the setting; the backend performs the authoritative egress validation before routing any request.
5. API key input uses the same password-style treatment as existing BYOK provider key fields.
6. The saved custom model appears in the existing model picker using the configured label and model ID. A key icon or equivalent BYOK affordance should make clear that it is billed to the user's endpoint credentials.
7. Selecting the custom model persists through the same execution profile mechanism as other model choices.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] Define what happens when a selected custom endpoint is edited, made incomplete, or deleted; otherwise execution profiles can persist a synthetic model selection whose routing behavior is unspecified.

Comment thread specs/GH4687/tech.md

Recommended shape:

- `id`: the configured model ID, preferably with a stable custom prefix if the backend needs to distinguish custom endpoint models from server-known models.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] Make the custom model identity requirement deterministic rather than optional; without a required stable prefix or separate custom marker, model IDs can collide with server-provided IDs and route requests through the wrong path.

Comment thread specs/GH4687/tech.md

The selected model ID alone is not enough; the request layer must also know base URL and API key. Use a distinct request settings field instead of overloading fixed provider API keys.

Add an optional `custom_model_endpoint` payload to the agent request settings:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 [SUGGESTION] [SECURITY] Add request-scoped secret handling for this payload: the backend should not persist the custom API key, and deletion or rotation should be driven only by the local secure-storage config.

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

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow users to specify the LLM endpoint (APIs) for other models

2 participants