Cloudflare AI Gateway #9205
-
What happened?Perhaps I'm doing something wrong, but I'm encountering issues trying to get Anthropic and Gemini (Generative) routed through CF AI Gateway. I can get OpenAI working just fine, just not these other two. Version Informationghcr.io/danny-avila/librechat-dev latest 2fa722380692 7 hours ago 1.56GB Steps to Reproduce
What browsers are you seeing the problem on?Chrome Relevant log outputbeen clearing hard cache. Made sure CF is purged. Keys are also within GF AI Gateway.
I also keep seeing "Please configure AI Gateway in the Cloudflare dashboard" although OpenAI is working fine. ScreenshotsNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
It's possible CF AI gateway is not following OpenAI spec for Anthropic/Gemini, so you would have to use it as a reverse proxy for those endpoints. #============#
# Anthropic #
#============#
ANTHROPIC_API_KEY=user_provided
# ANTHROPIC_MODELS=claude-opus-4-20250514,claude-sonnet-4-20250514,claude-3-7-sonnet-20250219,claude-3-5-sonnet-20241022,claude-3-5-haiku-20241022,claude-3-opus-20240229,claude-3-sonnet-20240229,claude-3-haiku-20240307
# ANTHROPIC_REVERSE_PROXY=
#============#
# Google #
#============#
GOOGLE_KEY=user_provided
# GOOGLE_REVERSE_PROXY=
# Some reverse proxies do not support the X-goog-api-key header, uncomment to pass the API key in Authorization header instead.
# GOOGLE_AUTH_HEADER=true As for OpenAI compatible endpoints, you can use this example: |
Beta Was this translation helpful? Give feedback.
-
Thanks Danny. That worked with some modifications provided below for other user reference. Set this below in the portainer .env stack:
Anthropic with ANTHROPIC_API_KEY set and ANTHROPIC_MODELS=claude-opus-4.1-20250805,claude-sonnet-4-20250522,claude-3.5-sonnet-20240621,claude-3.5-haiku-20241022 worked fine out of the box. I also had it set as a provider within the CF Gateway. However I had to run troubleshooting with Google:
|
Beta Was this translation helpful? Give feedback.
It's possible CF AI gateway is not following OpenAI spec for Anthropic/Gemini, so you would have to use it as a reverse proxy for those endpoints.