googleapis/java-genai

Google Gen AI Java SDK provides an interface for developers to integrate Google's generative models into their Java applications.

What it solves

This SDK simplifies integrating Google's Gemini AI models into Java applications. It provides a unified, idiomatic way to connect to either the Gemini Developer API or the Gemini Enterprise Agent Platform without needing to rewrite your underlying code.

How it works

The SDK provides a central Client class that handles authentication and communication. You can configure this client using environment variables or a builder pattern. It supports standard text generation, multimodal inputs (like images), streaming responses, and asynchronous calls. It also includes advanced features like automatic function calling, custom HTTP retry logic, and proxy configuration.

Who it’s for

This project is for Java developers building applications that need to leverage Gemini AI models, whether they are using the public developer API or the enterprise-grade agent platform.

Highlights

  • Unified client for both Gemini Developer and Enterprise Agent backends.
  • Built-in support for streaming and asynchronous model responses.
  • Flexible configuration for HTTP timeouts, retries, and custom proxy settings.
  • Automatic function calling to execute local Java methods via AI prompts.
  • Support for structured JSON output using custom response schemas.

Related

  • Project
  • Project
  • Project
  • Project
  • Project