How to create an gemini( and llm credential) with api

Guys i’m trying alot to get the right schema to create this google Gemini credential with n8n api , but i can’t do any progress…

When i use the “Get Schema” node, i’m getting this format
[
{
“additionalProperties”: false,
“type”: “object”,
“properties”: {
“host”: {
“type”: “string”
},
“apiKey”: {
“type”: “string”
}
},
“required”: [
“host”,
“apiKey”
]
}
]

i’m trying to change that in alot of ways like

{
“name”: “Google Gemini Credentials”,
“type”: “googlePalmApi”,
“data”: {
“host”: “https://generativelanguage.googleapis.com”,
“apiKey”: “xx”
}
}

or

[
{
“additionalProperties”: false,
“type”: “object”,
“properties”: {
“host”: {
“type”: “string”,
“host”: “https://generativelanguage.googleapis.com

  },
  "apiKey": {
    "type": "string",
    "data": ""

  }
},
"required": [
  "host",
  "apiKey"
]

}
]

or

[
{
“additionalProperties”: false,
“type”: “object”,
“properties”: {
“host”: {
“type”: “string”,
“data”: {
“token”: “https://generativelanguage.googleapis.com
}
},
“apiKey”: {
“type”: “string”,
“data”: {
“token”: “xx”
}
}
},
“required”: [
“host”,
“apiKey”
]
}
]

or

[
{
“additionalProperties”: false,
“type”: “object”,
“properties”: {
“host”: {
“type”: “string”,
“data”: {
“host”: “https://generativelanguage.googleapis.com
}
},
“apiKey”: {
“type”: “string”,
“data”: {
“apiKey”: “xx”
}
}
},
“required”: [
“host”,
“apiKey”
]
}
]

but i can’t get any positive response … someone can help me to get the correct format plz ?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
1 Like

i found the solution if someone need that too:

The n8n nodes that uses api are broken , so use http request instead.

To create a credential:

curl -X 'POST' \
  'https://your_domain/api/v1/credentials' \
  -H 'accept: application/json' \
  -H 'X-N8N-API-KEY: your_n8n_cred' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Google PaLM API",
  "type": "googlePalmApi",
  "data": {
    "host": "https://generativelanguage.googleapis.com",  
    "apiKey": "your_cred_on_gemini"  
  }
}
1 Like

It was working yesterday… Google changed something. My N8N was get error with bad request for Region.

Didn’t work here… I am getting Region not allowed

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.