OpenAI LLM
Category: AI & ML
Node id: openai-llm
OpenAI LLM inference with streaming support and full parameter control
What it does
- OpenAI API integration with full parameter control
- Streaming and non-streaming response modes
- Multi-turn conversation support
- Custom base URL for API-compatible endpoints
- Token usage and chunk-level metadata tracking
- Frequency and presence penalty tuning
Use cases
- Production LLM inference via OpenAI models (GPT-4, GPT-4o)
- Streaming chat interfaces with real-time token delivery
- Multi-turn conversational agents
- Using OpenAI-compatible endpoints (Azure, local proxies)
Runtime
- Performance tier:
variable
Input ports
| Name | Type | Required | Description |
|---|---|---|---|
prompt | text | No | Single user prompt |
messages | json | No | Multi-turn conversation messages array |
Output ports
| Name | Type | Required | Description |
|---|---|---|---|
result | json | No | Main result containing response and finish_reason |
metadata | json | No | Execution metadata including tokens, chunk_count, and stream |
success | boolean | No | Whether the operation succeeded |
Settings
Basic
| Setting | Name | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|---|
| Model | model | string | Yes | gpt-4 | OpenAI model name | |
| System Prompt | system_prompt | text | No | "" | System prompt to prepend | |
| Stream | stream | boolean | No | false | Enable streaming responses |
Auth
| Setting | Name | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|---|
| API Key | api_key | secret | No | OpenAI API key (or set OPENAI_API_KEY env var) | ||
| Base URL | base_url | string | No | "" | Custom API base URL |
Advanced
| Setting | Name | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|---|
| Temperature | temperature | number | No | 0.7 | min 0; max 2 | Sampling temperature |
| Max Tokens | max_tokens | number | No | 1000 | min 1 | Maximum tokens to generate |
| Top P | top_p | number | No | 1 | min 0; max 1 | Nucleus sampling parameter |
| Frequency Penalty | frequency_penalty | number | No | 0 | min -2; max 2 | Penalize frequent tokens |
| Presence Penalty | presence_penalty | number | No | 0 | min -2; max 2 | Penalize already-present tokens |
Errors
| Code | Description |
|---|---|
API_KEY_MISSING | OpenAI API key not found in config or OPENAI_API_KEY env var |
MODEL_REQUIRED | Model name must be specified |
API_CALL_FAILED | OpenAI API request returned an error |
INPUT_REQUIRED | Either prompt or messages input must be provided |
Runtime notes
- result.response contains the full text; for streaming, chunks are in metadata.chunks
- API key falls back to the OPENAI_API_KEY environment variable when not set in config
- Provide either 'prompt' (single turn) or 'messages' (multi-turn); both are optional but one is required
- When streaming, metadata.chunk_count > 0 and metadata.stream = true
See Build any workflow for how to put nodes together and Ports, types and data flow for how port types connect.
Quelque chose n'est pas clair ? Envoyez vos commentaires sur la documentation par courriel.