Alephant icon

Alephant

Route AI requests through Alephant AI Gateway and query Alephant analytics from one action node.

AI Gateway → Chat Completion

AI-generated

Summary

Sends a chat completion request to the Alephant AI Gateway (POST /chat/completions, OpenAI-style) for each input item, using a virtual key, and returns the generated text plus the raw response, usage and a request log ID.

Inputs

  • model (required) — Model identifier sent to the gateway. Defaults to gpt-4o-mini.
  • inputMode — Prompt (single user message) or Messages JSON (full conversation). Defaults to Prompt.
  • prompt — Text sent as one user message. Shown only in Prompt mode.
  • messages — JSON array of messages, each with string role and string content. Shown only in Messages JSON mode. Non-string content (e.g. multimodal arrays) is rejected.
  • temperature — Sampling temperature; sent only if set to a number.
  • maxTokens — Sent as max_tokens only if set to a number.
  • responseFormat — Text (default, nothing sent) or JSON Object (sends response_format {type: json_object}).
  • metadata — JSON object. Only included in the request when Additional Options contains store: true and metadata is non-empty.
  • additionalOptions — JSON object of extra body fields (e.g. top_p, stop) merged into the request. Keys model, messages, temperature, max_tokens, response_format and metadata are ignored here.

Output shape

One output item per input item, paired to its input. JSON fields: raw (full gateway response), text (first choice message content, or empty string), usage (token usage or {}), model, requestId and requestLogId (same client-generated UUID sent as x-request-id), finishReason.

Also includes workspaceId if the incoming item's json.workspaceId is a non-empty string; the requestLogId and workspaceId can be fed into the Analytics 'Request Log Detail' operation. Throws if messages are empty or invalid JSON or the prompt/messages produce no message. Only the first choice is extracted into text. Requires Alephant virtual key credentials. HTTP errors surface as node API errors, and one retry is made on transient network errors.

Examples

Example 1: Summarize text from a previous node with a single prompt

Model gpt-4o-mini, Input Mode Prompt, Prompt set to an expression like 'Summarize: {{$json.body}}', Temperature 0.2.

Example 2: Multi-turn chat with a system message and structured output

Input Mode Messages JSON, Messages [{"role":"system","content":"Reply in JSON"},{"role":"user","content":"..."}], Response Format JSON Object.

Example 3: Pass extra provider parameters

Additional Options {"top_p":0.9,"stop":["END"]}, Max Tokens 500.

Links

Discussion