Skip to content

Add support for multiple APIs - #12

Merged
simo5 merged 19 commits into
mainfrom
more_apis
Oct 27, 2026
Merged

simo5 merged 19 commits into
mainfrom
more_apis

Conversation

@simo5

@simo5 simo5 commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Abstract AI backends and add OpenAPI API support which works for many proxying services and models.

simo5 added 19 commits October 26, 2026 19:00
Replace the ACP architectural documents with an integration plan for
supporting OpenAI-compatible backends alongside Google Gemini.

Implement global configuration management in ~/.var/vimini/config.json
to support multiple provider backends, auto-generate default settings,
and facilitate runtime backend switching. Add corresponding unit tests
and update the README documentation.

Assisted-by: Gemini:Gemini 3.8 Flash
Signed-off-by: Simo Sorce <simo@redhat.com>
Introduce a backend abstraction layer to decouple Vimini from
provider-specific APIs. Add BaseClient and BaseChatSession interfaces
along with unified StreamChunk and tool calling data structures.

Implement GenAIBackend to wrap Google GenAI and ProxyBackend to support
OpenAI-compatible endpoints over standard library HTTP/SSE streaming,
including schema conversion and tool calling. This allows users to
configure and switch between Gemini and OpenAI-compatible proxy backends.

Assisted-by: Gemini:Gemini 3.8 Flash
Signed-off-by: Simo Sorce <simo@redhat.com>
Refactor the agent server and chat, code, and review sessions to interact with
language models via generic backend client interfaces rather than direct
Google GenAI dependencies.

Agent tools and schema declarations now use shared backend types, streaming
handlers consume unified stream chunks, and chat history queries respect
backends that do not persist history. Also update IPC setup to transmit the
active backend name.

Assisted-by: Gemini:Gemini 3.8 Flash
Signed-off-by: Simo Sorce <simo@redhat.com>
Implement the `:ViminiBackend` command with completion to view or switch
active provider backends at runtime without restarting Vim. Update the
model listing buffer to display active backend names and support single-
group listings for OpenAI-compatible proxies, and include backend info
in status buffer output. Update documentation and add test coverage.

Assisted-by: Gemini:Gemini 3.8 Flash
Signed-off-by: Simo Sorce <simo@redhat.com>
Retain opaque provider-specific metadata (such as Gemini's
thought_signature) when streaming tool calls in ProxyBackend.
Certain OpenAI-compatible providers reject follow-up requests if
assistant tool-call signatures are not echoed back verbatim.

The internal message history now preserves extra metadata while
keeping the public ToolCall abstraction clean. Also remove the
obsolete PROXY-API.md planning document and add regression tests.

Assisted-by: Gemini:gemini-3.8-flash
Signed-off-by: Simo Sorce <simo@redhat.com>
Add :ViminiGlobalConfig to manage global settings and backend providers from
an interactive Vim split. The editor supports editing, adding, deleting,
resetting, validating, and saving backends, then applies saved backend changes
to the current runtime.

Refactor backend switching through a shared apply_backend_config helper and
document the new command. Add tests for rendering the editor and applying
backend config.

Assisted-by: gpt-5.5
Signed-off-by: Simo Sorce <simo@redhat.com>
Signed-off-by: Simo Sorce <simo@redhat.com>
Load the startup model from the active backend's global config instead of the
deprecated Vim variable. Add a `D` action in the model list to save and switch
the backend default model, update help and README docs, and cover the behavior
with tests.

Assisted-by: gpt-5.5
Signed-off-by: Simo Sorce <simo@redhat.com>
Require every backend to define a non-empty api_key_file in the global
configuration and prevent setup messages from passing api_key or api_key_file
values to the agent.

Backend creation now loads keys only from the selected backend config and
reports missing keys clearly. The Vim config UI blocks adding or clearing
invalid key file settings, initialization surfaces invalid global config
errors, and tests/docs were updated to cover the safer configuration flow.

Assisted-by: gpt-5.5
Signed-off-by: Simo Sorce <simo@redhat.com>
Replace standard Vim confirm() dialogs with styled popup windows
when deleting backends and saving global configuration changes.
This provides a more consistent visual interface and interaction
flow. Unit tests have been added to cover the new popup dialogs.

Assisted-by: Gemini 3.8 Flash
Signed-off-by: Simo Sorce <simo@redhat.com>
Document future work for proxy/API backend support, including native Anthropic
integration and OpenAI-compatible Files API handling for context files.

Assisted-by: gpt-5.5
Signed-off-by: Simo Sorce <simo@redhat.com>
Handle repeated or overlapping streamed function name deltas without
duplicating tool names. Preserve provider metadata when tool call indexes are
sparse by matching completed calls to their original indexes. Add tests for
both cases.

Assisted-by: gpt-5.5
Signed-off-by: Simo Sorce <simo@redhat.com>
Validate global backend configs before selecting a backend and reject
unsupported API types early. This ensures invalid configs fail with clear
errors and prevents unsupported protocols from reaching backend
initialization.

Assisted-by: gpt-5.5
Signed-off-by: Simo Sorce <simo@redhat.com>
Allow OpenAI-compatible backends to omit api_key_file by default, with
requires_api_key available for remote providers that need credentials. Update
validation, initialization warnings, backend creation, Vim config editing,
docs, and tests accordingly.

Improve proxy SSE parsing to handle multiline events, comments, trailing data,
and [DONE] termination correctly.

Assisted-by: gpt-5.5
Signed-off-by: Simo Sorce <simo@redhat.com>
Remove overlap deduplication logic from function name streaming. The previous
overlap detection caused repeated characters to be inadvertently dropped
during character-by-character streaming chunks.

Assisted-by: Gemini 3.8 Flash
Signed-off-by: Simo Sorce <simo@redhat.com>
Update the ViminiBackend command definition to accept any
number of arguments using <q-args> instead of <f-args>.
In the backend command handler, strip whitespace before
validating the backend name so whitespace-only arguments
are treated as empty and correctly show the active backend.

Assisted-by: Gemini 3.8 Flash
Signed-off-by: Simo Sorce <simo@redhat.com>
Infer API key requirements for OpenAI backends when api_key_file
is configured, and ensure active model and API key states are properly
reset when switching backends to avoid leaking configuration.

Additionally, bypass Gemini client queries in get_model_name for
non-Gemini backends to prevent spurious API key errors when using
keyless local models.

Assisted-by: Gemini 3.8 Flash
Signed-off-by: Simo Sorce <simo@redhat.com>
Allow `generate_content` and `generate_content_stream` to accept prompts
passed as lists by joining non-empty items with double newlines. This improves
compatibility with callers that supply prompts as multi-part lists, and
includes unit tests covering both methods.

Assisted-by: Gemini 3.8 Flash
Signed-off-by: Simo Sorce <simo@redhat.com>
Validate that OpenAI-compatible backends define a non-empty default_model and
use that model when initializing or switching backends.

Avoid falling back to Gemini defaults for non-Gemini providers, reset cached
GenAI clients on backend changes, and keep GenAI model display lookup behavior
for custom Gemini backends.

Assisted-by: gpt-5.5
Signed-off-by: Simo Sorce <simo@redhat.com>
@simo5
simo5 merged commit 7cdccde into main Oct 27, 2026
1 check passed
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