Chat Completion
AI-generatedSummary
Perform a chat completion using Alephant AI gateway, optionally routing through cost control.
Inputs
- model (required) — Model to use for the chat completion.
- inputMode — Select input method: either a simple prompt string or a JSON array of message objects.
- prompt — The prompt text when Input Mode is set to Prompt.
- messages — JSON array of message objects when Input Mode is set to Messages JSON.
- temperature — Sampling temperature for the model.
- maxTokens — Maximum number of tokens to generate.
- responseFormat — Output format; either plain text or a JSON object.
- metadata — Optional metadata to attach to the request.
- additionalOptions — Extra parameters passed directly to the underlying API.
Output shape
Array of normalized chat completion objects
Each item includes fields such as raw, text, usage, model, requestId, finishReason, and optionally workspaceId. Errors are thrown as node operation errors.
Examples
Example 1: Simple prompt completion
model: gpt-4o-mini, inputMode: prompt, prompt: 'Explain token pricing', temperature: 0.7, maxTokens: 150
Example 2: JSON messages input with JSON response
model: gpt-4o-mini, inputMode: messages, messages: '[{"role":"user","content":"Summarize this article"}]', responseFormat: json_object
Example 3: Include metadata and additional options
model: gpt-4o-mini, inputMode: prompt, prompt: 'Generate a checklist', metadata: '{"project":"Q4"}', additionalOptions: '{"store":true}'