Add providers module: one app on the real OpenAI, Anthropic and Gemini Spring AI models against a local server in three wire formats; options, prompt caching, cost from price sheets, failover with retry layers measured

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JXVi2GMQ7bR5EmbUFdDj7N
This commit is contained in:
Claude
2026-10-09 08:01:02 +00:00
parent 85a3359186
commit 80cd21f89b
26 changed files with 1376 additions and 2 deletions
+22
View File
@@ -0,0 +1,22 @@
# Fallback: OpenAI first, then Anthropic, then Gemini
A. OpenAI fails with each status (no client retries). Does the call move on?
OpenAI 400 -> thrown requests: openai=1 anthropic=0 gemini=0 trail: [openai: failed with status 400]
OpenAI 401 -> thrown requests: openai=1 anthropic=0 gemini=0 trail: [openai: failed with status 401]
OpenAI 429 -> answered requests: openai=1 anthropic=1 gemini=0 trail: [openai: failed with status 429, anthropic: ok]
OpenAI 500 -> answered requests: openai=1 anthropic=1 gemini=0 trail: [openai: failed with status 500, anthropic: ok]
OpenAI 503 -> answered requests: openai=1 anthropic=1 gemini=0 trail: [openai: failed with status 503, anthropic: ok]
B. The same 503 with the client's own retries switched on (maxRetries 2)
OpenAI 503 -> answered requests: openai=3 anthropic=1 gemini=0
C. Gemini retries in two layers: the Google SDK (HttpRetryOptions.attempts) and Spring AI's RetryTemplate
SDK attempts=1, RetryTemplate retries=0 -> 1 request(s) for one call
SDK attempts=1, RetryTemplate retries=2 -> 3 request(s) for one call
SDK attempts=3, RetryTemplate retries=0 -> 3 request(s) for one call
SDK attempts=3, RetryTemplate retries=2 -> 9 request(s) for one call
nothing configured at all -> 5 requests for one call, and it took more than 5 seconds: true
D. Everything down: the last provider's failure is the one you see
all three 503 -> thrown requests: openai=1 anthropic=1 gemini=1
trail: [openai: failed with status 503, anthropic: failed with status 503, gemini: failed with status 503]