Vigiar
1
0
Derivar
Você já tinha feito uma derivação do repositório api-n8n-node, anteriormente
0
api-n8n-node/nodes/MozOutMz/descriptions/AiDescription.ts
2026-11-28 15:28:09 +02:00

935 linhas
25 KiB
TypeScript

// Generated from the OpenAPI specification. Do not edit by hand: regenerate.
import type { INodeProperties } from 'n8n-workflow';
export const aiOperations: INodeProperties[] = [{
"displayName": "Operation",
"name": "operation",
"type": "options",
"noDataExpression": true,
"displayOptions": {
"show": {
"resource": [
"ai"
]
}
},
"options": [
{
"name": "List the AI models",
"value": "modelsList",
"description": "Needs `ai:read`. Every model on sale, in the OpenAI format (`{\"object\": \"list\", \"data\": [...]}`), so `client.models.list()` of the OpenAI SDKs works. Each model comes with its type and its price in...",
"action": "List the AI models",
"routing": {
"request": {
"method": "GET",
"url": "=/v1/models"
},
"output": {
"postReceive": [
{
"type": "rootProperty",
"properties": {
"property": "data"
}
}
]
}
}
},
{
"name": "Get an AI model",
"value": "modelsGet",
"description": "Needs `ai:read`. One model, in the same format as the list. Image, video and voice models also bring `input`: the fields to send inside `input` in POST /v1/media/generations, with the accepted values...",
"action": "Get an AI model",
"routing": {
"request": {
"method": "GET",
"url": "=/v1/models/{{encodeURIComponent(String($parameter[\"id\"]))}}"
}
}
},
{
"name": "Chat with a text model",
"value": "chatCreate",
"description": "Needs `ai:write`. Compatible with the OpenAI chat API: point the OpenAI SDK at this API (`base_url`) and use your key. Before calling the model we reserve credits for the input (about one token per 3...",
"action": "Chat with a text model",
"routing": {
"request": {
"method": "POST",
"url": "=/v1/chat/completions",
"headers": {
"Idempotency-Key": "={{ \"n8n-\" + Date.now().toString(36) + \"-\" + Math.random().toString(36).slice(2, 12) }}"
}
}
}
},
{
"name": "Start an image, video or voice generation",
"value": "mediaCreate",
"description": "Needs `ai:write`. Images, videos and voice take from a few seconds to a few minutes, so the answer is `202` right away, with the `id` of the generation and the credits reserved. Then call GET...",
"action": "Start an image, video or voice generation",
"routing": {
"request": {
"method": "POST",
"url": "=/v1/media/generations",
"headers": {
"Idempotency-Key": "={{ \"n8n-\" + Date.now().toString(36) + \"-\" + Math.random().toString(36).slice(2, 12) }}"
}
}
}
},
{
"name": "Check a generation",
"value": "mediaGet",
"description": "Needs `ai:read`. The state of a generation. Each call also moves it forward, so call it every 5 to 10 seconds until `status` is `completed` (the links are in `outputs`) or `failed` (the reason is in...",
"action": "Check a generation",
"routing": {
"request": {
"method": "GET",
"url": "=/v1/media/generations/{{encodeURIComponent(String($parameter[\"id\"]))}}"
}
}
},
{
"name": "See the AI credit balance",
"value": "balanceGet",
"description": "Needs `ai:read`. The credits the account has for AI. Chat and generations take credits from this balance; a reservation that is not used comes back to it. It is the same balance with a `sandbox_` key...",
"action": "See the AI credit balance",
"routing": {
"request": {
"method": "GET",
"url": "=/v1/ai/balance"
}
}
},
{
"name": "Send a message in the Anthropic format",
"value": "messagesCreate",
"description": "Needs `ai:write`. Compatible with the Anthropic Messages API, for Claude Code and the Anthropic SDKs: set the base URL to this API without `/v1` (the tool adds `/v1/messages`). It works like POST...",
"action": "Send a message in the Anthropic format",
"routing": {
"request": {
"method": "POST",
"url": "=/v1/messages",
"headers": {
"Idempotency-Key": "={{ \"n8n-\" + Date.now().toString(36) + \"-\" + Math.random().toString(36).slice(2, 12) }}"
}
}
}
},
{
"name": "Count the tokens of a message",
"value": "messagesCountTokens",
"description": "Needs `ai:write`. An estimate of the input tokens of a POST /v1/messages request, which Claude Code uses to manage the context. It does not call the model, costs nothing and does not spend points....",
"action": "Count the tokens of a message",
"routing": {
"request": {
"method": "POST",
"url": "=/v1/messages/count_tokens"
}
}
},
{
"name": "Create a response in the OpenAI Responses format",
"value": "responsesCreate",
"description": "Needs `ai:write`. Compatible with the OpenAI Responses API, for Codex CLI (`wire_api = \"responses\"`) and the OpenAI SDKs (`client.responses.create`), with the base URL ending in `/v1`. It works like...",
"action": "Create a response in the OpenAI Responses format",
"routing": {
"request": {
"method": "POST",
"url": "=/v1/responses",
"headers": {
"Idempotency-Key": "={{ \"n8n-\" + Date.now().toString(36) + \"-\" + Math.random().toString(36).slice(2, 12) }}"
}
}
}
},
{
"name": "Get a saved response",
"value": "responsesGet",
"description": "Needs `ai:read`. A response made by POST /v1/responses in the last 30 days, the same as it was returned. Only the account that made it can see it; after 30 days the answer is `404`. The key may come...",
"action": "Get a saved response",
"routing": {
"request": {
"method": "GET",
"url": "=/v1/responses/{{encodeURIComponent(String($parameter[\"id\"]))}}"
}
}
},
{
"name": "AI credit prices",
"value": "creditsPrices",
"description": "Needs `ai:read`. The price of each AI credit by quantity, in the currency of the account. Tax is added on the invoice (`tax_added`).",
"action": "AI credit prices",
"routing": {
"request": {
"method": "GET",
"url": "=/v1/ai/credits/prices"
}
}
},
{
"name": "Buy AI credits",
"value": "creditsPurchase",
"description": "Needs `billing:purchase`. Also needs `ai:write`. Buys `quantity` AI credits at the price of GET /v1/ai/credits/prices; they enter the balance with the payment. Credits do not take `promo_code`. Paid...",
"action": "Buy AI credits",
"routing": {
"request": {
"method": "POST",
"url": "=/v1/ai/credits/purchase",
"headers": {
"Idempotency-Key": "={{ \"n8n-\" + Date.now().toString(36) + \"-\" + Math.random().toString(36).slice(2, 12) }}"
}
}
}
}
],
"default": "modelsList"
}];
export const aiFields: INodeProperties[] = [
{
"displayName": "Query Parameters",
"name": "queryParameters",
"type": "collection",
"placeholder": "Add Parameter",
"default": {},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"modelsList"
]
}
},
"options": [
{
"displayName": "Q",
"name": "q",
"type": "string",
"default": "",
"description": "Search in the id, the name and the description.",
"routing": {
"send": {
"type": "query",
"property": "q"
}
}
},
{
"displayName": "Type",
"name": "type",
"type": "options",
"options": [
{
"name": "text",
"value": "text"
},
{
"name": "image",
"value": "image"
},
{
"name": "video",
"value": "video"
},
{
"name": "audio",
"value": "audio"
},
{
"name": "agent",
"value": "agent"
}
],
"default": "text",
"description": "Only models of this type. `agent` lists only your agents.",
"routing": {
"send": {
"type": "query",
"property": "type"
}
}
}
]
},
{
"displayName": "ID",
"name": "id",
"type": "string",
"required": true,
"default": "",
"description": "The model id, slash included, such as `deepseek-ai/deepseek-v4-flash` or `openai/gpt-image-2/text-to-image`, or `agent/<id>` for one of your agents. Send it as it is.",
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"modelsGet"
]
}
}
},
{
"displayName": "Model",
"name": "model",
"type": "string",
"default": "",
"required": true,
"description": "A `text` model id from GET /v1/models, or `agent/<id>` to use one of your agents.",
"routing": {
"send": {
"type": "body",
"property": "model"
}
},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"chatCreate"
]
}
}
},
{
"displayName": "Messages",
"name": "messages",
"type": "json",
"default": "[]",
"required": true,
"description": "The conversation, oldest first.",
"routing": {
"send": {
"type": "body",
"property": "messages",
"value": "={{ typeof $value === \"string\" ? ($value.trim() === \"\" ? undefined : JSON.parse($value)) : $value }}"
}
},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"chatCreate"
]
}
}
},
{
"displayName": "Additional Fields",
"name": "additionalFields",
"type": "collection",
"placeholder": "Add Field",
"default": {},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"chatCreate"
]
}
},
"options": [
{
"displayName": "Max Tokens",
"name": "max_tokens",
"type": "number",
"default": 0,
"typeOptions": {
"numberPrecision": 0
},
"description": "The most tokens the answer may have. Without it we reserve 4096. A lower value reserves fewer credits.",
"routing": {
"send": {
"type": "body",
"property": "max_tokens"
}
}
},
{
"displayName": "Stream Options",
"name": "stream_options",
"type": "json",
"default": "{}",
"description": "With `stream`, send `{\"include_usage\": true}` to get the token count in the last event.",
"routing": {
"send": {
"type": "body",
"property": "stream_options",
"value": "={{ typeof $value === \"string\" ? ($value.trim() === \"\" ? undefined : JSON.parse($value)) : $value }}"
}
}
},
{
"displayName": "Temperature",
"name": "temperature",
"type": "number",
"default": 0,
"description": "From 0 to 2: lower is more predictable.",
"routing": {
"send": {
"type": "body",
"property": "temperature"
}
}
},
{
"displayName": "Tools",
"name": "tools",
"type": "json",
"default": "[]",
"description": "Functions the model may call, in the OpenAI format.",
"routing": {
"send": {
"type": "body",
"property": "tools",
"value": "={{ typeof $value === \"string\" ? ($value.trim() === \"\" ? undefined : JSON.parse($value)) : $value }}"
}
}
}
]
},
{
"displayName": "Model",
"name": "model",
"type": "string",
"default": "",
"required": true,
"description": "An `image`, `video` or `audio` model id from GET /v1/models.",
"routing": {
"send": {
"type": "body",
"property": "model"
}
},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"mediaCreate"
]
}
}
},
{
"displayName": "Input",
"name": "input",
"type": "json",
"default": "{}",
"required": true,
"description": "The fields of the model, as listed in `input` of GET /v1/models/{id}. Files (images, videos, audio) go as public URLs.",
"routing": {
"send": {
"type": "body",
"property": "input",
"value": "={{ typeof $value === \"string\" ? ($value.trim() === \"\" ? undefined : JSON.parse($value)) : $value }}"
}
},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"mediaCreate"
]
}
}
},
{
"displayName": "ID",
"name": "id",
"type": "string",
"required": true,
"default": "",
"description": "The `id` returned by POST /v1/media/generations.",
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"mediaGet"
]
}
}
},
{
"displayName": "Model",
"name": "model",
"type": "string",
"default": "",
"required": true,
"description": "A `text` model id from GET /v1/models, or `agent/<id>`. A name that is not in the catalog (such as `claude-sonnet-...`) uses our default coding model. The answer brings back the name you sent.",
"routing": {
"send": {
"type": "body",
"property": "model"
}
},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"messagesCreate"
]
}
}
},
{
"displayName": "Messages",
"name": "messages",
"type": "json",
"default": "[]",
"required": true,
"description": "The conversation, oldest first.",
"routing": {
"send": {
"type": "body",
"property": "messages",
"value": "={{ typeof $value === \"string\" ? ($value.trim() === \"\" ? undefined : JSON.parse($value)) : $value }}"
}
},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"messagesCreate"
]
}
}
},
{
"displayName": "Max Tokens",
"name": "max_tokens",
"type": "number",
"default": 0,
"typeOptions": {
"numberPrecision": 0
},
"required": true,
"description": "The most tokens the answer may have. Required. We reserve credits for this number of output tokens, so a lower value needs a smaller balance.",
"routing": {
"send": {
"type": "body",
"property": "max_tokens"
}
},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"messagesCreate"
]
}
}
},
{
"displayName": "Additional Fields",
"name": "additionalFields",
"type": "collection",
"placeholder": "Add Field",
"default": {},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"messagesCreate"
]
}
},
"options": [
{
"displayName": "Stop Sequences",
"name": "stop_sequences",
"type": "string",
"default": "",
"placeholder": "value1, value2",
"description": "Texts that end the answer when the model writes them. Comma-separated.",
"routing": {
"send": {
"type": "body",
"property": "stop_sequences",
"value": "={{ Array.isArray($value) ? $value : String($value).split(\",\").map(s => s.trim()).filter(s => s !== \"\") }}"
}
}
},
{
"displayName": "System",
"name": "system",
"type": "string",
"default": "",
"description": "The instructions, as text or as a list of `text` blocks.",
"routing": {
"send": {
"type": "body",
"property": "system"
}
}
},
{
"displayName": "Temperature",
"name": "temperature",
"type": "number",
"default": 0,
"description": "From 0 to 1: lower is more predictable.",
"routing": {
"send": {
"type": "body",
"property": "temperature"
}
}
},
{
"displayName": "Tool Choice",
"name": "tool_choice",
"type": "json",
"default": "{}",
"description": "`{\"type\": \"auto\"}`, `{\"type\": \"any\"}`, `{\"type\": \"tool\", \"name\": \"...\"}` or `{\"type\": \"none\"}`.",
"routing": {
"send": {
"type": "body",
"property": "tool_choice",
"value": "={{ typeof $value === \"string\" ? ($value.trim() === \"\" ? undefined : JSON.parse($value)) : $value }}"
}
}
},
{
"displayName": "Tools",
"name": "tools",
"type": "json",
"default": "[]",
"description": "Tools the model may call, in the Anthropic format.",
"routing": {
"send": {
"type": "body",
"property": "tools",
"value": "={{ typeof $value === \"string\" ? ($value.trim() === \"\" ? undefined : JSON.parse($value)) : $value }}"
}
}
}
]
},
{
"displayName": "Model",
"name": "model",
"type": "string",
"default": "",
"required": true,
"description": "A `text` model id from GET /v1/models, or `agent/<id>`. A name that is not in the catalog (such as `claude-sonnet-...`) uses our default coding model. The answer brings back the name you sent.",
"routing": {
"send": {
"type": "body",
"property": "model"
}
},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"messagesCountTokens"
]
}
}
},
{
"displayName": "Messages",
"name": "messages",
"type": "json",
"default": "[]",
"required": true,
"description": "The conversation, oldest first.",
"routing": {
"send": {
"type": "body",
"property": "messages",
"value": "={{ typeof $value === \"string\" ? ($value.trim() === \"\" ? undefined : JSON.parse($value)) : $value }}"
}
},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"messagesCountTokens"
]
}
}
},
{
"displayName": "Additional Fields",
"name": "additionalFields",
"type": "collection",
"placeholder": "Add Field",
"default": {},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"messagesCountTokens"
]
}
},
"options": [
{
"displayName": "System",
"name": "system",
"type": "string",
"default": "",
"description": "The instructions, as text or as a list of `text` blocks.",
"routing": {
"send": {
"type": "body",
"property": "system"
}
}
},
{
"displayName": "Tool Choice",
"name": "tool_choice",
"type": "json",
"default": "{}",
"description": "`{\"type\": \"auto\"}`, `{\"type\": \"any\"}`, `{\"type\": \"tool\", \"name\": \"...\"}` or `{\"type\": \"none\"}`.",
"routing": {
"send": {
"type": "body",
"property": "tool_choice",
"value": "={{ typeof $value === \"string\" ? ($value.trim() === \"\" ? undefined : JSON.parse($value)) : $value }}"
}
}
},
{
"displayName": "Tools",
"name": "tools",
"type": "json",
"default": "[]",
"description": "Tools the model may call, in the Anthropic format.",
"routing": {
"send": {
"type": "body",
"property": "tools",
"value": "={{ typeof $value === \"string\" ? ($value.trim() === \"\" ? undefined : JSON.parse($value)) : $value }}"
}
}
}
]
},
{
"displayName": "Model",
"name": "model",
"type": "string",
"default": "",
"required": true,
"description": "A `text` model id from GET /v1/models, or `agent/<id>`.",
"routing": {
"send": {
"type": "body",
"property": "model"
}
},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"responsesCreate"
]
}
}
},
{
"displayName": "Input",
"name": "input",
"type": "string",
"default": "",
"required": true,
"description": "The text of the request, or a list of input items.",
"routing": {
"send": {
"type": "body",
"property": "input"
}
},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"responsesCreate"
]
}
}
},
{
"displayName": "Additional Fields",
"name": "additionalFields",
"type": "collection",
"placeholder": "Add Field",
"default": {},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"responsesCreate"
]
}
},
"options": [
{
"displayName": "Instructions",
"name": "instructions",
"type": "string",
"default": "",
"description": "The instructions (the system message).",
"routing": {
"send": {
"type": "body",
"property": "instructions"
}
}
},
{
"displayName": "Max Output Tokens",
"name": "max_output_tokens",
"type": "number",
"default": 0,
"typeOptions": {
"numberPrecision": 0
},
"description": "The most tokens the answer may have. Without it we reserve 4096.",
"routing": {
"send": {
"type": "body",
"property": "max_output_tokens"
}
}
},
{
"displayName": "Previous Response ID",
"name": "previous_response_id",
"type": "string",
"default": "",
"description": "The `id` of an earlier response of the same account, to go on with that conversation without sending it again. Responses are kept for 30 days.",
"routing": {
"send": {
"type": "body",
"property": "previous_response_id"
}
}
},
{
"displayName": "Temperature",
"name": "temperature",
"type": "number",
"default": 0,
"description": "From 0 to 2: lower is more predictable.",
"routing": {
"send": {
"type": "body",
"property": "temperature"
}
}
},
{
"displayName": "Tool Choice",
"name": "tool_choice",
"type": "string",
"default": "",
"description": "`auto`, `none`, `required` or a function.",
"routing": {
"send": {
"type": "body",
"property": "tool_choice"
}
}
},
{
"displayName": "Tools",
"name": "tools",
"type": "json",
"default": "[]",
"description": "Functions the model may call: `{\"type\": \"function\", \"name\", \"description\", \"parameters\"}`.",
"routing": {
"send": {
"type": "body",
"property": "tools",
"value": "={{ typeof $value === \"string\" ? ($value.trim() === \"\" ? undefined : JSON.parse($value)) : $value }}"
}
}
}
]
},
{
"displayName": "ID",
"name": "id",
"type": "string",
"required": true,
"default": "",
"description": "The `id` returned by POST /v1/responses.",
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"responsesGet"
]
}
}
},
{
"displayName": "Quantity",
"name": "quantity",
"type": "number",
"default": 0,
"typeOptions": {
"numberPrecision": 0
},
"required": true,
"description": "Number of credits.",
"routing": {
"send": {
"type": "body",
"property": "quantity"
}
},
"displayOptions": {
"show": {
"resource": [
"ai"
],
"operation": [
"creditsPurchase"
]
}
}
}
];