This integration is for the Keywords AI gateway.
1. Overview
Keywords AI is compatible with the official Google GenAI SDK, enabling you to use Google’s models through our gateway. This guide will walk you through setting up the Google GenAI SDK to work with Keywords AI.2. Quickstart
1
Step 1: Install the SDK
2
First, install the official Google GenAI SDK for TypeScript/JavaScript.
3
npm
yarn
pnpm
4
Step 2: Initialize the client
5
Next, initialize the
GoogleGenAI
client, making sure to set the apiKey
to your Keywords AI key and the baseUrl
within httpOptions
to the Keywords AI endpoint for Google.6
TypeScript
7
The
baseUrl
can be either https://api.keywordsai.co/api/google
or https://endpoint.keywordsai.co/api/google
.3. Make Your First Request
Now you can use thegenAI
instance to make requests to Google’s models.
4. Switch models
To switch between different Google models, simply change themodel
parameter in your request.
5. Supported parameters
Keywords AI supports passing through native Google GenAI parameters and adding our own for enhanced functionality.Keywords AI parameters
To pass Keywords AI-specific parameters, you need to include them in theextra_body
of your request. This is not natively supported by the Google GenAI SDK, so you may need to make a custom request or use a different library that allows modifying the request body.
Google GenAI parameters
All standard Google GenAI parameters are supported and can be passed directly in thegenerateContent
call.
6. Next Steps
- Explore our guide on Supported Models to see all available Google models.
- Learn about advanced Keywords AI features like retries, fallbacks, and caching.