Skip to content

feat: universal llm support via envelope router#2

Merged
Gerifield merged 4 commits into
mainfrom
feat/universal-llm-envelope-router-8897171277856875599
Apr 27, 2026
Merged

feat: universal llm support via envelope router#2
Gerifield merged 4 commits into
mainfrom
feat/universal-llm-envelope-router-8897171277856875599

Conversation

@Gerifield
Copy link
Copy Markdown
Owner

Adds support for routing requests to generic OpenAI-compatible APIs, Anthropic's OpenAI-compatible APIs, and the native Gemini APIs by dynamically rewriting the URL and authorization headers. Includes a fail-fast mode (via -openai flag) to prevent incompatible requests from causing bad fallbacks.


PR created automatically by Jules for task 8897171277856875599 started by @Gerifield

- Add `Type` and `BaseURL` fields to `Backend` struct.
- Provide a set of default `BaseURLs` (OpenAI, Anthropic, Gemini OpenAI wrapper).
- Add `-openai` CLI flag to separate pure native Gemini failover vs OpenAI-compatible failover, filtering configs appropriately.
- Intercept HTTP requests to dynamically replace target URL and headers based on `Backend.Type` (e.g. Setting Authorization or x-api-key headers, and stripping redundant `/v1` from incoming paths).
- Update config test to support `-openai` boolean.

Co-authored-by: Gerifield <195914+Gerifield@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

- Add `Type` and `BaseURL` fields to `Backend` struct.
- Provide a set of default `BaseURLs` (OpenAI, Anthropic, Gemini OpenAI wrapper).
- Add `-openai` CLI flag to separate pure native Gemini failover vs OpenAI-compatible failover, filtering configs appropriately.
- Intercept HTTP requests to dynamically replace target URL and headers based on `Backend.Type` (e.g. Setting Authorization or x-api-key headers, and stripping redundant `/v1` from incoming paths).
- Update config test to support `-openai` boolean and add mixed config test suite.

Co-authored-by: Gerifield <195914+Gerifield@users.noreply.github.com>
@Gerifield
Copy link
Copy Markdown
Owner Author

@jules update the readme as well

@google-labs-jules
Copy link
Copy Markdown
Contributor

@jules update the readme as well

I have updated the README.md to include instructions and examples for the new -openai flag, the new type field, and the supported backend variants.

google-labs-jules Bot and others added 2 commits April 26, 2026 21:14
- Document `-openai` flag behavior and the rationale for payload segregation.
- Add example `config.yaml` entries for `openai`, `anthropic`, and `custom_openai` backend types.

Co-authored-by: Gerifield <195914+Gerifield@users.noreply.github.com>
@Gerifield Gerifield merged commit 5afde38 into main Apr 27, 2026
1 check passed
@Gerifield Gerifield deleted the feat/universal-llm-envelope-router-8897171277856875599 branch April 27, 2026 14:37
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