Gemini IA Studio [8links] icon

Gemini IA Studio [8links]

Gera conteúdo usando a API do Gemini

Overview

This node integrates with the Gemini generative language API to create content based on a user-provided prompt. It is designed to generate text outputs using configurable parameters that influence the style and length of the generated content. Typical use cases include automating content creation, generating creative writing, drafting emails or messages, summarizing information, or any scenario where AI-generated text can assist.

For example, a user might input a product description prompt and receive a marketing blurb in return, or provide a question and get a detailed answer generated by the model.

Properties

Name Meaning
Prompt The input text prompt that guides the content generation.
Top-P Controls nucleus sampling; the cumulative probability threshold for token selection (e.g., 0.95).
Top-K Limits the number of highest probability tokens to consider during generation (e.g., 40).
Temperatura Controls randomness in output; higher values produce more diverse results (default 1).
Tamanho Máximo da Saída Maximum number of tokens allowed in the generated output (default 8192).
Formato de Saída Output format of the response; options are application/json or text/plain.
Modelo Choice of Gemini model variant to use: "Gemini 1.5 Flash", "Gemini 1.5 Pro", or "Gemini 1.0 Pro".

Output

The node outputs an array with one item per input. Each output item contains a JSON object with two fields:

  • prompt: The original prompt string provided as input.
  • content: The full response from the Gemini API, which includes the generated content according to the selected model and parameters.

If the output format is set to application/json, the content will be structured JSON data; if text/plain, it will be plain text.

No binary data output is produced by this node.

Dependencies

  • Requires an active API key credential for the Gemini generative language API.
  • Makes HTTP POST requests to the Gemini API endpoint at https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent.
  • The node depends on the axios library for HTTP requests.
  • Users must configure the API key credential securely within n8n.

Troubleshooting

  • Common issues:

    • Invalid or missing API key credential will cause authentication failures.
    • Exceeding token limits or invalid parameter values may result in API errors.
    • Network connectivity problems can prevent successful API calls.
  • Error messages:

    • Errors returned from the Gemini API are caught and rethrown with a message like:
      Erro ao chamar a API do Gemini: [HTTP status code] - [API error message]
      
    • To resolve, verify the API key validity, check parameter correctness, and ensure network access to the API endpoint.

Links and References

  • Gemini Generative Language API documentation (refer to official Google Cloud or Gemini docs)
  • Axios HTTP client: https://axios-http.com/

Discussion