Google's Generative Language API enables
seamless prototyping using the Gemini models.
It lets you test and explore the capabilities of
Gemini models without needing to set up complex infrastructure
or manage model deployment.
Google's browser based prototyping tool Google AI Studio
uses the Generative Language API to enable browser-based prototyping with
generative models.
With Vertex AI SDK for ABAP, you can use the
Generative Language API—Gemini API to start your
prototyping journey, directly from
within your ABAP environment. You need an API key generated from Google AI Studio
to access the Gemini models. You need to generate this API key only once.
Generate an API key
The API key that you generate from Google AI Studio provides a convenient way
to authenticate to the Gemini API.
To generate an API key, perform the following steps:
Authenticate by using an API key stored in SAP SSF
To keep your API key secure, you can store the generated API key in SAP SSF
and configure a client key with the SSF authentication class.
You can use this client key to access the Gemini API.
For more information, see:
Authenticate by using an API key through a custom authentication class
Alternatively, you can create a custom authentication class to keep your API key
and configure a client key with the custom authentication class.
In your SAP system, create a Z class by implementing the interface
/GOOG/IF_AUTH that is shipped with the ABAP SDK for Google Cloud:
In SAP GUI, execute the transaction code SE24.
In the Object type field, type a name such as Z_TEST_GEMINI_API, and then click Create.
Make sure that the Object type is Class, and then click OK.
In the Description field, provide a description of the class
such as Class for authentication to Google AI Studio, and
then save the class as a Local Object or in a Transport Request.
Open the Interfaces tab, add the interface /GOOG/IF_AUTH, and then press enter.
Open the Methods tab. Methods of the interface /GOOG/IF_AUTH are
automatically implemented into the Z class.
Double-click the method /GOOG/IF_AUTH~GET_ACCESS_TOKEN.
In the method /GOOG/IF_AUTH~GET_ACCESS_TOKEN, add the following code:
ev_auth_type = /goog/if_auth=>c_auth_type_apik_ssf.
cv_token = 'API_KEY'.
GET TIME STAMP FIELD ev_logtime.
Replace API_KEY with the API key that you generated in Google AI Studio.
Activate your Z class.
In the SAP system, create a client key configuration:
In SAP GUI, execute the transaction code /GOOG/SDK_IMG.
Alternatively, execute the transaction code SPRO, and then click SAP Reference IMG.
Click ABAP SDK for Google Cloud > Basic Settings > Configure Client Key.
Click New Entries.
Enter values for the following fields:
Field
Description
Google Cloud Key Name
Specify a name of the client key configuration, such as
TEST_GEMINI_API.
Google Cloud Service Account Name
Leave this field blank.
Google Cloud Scope
Leave this field blank.
Google Cloud Project Identifier
Specify the project number of the Google Cloud project
where the API key is stored.
Command name
Leave this field blank.
Authorization Class
Specify the Z class that you created
in the preceding step, such as Z_TEST_GEMINI_API.
Token Caching
Leave this field blank.
Token Refresh Seconds
Leave this field blank.
Authorization Parameter 1
Leave this field blank.
Authorization Parameter 2
Leave this field blank.
Save the new entry.
Make a note of the client key. You use this client key for authentication.
Run sample code
You can explore the Gemini API capabilities by using the AI
Studio demo shipped with the Vertex AI SDK for ABAP.
To run the AI Studio demo, perform the following steps:
In SAP GUI, execute the transaction code /GOOG/SDK_IMG.
Alternatively, execute the transaction code SPRO, and then click SAP Reference IMG.
Go to ABAP SDK for Google Cloud > Demos.
Open Vertex AI SDK: Demo: Prototyping with Generative Language API.
In the Client key field, enter the client key that you've created in
the Set up authentication section.
In the Model ID field, enter the ID of the LLM model that you want to
use, such as gemini-1.5-flash. For information about the available
models, see
Model variants.
Optionally, provide the following generation parameters as appropriate:
In the Enter prompt field, provide your input
prompt.
Run the program. The Response from LLM area shows the generated output.
Prototype AI use cases using ABAP
You can build prototype SAP applications using the /GOOG/CL_GENERATIVELANGUAGE_V1
and /GOOG/CL_GENERATIVELANG_V1BETA classes shipped with the SDK. You can invoke these
classes from your ABAP environment using the client Key that
you've created in the
Set up authentication section.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Quick prototyping with Gemini\n\n\u003cbr /\u003e\n\nGoogle's [Generative Language API](https://ai.google.dev/api/all-methods#generative-language-api) enables\nseamless prototyping using the Gemini models.\nIt lets you test and explore the capabilities of\nGemini models without needing to set up complex infrastructure\nor manage model deployment.\nGoogle's browser based prototyping tool [Google AI Studio](https://ai.google.dev/aistudio)\nuses the Generative Language API to enable browser-based prototyping with\ngenerative models.\n\nWith Vertex AI SDK for ABAP, you can use the\nGenerative Language API---Gemini API to start your\nprototyping journey, directly from\nwithin your ABAP environment. You need an API key generated from Google AI Studio\nto access the Gemini models. You need to generate this API key only once.\n\nGenerate an API key\n-------------------\n\nThe API key that you generate from Google AI Studio provides a convenient way\nto authenticate to the Gemini API.\n\nTo generate an API key, perform the following steps:\n\n1. In Google AI Studio, open the **API keys** page.\n\n [Get an API key](https://aistudio.google.com/app/apikey)\n2. Click **Create API key**.\n\n3. If populated, then read and acknowledge the legal notice, and then click **Continue**.\n\n4. If populated, then read and acknowledge the safety setting reminder.\n\n5. In the **Create API key** dialog, select one of the following options,\n as appropriate:\n\n - **Create API key in new project**\n - **Create API key in existing project**\n6. Copy your key string and keep it secure. You need this API key to\n configure authentication to the Gemini API.\n\n7. Copy the project number of the Google Cloud project where the API key is\n generated. You need this in a later step.\n\nSet up authentication\n---------------------\n\nTo authenticate to Gemini API by using an API key, use one of the\nfollowing methods:\n\n- [Authenticate by using an API key stored in SAP SSF](#authenticate-api-key-stored-sap-ssf)\n- [Authenticate by using an API key through a custom authentication class](#authenticate-api-key-custom-auth-class)\n\n### Authenticate by using an API key stored in SAP SSF\n\nTo keep your API key secure, you can store the generated API key in SAP SSF\nand configure a client key with the SSF authentication class.\nYou can use this client key to access the Gemini API.\nFor more information, see:\n\n- [Store the API key in SSF](/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/authentication-api-keys#ssf-store-api-key)\n- [Configure a client key](/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/authentication-api-keys#ssf-configure-client-key)\n\n### Authenticate by using an API key through a custom authentication class\n\nAlternatively, you can create a custom authentication class to keep your API key\nand configure a client key with the custom authentication class.\n\n1. In your SAP system, create a `Z` class by implementing the interface\n `/GOOG/IF_AUTH` that is shipped with the ABAP SDK for Google Cloud:\n\n 1. In SAP GUI, execute the transaction code `SE24`.\n 2. In the **Object type** field, type a name such as `Z_TEST_GEMINI_API`, and then click **Create**.\n 3. Make sure that the **Object type** is **Class** , and then click **OK**.\n 4. In the **Description** field, provide a description of the class such as `Class for authentication to Google AI Studio`, and then save the class as a **Local Object** or in a **Transport Request**.\n 5. Open the **Interfaces** tab, add the interface `/GOOG/IF_AUTH`, and then press enter.\n 6. Open the **Methods** tab. Methods of the interface `/GOOG/IF_AUTH` are automatically implemented into the `Z` class.\n 7. Double-click the method `/GOOG/IF_AUTH~GET_ACCESS_TOKEN`.\n 8. In the method `/GOOG/IF_AUTH~GET_ACCESS_TOKEN`, add the following code:\n\n ev_auth_type = /goog/if_auth=\u003ec_auth_type_apik_ssf.\n cv_token = '\u003cvar class=\"edit\" translate=\"no\"\u003eAPI_KEY\u003c/var\u003e'.\n GET TIME STAMP FIELD ev_logtime.\n\n Replace \u003cvar translate=\"no\"\u003eAPI_KEY\u003c/var\u003e with the API key that you generated in Google AI Studio.\n | **Note:** Remember to use your API keys securely. Don't share them or embed them in code the public can view. To learn about the best practices for securing your API key, see [Keep your API key secure](https://ai.google.dev/gemini-api/docs/api-key#security).\n 9. Activate your `Z` class.\n\n2. In the SAP system, create a client key configuration:\n\n 1.\n In SAP GUI, execute the transaction code `/GOOG/SDK_IMG`.\n\n Alternatively, execute the transaction code `SPRO`, and then click **SAP Reference IMG**.\n\n \u003cbr /\u003e\n\n 2. Click **ABAP SDK for Google Cloud \\\u003e Basic Settings \\\u003e Configure Client Key**.\n\n 3. Click **New Entries**.\n\n 4. Enter values for the following fields:\n\n 5. Save the new entry.\n\n3. Make a note of the client key. You use this client key for authentication.\n\nRun sample code\n---------------\n\nYou can explore the Gemini API capabilities by using the AI\nStudio demo shipped with the Vertex AI SDK for ABAP.\n\nTo run the AI Studio demo, perform the following steps:\n\n1.\n In SAP GUI, execute the transaction code `/GOOG/SDK_IMG`.\n\n Alternatively, execute the transaction code `SPRO`, and then click **SAP Reference IMG**.\n\n \u003cbr /\u003e\n\n2. Go to **ABAP SDK for Google Cloud \\\u003e Demos**.\n\n3. Open **Vertex AI SDK: Demo: Prototyping with Generative Language API**.\n\n4. In the **Client key** field, enter the client key that you've created in\n the [Set up authentication](#set-up-auth) section.\n\n5. In the **Model ID** field, enter the ID of the LLM model that you want to\n use, such as `gemini-1.5-flash`. For information about the available\n models, see\n [Model variants](https://ai.google.dev/gemini-api/docs/models/gemini#model-variations).\n\n6. Optionally, provide the following generation parameters as appropriate:\n\n - **Max output tokens**\n - **Response Mime type**\n - **Temperature**\n - **TopK**\n - **TopP**\n\n For information about these model generation parameters, see\n [Experiment with parameter values](/vertex-ai/generative-ai/docs/learn/prompts/adjust-parameter-values).\n7. In the **Enter system instructions** field, provide a\n [system instruction](/vertex-ai/generative-ai/docs/learn/prompts/system-instructions).\n\n8. In the **Enter prompt** field, provide your input\n [prompt](/vertex-ai/generative-ai/docs/learn/prompts/introduction-prompt-design).\n\n9. Run the program. The **Response from LLM** area shows the generated output.\n\nPrototype AI use cases using ABAP\n---------------------------------\n\nYou can build prototype SAP applications using the `/GOOG/CL_GENERATIVELANGUAGE_V1`\nand `/GOOG/CL_GENERATIVELANG_V1BETA` classes shipped with the SDK. You can invoke these\nclasses from your ABAP environment using the client Key that\nyou've created in the\n[Set up authentication](#set-up-auth) section.\n\nWhat's next\n-----------\n\n- Learn how to [install and configure the Vertex AI SDK for ABAP](/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/vertex-ai-sdk/install-configure-vertex-ai-sdk-abap).\n- Explore the built-in [Generative AI demo programs for SAP](/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/vertex-ai-sdk/demos/demos-overview).\n- Learn about [Generative AI on Vertex AI for SAP](/sap/docs/abap-sdk/on-premises-or-any-cloud/latest/vertex-ai-sdk/vertex-ai-for-sap-overview).\n- Ask your questions and discuss the Vertex AI SDK for ABAP with the community on [Cloud Forums](https://discuss.google.dev/tags/c/google-cloud/14/abap-sdk)."]]