Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions PROXY-API-TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Future work for Vimini's proxy/API backend support.

## Anthropic API support

- Add a native Anthropic backend in addition to the current OpenAI-compatible proxy backend.
- Map Vimini's generic chat, streaming, tools, and tool-response abstractions to Anthropic's Messages API.
- Handle Anthropic-specific streaming events and content block formats.
- Add global config support for `api: "anthropic"`, including model defaults and API key file loading.
- Add tests for model listing behavior, streaming responses, tool calls, and error handling.
- [x] Add a native Anthropic backend in addition to the current OpenAI-compatible proxy backend.
- [x] Map Vimini's generic chat, streaming, tools, and tool-response abstractions to Anthropic's Messages API.
- [x] Handle Anthropic-specific streaming events and content block formats.
- [x] Add global config support for `api: "anthropic"`, including model defaults and API key file loading.
- [x] Add tests for model listing behavior, streaming responses, tool calls, and error handling.

## OpenAI Files API for context files

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ customizations.
}
```

You can configure multiple backends (Google Gemini via `"api": "genai"`, or OpenAI-compatible proxies and endpoints via `"api": "openai"`).
You can configure multiple backends (Google Gemini via `"api": "genai"`, OpenAI-compatible proxies and endpoints via `"api": "openai"`, or Anthropic via `"api": "anthropic"`).

Backends that require credentials specify an `api_key_file`; Gemini requires
one, while OpenAI-compatible local/proxy endpoints may omit it unless
Expand All @@ -194,7 +194,7 @@ Opens an interactive configuration editor in a new split window to configure glo
**How to use the global configuration manager:**
* Move the cursor to any configuration option or backend line.
* **`<Enter>` or `e`**: Edits the selected value. On `active_backend`, enter one of the configured backend names. On a backend header, rename the backend. Under `UI PREFERENCES`, customize colors (e.g. `thinking_color`, `prompt_color`, `waiting_color`, `service_color`, `error_color`, `prompt_hint_color`).
* **`a`**: Adds a new backend and prompts for API type, default model, API key file, and base URL for OpenAI-compatible backends.
* **`a`**: Adds a new backend and prompts for API type, default model, API key file, and base URL for OpenAI-compatible or Anthropic backends.
* **`d`**: Clears the selected backend field, deletes a backend after confirmation, or resets a UI preference back to default. The last backend cannot be deleted.
* **`r`**: Resets all global configuration options to their last saved state.
* **`q`**: Closes the configuration window. If modifications were made, a confirmation prompt asks whether to save changes permanently to `~/.var/vimini/config.json`.
Expand Down
17 changes: 17 additions & 0 deletions python3/vimini/common/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
convert_schema_to_openai,
convert_tools_to_openai,
)
from vimini.common.backends.anthropic_backend import (
AnthropicBackend,
AnthropicChatSession,
convert_schema_to_anthropic,
convert_tools_to_anthropic,
)
from vimini.common.config import (
load_global_config,
get_active_backend,
Expand Down Expand Up @@ -85,6 +91,13 @@ def get_backend(
base_url=backend_cfg.get("base_url"),
headers=backend_cfg.get("headers"),
)
elif api == "anthropic":
return AnthropicBackend(
config=backend_cfg,
api_key=api_key,
base_url=backend_cfg.get("base_url"),
headers=backend_cfg.get("headers"),
)

raise ValueError(f"Unsupported API protocol '{api}' for backend '{backend_name}'.")

Expand Down Expand Up @@ -123,8 +136,12 @@ def get_client(
"GenAIChatSession",
"ProxyBackend",
"ProxyChatSession",
"AnthropicBackend",
"AnthropicChatSession",
"convert_schema_to_openai",
"convert_tools_to_openai",
"convert_schema_to_anthropic",
"convert_tools_to_anthropic",
"get_backend",
"get_client",
]
Loading
Loading