You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***Detailed Logger**: Provides per-request file logging for debugging.
12
12
***OpenAI-Compatible Endpoints**: `/v1/chat/completions`, `/v1/embeddings`, etc.
13
+
***Anthropic-Compatible Endpoints**: `/v1/messages`, `/v1/messages/count_tokens` for Claude Code and other Anthropic API clients.
13
14
***Model Filter GUI**: Visual interface for configuring model ignore/whitelist rules per provider (see Section 6).
14
15
2.**The Resilience Library (`rotator_library`)**: This is the core engine that provides high availability. It is consumed by the proxy app to manage a pool of API keys, handle errors gracefully, and ensure requests are completed successfully even when individual keys or provider endpoints face issues.
15
16
@@ -816,6 +817,108 @@ When a custom cap triggers a cooldown longer than the exhaustion threshold, it a
816
817
817
818
**Defaults:** See `src/rotator_library/config/defaults.py` for all configurable defaults.
818
819
820
+
### 2.21. Anthropic API Compatibility (`anthropic_compat/`)
821
+
822
+
A translation layer that enables Anthropic API clients (like Claude Code) to use any OpenAI-compatible provider through the proxy.
# 4. For streaming: wrap with anthropic_streaming_wrapper
910
+
911
+
asyncdefanthropic_count_tokens(self, request):
912
+
"""Count tokens for Anthropic-format request."""
913
+
# Translates messages and tools, then uses token_count()
914
+
```
915
+
916
+
#### Authentication
917
+
918
+
The proxy accepts both Anthropic and OpenAI authentication styles:
919
+
-`x-api-key` header (Anthropic style)
920
+
-`Authorization: Bearer` header (OpenAI style)
921
+
819
922
### 3.5. Antigravity (`antigravity_provider.py`)
820
923
821
924
The most sophisticated provider implementation, supporting Google's internal Antigravity API for Gemini 3 and Claude models (including **Claude Opus 4.5**, Anthropic's most powerful model).
Copy file name to clipboardExpand all lines: README.md
+50-4Lines changed: 50 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,20 @@
4
4
5
5
**One proxy. Any LLM provider. Zero code changes.**
6
6
7
-
A self-hosted proxy that provides a single, OpenAI-compatible API endpoint for all your LLM providers. Works with any application that supports custom OpenAI base URLs—no code changes required in your existing tools.
7
+
A self-hosted proxy that provides OpenAI and Anthropic compatible API endpoints for all your LLM providers. Works with any application that supports custom OpenAI or Anthropic base URLs—including Claude Code, Opencode, and more—no code changes required in your existing tools.
8
8
9
9
This project consists of two components:
10
10
11
-
1.**The API Proxy** — A FastAPI application providing a universal `/v1/chat/completions`endpoint
11
+
1.**The API Proxy** — A FastAPI application providing universal `/v1/chat/completions`(OpenAI) and `/v1/messages` (Anthropic) endpoints
12
12
2.**The Resilience Library** — A reusable Python library for intelligent API key management, rotation, and failover
13
13
14
14
---
15
15
16
16
## Why Use This?
17
17
18
-
-**Universal Compatibility** — Works with any app supporting OpenAI-compatible APIs: Opencode, Continue, Roo/Kilo Code, JanitorAI, SillyTavern, custom applications, and more
18
+
-**Universal Compatibility** — Works with any app supporting OpenAI or Anthropic APIs: Claude Code, Opencode, Continue, Roo/Kilo Code, Cursor, JanitorAI, SillyTavern, custom applications, and more
19
19
-**One Endpoint, Many Providers** — Configure Gemini, OpenAI, Anthropic, and [any LiteLLM-supported provider](https://docs.litellm.ai/docs/providers) once. Access them all through a single API key
20
+
-**Anthropic API Compatible** — Use Claude Code or any Anthropic SDK client with non-Anthropic providers like Gemini, OpenAI, or custom models
20
21
-**Built-in Resilience** — Automatic key rotation, failover on errors, rate limit handling, and intelligent cooldowns
21
22
-**Exclusive Provider Support** — Includes custom providers not available elsewhere: **Antigravity** (Gemini 3 + Claude Sonnet/Opus 4.5), **Gemini CLI**, **Qwen Code**, and **iFlow**
22
23
@@ -177,12 +178,57 @@ In your configuration file (e.g., `config.json`):
177
178
178
179
</details>
179
180
181
+
<details>
182
+
<summary><b>Claude Code</b></summary>
183
+
184
+
Claude Code natively supports custom Anthropic API endpoints. The recommended setup is to edit your Claude Code `settings.json`:
0 commit comments