Skip to content

OpenAI

Generate text responses with OpenAI models

Create an OpenAI API key and copy it.

  • Used for model components like Text Prompt.
  • For OpenAI-compatible providers (e.g. Azure OpenAI, Ollama, vLLM), set a custom Base URL below.

Only required for the Get Usage Data component.

Create an Admin API key and copy it (starts with sk-admin-).

  • Only Organization Owners can create admin keys.
  • Admin keys can read organization usage and costs but cannot call model endpoints.

Unrestricted project keys work by default. If you use a restricted key, grant it:

  • Model capabilitiesRequest — required for Text Prompt.
  • Responses APIWrite — required for Text Prompt.
  • FilesWrite — required when you attach files to Text Prompt.

Note: Both keys are shown only once — store them somewhere safe before continuing.

Component key: openai.getUsage

The Get Usage Data component fetches organization usage metrics from OpenAI’s Usage and Costs APIs.

  • Usage reporting: Track token consumption and request counts across models
  • Cost tracking: Monitor daily spend with the Costs usage type
  • Analytics dashboards: Build custom dashboards with OpenAI usage data
  1. Fetches usage data for the specified date range from OpenAI’s organization Usage API
  2. Returns daily buckets of metrics, optionally grouped by model or project
  • Start Date: Start of the date range (YYYY-MM-DD format, defaults to 7 days ago)
  • End Date: End of the date range (YYYY-MM-DD format, defaults to today)
  • Usage Type: The usage category to fetch (completions, embeddings, images, audio, costs, …)
  • Group By: (Optional) Group results by model or project. Line item grouping is only available for costs; model grouping is not available for costs, vector stores, or code interpreter sessions.

The output includes daily usage buckets. Each bucket carries its time range and results with metrics that depend on the usage type, e.g. for completions:

  • Input/output/cached token counts
  • Number of model requests
  • Model and project identifiers (when grouped)

For costs, each result carries the amount value and currency per line item.

  • Requires an organization admin API key (sk-admin-…) configured in the integration
  • Admin keys are created by organization owners at platform.openai.com/settings/organization/admin-keys
  • Usage data is always fetched from the OpenAI platform API; a custom Base URL configured for model endpoints does not apply
{
"data": {
"data": [
{
"end_time": 1730505600,
"object": "bucket",
"results": [
{
"input_cached_tokens": 800,
"input_tokens": 1000,
"model": "gpt-5.2",
"num_model_requests": 5,
"object": "organization.usage.completions.result",
"output_tokens": 500
}
],
"start_time": 1730419200
}
],
"period": {
"endDate": "2026-07-03",
"startDate": "2026-06-26"
},
"usageType": "completions"
},
"timestamp": "2026-07-03T12:00:00.000000000Z",
"type": "openai.getUsage.result"
}

Component key: openai.textPrompt

The Text Prompt component generates text responses using OpenAI’s language models.

  • Content generation: Generate text content, summaries, or descriptions
  • Natural language processing: Process and transform text using AI
  • Automated responses: Generate responses to user queries or events
  • Data transformation: Convert structured data into natural language
  • Model: Select the OpenAI model to use (e.g., gpt-4, gpt-3.5-turbo)
  • Prompt: The text prompt to send to the model (supports expressions)
  • Files: (Optional) Attach files from the Files tab (images, PDFs, or text). They are uploaded to the OpenAI Files API and sent alongside the prompt.
  • Code Interpreter: (Optional) Let the model write and run Python in a sandboxed container. Files it creates are emitted as artifacts.
  • Structured Output: (Optional) Provide a JSON Schema for the response and the model returns JSON matching it, available on the parsed output. The schema is validated before the request and sent in OpenAI strict mode; strict mode marks every property required, so express optional fields by making their type nullable.

Returns the generated response including:

  • text: The generated text response
  • model: The model used for generation
  • usage: Token usage information (prompt tokens, completion tokens, total tokens)
  • id: Response ID for tracking
  • parsed: When Structured Output is configured, the response parsed into an object.
  • artifacts: When Code Interpreter is enabled, the files the model generated, with the file content included: text files as plain text (encoding: "text"), everything else base64-encoded (encoding: "base64"). Each artifact carries fileId, containerId, filename, bytes, and a downloadUrl; files over 10MB include metadata and the download URL only (note that containers expire about 20 minutes after their last activity).
  • Requires a valid OpenAI API key configured in the application settings
  • Response quality and speed depend on the selected model
  • Token usage is tracked and may incur costs based on your OpenAI plan
  • Supports OpenAI-compatible providers by setting a custom Base URL in the integration settings (e.g., Azure OpenAI, Ollama, vLLM). Note: structured output uses the OpenAI Responses API text.format parameter and may not be supported by all compatible providers.
{
"data": {
"artifacts": [
{
"bytes": 34567,
"containerId": "cntr_682e0e7318108198aa783fd921ff305e",
"content": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==",
"downloadUrl": "https://api.openai.com/v1/containers/cntr_682e0e7318108198aa783fd921ff305e/files/cfile_682e0e8a43c88191a7978f477a09bdf5/content",
"encoding": "base64",
"fileId": "cfile_682e0e8a43c88191a7978f477a09bdf5",
"filename": "plot.png"
}
],
"id": "cmpl-1234567890",
"model": "gpt-5.2",
"parsed": {
"language": "en",
"summary": "Hello, world!"
},
"text": "Hello, world!",
"usage": {
"input_tokens": 10,
"output_tokens": 10,
"total_tokens": 20
}
},
"timestamp": "2026-01-19T12:00:00Z",
"type": "openai.response"
}