Integrations / Google Gemini
Google Gemini
Google's Gemini API: generate text, list models, count tokens and create embeddings.
5 actions
API key
5 read0 write
Calls generativelanguage.googleapis.com
Connect
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "gemini" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();Permissions requested
This toolkit uses a single credential and requests no scopes.
Actions
Count tokensreadgemini.count_tokensCount how many tokens a text prompt uses for a given Gemini model.
| Input | Type | Description | |
|---|---|---|---|
model | string | Required | Model id without the models/ prefix |
text | string | Required | The text to count |
await setu.execute({
userId: "user_1",
action: "gemini.count_tokens",
input: {
"model": "<model>",
"text": "<text>"
},
});Create embeddingreadgemini.embed_contentCreate a text embedding vector with a Gemini embedding model.
| Input | Type | Description | |
|---|---|---|---|
model | string | Required | Embedding model id without the models/ prefix, e.g. gemini-embedding-001 |
text | string | Required | Text to embed |
taskType | string | Optional | Optional task type, e.g. RETRIEVAL_QUERY |
outputDimensionality | integer | Optional | Optional vector size |
await setu.execute({
userId: "user_1",
action: "gemini.embed_content",
input: {
"model": "<model>",
"text": "<text>"
},
});Generate textreadgemini.generate_contentGenerate a text response from a Gemini model for a prompt, with an optional system instruction.
| Input | Type | Description | |
|---|---|---|---|
model | string | Required | Model id without the models/ prefix, e.g. gemini-2.5-flash |
prompt | string | Required | The user prompt |
systemInstruction | object | Optional | Optional system instruction as {parts: [{text: ...}]} |
generationConfig | object | Optional | Optional settings such as temperature and maxOutputTokens |
await setu.execute({
userId: "user_1",
action: "gemini.generate_content",
input: {
"model": "<model>",
"prompt": "<prompt>"
},
});Get modelreadgemini.get_modelGet one Gemini model's details: display name, token limits and supported generation methods.
| Input | Type | Description | |
|---|---|---|---|
model | string | Required | Model id without the models/ prefix |
await setu.execute({
userId: "user_1",
action: "gemini.get_model",
input: {
"model": "<model>"
},
});List modelsreadgemini.list_modelsList the Gemini models available to this key with their token limits and supported methods.
| Input | Type | Description | |
|---|---|---|---|
pageSize | integer | Optional | Models per page (default 50, max 1000) |
pageToken | string | Optional | Token from a previous response |
await setu.execute({
userId: "user_1",
action: "gemini.list_models",
input: {},
});