Overview
The OpenAI Studio node's "Analyze Image" operation allows you to analyze images using OpenAI's GPT models with vision capabilities (such as GPT-4o). You provide an image URL and a prompt describing what you want the model to do (e.g., "Describe the objects in this image"), and the node returns the model's analysis or description of the image. This is useful for scenarios like automated content moderation, generating alt text, extracting information from images, or building visual question-answering workflows.
Example use cases:
- Automatically generate descriptions for uploaded product photos.
- Extract text or summarize the contents of screenshots.
- Build chatbots that can answer questions about images provided by users.
Properties
| Name | Type | Meaning |
|---|---|---|
| Model | options | The OpenAI model to use for image analysis (e.g., GPT-4o, GPT-4 Turbo, etc.). |
| Prompt | string | The instruction or question to send to the model regarding the image. |
| Image URL Field | string | The name of the field in the input data that contains the image URL to analyze. |
| Advanced Parameters | collection | Additional settings to control model behavior (see below for details). |
Advanced Parameters (collection):
- Temperature (number): Controls randomness; higher values produce more creative output.
- Top P (number): Nucleus sampling; considers tokens with top_p probability mass.
- Maximum Output Tokens (number): Maximum number of tokens to generate in the response.
- System Prompt (string): System message to set assistant behavior.
- Presence Penalty (number): Penalizes new tokens based on their presence so far.
- Frequency Penalty (number): Penalizes new tokens based on their frequency so far.
- Response Format (options): Desired format of the response (Auto, JSON, Text).
- Tool Calling (boolean): Not applicable for image analysis.
- Tools Definition (string): Not applicable for image analysis.
- Embedding Dimensions (number): Not applicable for image analysis.
Output
The node outputs a single item per input, with the following structure in the json field:
{
// ...original input fields,
"openaiResponse": {
// Full response object returned by the OpenAI API for image analysis.
// Typically includes:
"id": "...",
"object": "chat.completion",
"created": 1234567890,
"model": "...",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "..." // The model's analysis or description of the image.
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": ...,
"completion_tokens": ...,
"total_tokens": ...
}
}
}
- The most relevant result is typically found at
openaiResponse.choices[0].message.content.
Dependencies
- External Service: Requires access to the OpenAI API.
- API Key: Must be configured via n8n credentials (
openAiApi), including the API key and optionally organization ID and custom endpoint. - Dependency: Uses the
axioslibrary for HTTP requests (bundled with n8n).
Troubleshooting
Common Issues:
Missing Image URL: If the specified image URL field is empty or missing, the node will throw an error:
"Image URL is required for image analysis".
Resolution: Ensure your input data contains the correct field with a valid image URL.Invalid API Key or Organization: If authentication fails, you'll receive an error such as:
"OpenAI API Error: 401 - ...".
Resolution: Check your OpenAI API credentials in n8n.Model Selection: Using a model without vision capabilities (e.g., GPT-3.5 Turbo) may result in errors or unexpected results.
Resolution: Use a model like GPT-4o or GPT-4 Turbo for image analysis.API Errors: Any other API error will be reported with the status code and message from OpenAI.