# Class Gemini.Builder

java.lang.Object
com.google.adk.models.Gemini.Builder

Enclosing class:
  `Gemini`

public static class Gemini.Builder extends Object
Builder for `Gemini`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Gemini.Builder`
  `apiClient(com.google.genai.Client apiClient)`
  Sets the explicit `Client` instance for making API calls.
  `Gemini.Builder`
  `apiKey(String apiKey)`
  Sets the Google Gemini API key.
  `Gemini`
  `build()`
  Builds the `Gemini` instance.
  `Gemini.Builder`
  `modelName(String modelName)`
  Sets the name of the Gemini model to use.
  `Gemini.Builder`
  `vertexCredentials(VertexCredentials vertexCredentials)`
  Sets the Vertex AI credentials.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### modelName

    @CanIgnoreReturnValue public Gemini.Builder modelName(String modelName)
    Sets the name of the Gemini model to use.
    Parameters:
      `modelName` - The model name (e.g., "gemini-2.0-flash").
    Returns:
      This builder.

  - ### apiClient

    @CanIgnoreReturnValue public Gemini.Builder apiClient(com.google.genai.Client apiClient)
    Sets the explicit `Client` instance for making API calls. If this is set, apiKey and vertexCredentials will be ignored.
    Parameters:
      `apiClient` - The client instance.
    Returns:
      This builder.

  - ### apiKey

    @CanIgnoreReturnValue public Gemini.Builder apiKey(String apiKey)
    Sets the Google Gemini API key. If `apiClient(Client)` is also set, the explicit client will take precedence. If `vertexCredentials(VertexCredentials)` is also set, this apiKey will take precedence.
    Parameters:
      `apiKey` - The API key.
    Returns:
      This builder.

  - ### vertexCredentials

    @CanIgnoreReturnValue public Gemini.Builder vertexCredentials(VertexCredentials vertexCredentials)
    Sets the Vertex AI credentials. If `apiClient(Client)` or `apiKey(String)` are also set, they will take precedence over these credentials.
    Parameters:
      `vertexCredentials` - The Vertex AI credentials.
    Returns:
      This builder.

  - ### build

    public Gemini build()
    Builds the `Gemini` instance.
    Returns:
      A new `Gemini` instance.
    Throws:
      `NullPointerException` - if modelName is null.