OpenAPI spec File

Hey I would love to contribute to SpringAI to make Gemini directly accessible to the Java server side world. However I could not find an OpenAPI spec and I would love to not have to reverse engineer existing SDKs.

See: Does not support google gemini · Issue #1252 · spring-projects/spring-ai · GitHub

The links in Gemini OpenAPI specification appear to be broken.

Perhaps I should jump into that thread. But a few notes:

  • The REST API for the Vertex AI Gemini API and AI Studio Gemini API are nearly identical.
    • There are subtle differences, but they’re subtle. So you may be able to start with the Vertex AI implementation that Spring AI already supports.
    • The biggest difference is the auth method, but providing an API key instead of going through Google Auth isn’t difficult. (And the AI Studio API also takes Google Auth.)
    • The other big difference is the endpoint. This shouldn’t be that big a deal at all.
  • There isn’t an OpenAPI spec…

I’m the primary author of the @langchain/google-common package for node.js which provides Gemini API support for both Vertex AI and AI Studio out of a single package. So it can be done. It may help for you to read the Typescript definitions for GeminiRequest and GenerateContentResponseData which represent most of the REST format.

I’ll try to take a look at the Spring AI Gemini support, but I’ve got a lot on my plate right now catching up with LangChain.js now that the competition is done. But please feel free to reach out to me directly or on this thread to discuss.