DeepSeek icon

DeepSeek

Consume DeepSeek AI

Actions2

Overview

The DeepSeek node for n8n, when configured with the FIM (Fill-In-the-Middle) resource and the Complete operation, enables users to generate code or text completions using DeepSeek AI's FIM models. This is particularly useful for scenarios where you want an AI model to complete a partially written code snippet or text, such as auto-completing functions, filling in missing code blocks, or generating suggestions based on a given prompt.

Practical examples:

  • Auto-completing code snippets in developer workflows.
  • Generating boilerplate code from partial prompts.
  • Suggesting text completions in content creation pipelines.

Properties

Below are the supported input properties for the FIM → Complete operation:

Display Name Type Description
Model options The model which will generate the completion. Learn more. Options are dynamically loaded from DeepSeek API and filtered for FIM-compatible models.
Prompt string The prompt to generate completions for. This is the main input that the model will use to generate its output. Required.
Simplify boolean Whether to return a simplified version of the response instead of the raw data. If enabled, only the essential completion data is returned. Default: true.
Options collection Additional options to fine-tune the completion behavior. Includes:
- Frequency Penalty (number): Penalizes repeated tokens.
- Maximum Number of Tokens (number): Limits output length.
- Presence Penalty (number): Encourages new topics.
- Sampling Temperature (number): Controls randomness.
- Top P (number): Controls diversity via nucleus sampling.
- Echo Prompt (boolean): Echoes the prompt in the output.
- Logprobs (boolean): Returns log probabilities of output tokens.
- Suffix (string): Suffix after the completion.

Output

The structure of the json output field depends on the Simplify property:

  • If "Simplify" is enabled (default):

    [
      {
        // ...other fields,
        "json": [
          {
            // Each object represents a completion choice from the model.
            // Typical fields may include:
            "text": "completed code or text",
            "index": 0,
            // ...other possible metadata
          }
        ]
      }
    ]
    
    • The output is an array of completion choices generated by the model.
  • If "Simplify" is disabled:

    [
      {
        // ...other fields,
        "json": {
          // Full raw response from DeepSeek API, including all metadata.
          "choices": [
            {
              "text": "completed code or text",
              "index": 0,
              // ...other possible metadata
            }
          ],
          // ...other response fields (e.g., usage, model info)
        }
      }
    ]
    
  • Binary Data:
    This node does not output binary data; all outputs are JSON.


Dependencies

  • External Service: Requires access to the DeepSeek API.
  • API Key: You must configure the deepSeekApi credential in n8n with your DeepSeek API key.
  • n8n Configuration: No additional configuration required beyond credentials.

Troubleshooting

Common Issues:

  • Invalid API Key:
    Error if the DeepSeek API key is missing or incorrect.
    Resolution: Ensure your deepSeekApi credential is set up correctly in n8n.

  • Model Not Selected or Invalid:
    If no model is selected or the chosen model is not compatible with FIM, the request may fail.
    Resolution: Use the dropdown to select a valid FIM model.

  • Prompt Missing:
    The "Prompt" field is required.
    Resolution: Provide a non-empty prompt.

  • Exceeded Token Limit:
    If "Maximum Number of Tokens" exceeds the model's context window, the API may return an error.
    Resolution: Adjust the token limit according to model documentation.

  • API Quotas or Rate Limits:
    Hitting DeepSeek API rate limits or quotas can cause errors.
    Resolution: Check your DeepSeek account usage and upgrade if necessary.

Error Messages:

  • "401 Unauthorized" – Invalid or missing API key.
  • "400 Bad Request" – Likely due to invalid parameters (e.g., empty prompt, invalid model).
  • "429 Too Many Requests" – Rate limit exceeded.

Links and References

Discussion