Error 403 Your client does not have permission to get URL from this server

<b>403.</b> <ins>That’s an error.</ins>\n <p>Your client does not have permission to get URL <code>/v1/models/gemini-1.5-pro-latest:generateContent</code> from this server. <ins>That’s all we know.</ins>\n"
  • My api key is paid
  • My server is on Hetzner/Germany

Welcome to the forums!

It is a little unclear exactly what is going on here.
Can you show the code you’re using that is causing this error?

I use N8N to send a http requisitation to the endpoint:
https://generativelanguage.googleapis.com/v1/models/gemini-1.5-pro-latest:generateContent

“bodyParameters”: {
“parameters”: [
{
“name”: “contents[0].parts[0].text”,
“value”: “=Como especialista em SEO, gere um objeto conteúdo de um subtítulo para um post de blog, com base no subtítulo ‘{{ $node[‘Loop’].json["subtitulos"] }}’ seguind as regras específicas:\n\n- ‘conteudo’: Crie o conteúdo para o subtítulo, utilize marcações HTML, evite Markdown, não adicione título no início, evite criar conclusões, evite criar introdução, considere readability com 70 – 80 de escore e 7th grade, faça uma abordagem abrangente sobre o artigo com o título ‘{{ $node[‘Dados SEO’].json["titulo"]}}’, crie um conteúdo detalhado, utilize para negrito quando for possível.\n\nNão altere o nome dos atributo;\nNão crie nenhuma intro nos resultados ou prefixo.\nEscreva em português (brasileiro);\nEvite gerar conteúdo duplicado, leve em consideração os subtítulos: ‘{{ $node["Dados SEO"].json["subtitulos"].join(", ") }}’;”
},
{
“name”: “safetySettings[0].category”,
“value”: “HARM_CATEGORY_HARASSMENT”
},
{
“name”: “safetySettings[0].threshold”,
“value”: “BLOCK_NONE”
},
{
“name”: “safetySettings[1].category”,
“value”: “HARM_CATEGORY_HATE_SPEECH”
},
{
“name”: “safetySettings[1].threshold”,
“value”: “BLOCK_NONE”
},
{
“name”: “safetySettings[2].category”,
“value”: “HARM_CATEGORY_SEXUALLY_EXPLICIT”
},
{
“name”: “safetySettings[2].threshold”,
“value”: “BLOCK_NONE”
},
{
“name”: “safetySettings[3].category”,
“value”: “HARM_CATEGORY_DANGEROUS_CONTENT”
},
{
“name”: “safetySettings[3].threshold”,
“value”: “BLOCK_NONE”
},
{
“name”: “systemInstruction.role”,
“value”: “system”
},
{
“name”: “systemInstruction.parts[0].text”,
“value”: “You are an SEO Specialist”
}
]
},
“options”: {}

How are you including the API Key in your request?

On the Query in url.
Exemple:
https://generativelanguage.googleapis.com/v1/models/gemini-1.5-pro-latest:generateContent?key=mykeygenerateinaistudio

@Adeli_Mateus Did you manage to find out what the problem was?
The API works on local, I am in EU(Romania), and the VPS is like yours Hetzner/Germany.

Thanks

Hi @Adeli_Mateus. For error 403 :

Possible cause:

Your Service Account might not have the proper permissions to query your large language model (LLM).

Recommended solution:

Make sure your service account has the proper Identity and Access Management (IAM) permissions listed in the error message.

For more information on setting up your service agent permissions, follow the below Troubleshooting guide :

Hope this will solve your issue !!