Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • Wolfram Notebook Assistant + LLM Kit

    All-in-one AI assistance for your Wolfram experience

  • System Modeler
  • Wolfram Player
  • Finance Platform
  • Wolfram Engine
  • Enterprise Private Cloud
  • Application Server
  • Wolfram|Alpha Notebook Edition
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • AI & Linguistic Understanding

Deployment Options

  • Wolfram Cloud
  • wolframscript
  • Wolfram Engine Community Edition
  • Wolfram LLM API
  • WSTPServer
  • Wolfram|Alpha APIs

From the Community

  • Function Repository
  • Community Paclet Repository
  • Example Repository
  • Neural Net Repository
  • Prompt Repository
  • Wolfram Demonstrations
  • Data Repository
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

  • Data & Computational Intelligence
  • Model-Based Design
  • Algorithm Development
  • Wolfram|Alpha for Business
  • Blockchain Technology
  • Education Technology
  • Quantum Computation

WolframConsulting.com

Wolfram Solutions

  • Data Science
  • Artificial Intelligence
  • Biosciences
  • Healthcare Intelligence
  • Sustainable Energy
  • Control Systems
  • Enterprise Wolfram|Alpha
  • Blockchain Labs

More Wolfram Solutions

Wolfram Solutions For Education

  • Research Universities
  • Colleges & Teaching Universities
  • Junior & Community Colleges
  • High Schools
  • Educational Technology
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM/STEAM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
Wolfram|Alpha
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • Wolfram Notebook Assistant + LLM Kit
    • System Modeler
    • Wolfram Player
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Wolfram Engine
    • Enterprise Private Cloud
    • Application Server
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • AI & Linguistic Understanding
    • Deployment Options
      • Wolfram Cloud
      • wolframscript
      • Wolfram Engine Community Edition
      • Wolfram LLM API
      • WSTPServer
      • Wolfram|Alpha APIs
    • From the Community
      • Function Repository
      • Community Paclet Repository
      • Example Repository
      • Neural Net Repository
      • Prompt Repository
      • Wolfram Demonstrations
      • Data Repository
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions

    We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

    WolframConsulting.com

    Wolfram Solutions

    • Data Science
    • Artificial Intelligence
    • Biosciences
    • Healthcare Intelligence
    • Sustainable Energy
    • Control Systems
    • Enterprise Wolfram|Alpha
    • Blockchain Labs

    More Wolfram Solutions

    Wolfram Solutions For Education

    • Research Universities
    • Colleges & Teaching Universities
    • Junior & Community Colleges
    • High Schools
    • Educational Technology
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM/STEAM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • Wolfram|Alpha
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
"OpenAI" (Service Connection)
  • See Also
    • ServiceExecute
    • ServiceConnect
    • LLMFunction
    • LLMSynthesize
    • ChatEvaluate
    • LLMConfiguration
    • ImageSynthesize
    • SpeechRecognize

    • Service Connections
    • AlephAlpha
    • Anthropic
    • Cohere
    • DeepSeek
    • GoogleGemini
    • Groq
    • MistralAI
    • TogetherAI
    • GoogleSpeech
    • See Also
      • ServiceExecute
      • ServiceConnect
      • LLMFunction
      • LLMSynthesize
      • ChatEvaluate
      • LLMConfiguration
      • ImageSynthesize
      • SpeechRecognize

      • Service Connections
      • AlephAlpha
      • Anthropic
      • Cohere
      • DeepSeek
      • GoogleGemini
      • Groq
      • MistralAI
      • TogetherAI
      • GoogleSpeech
SERVICE CONNECTION
  • See Also
    • ServiceExecute
    • ServiceConnect
    • LLMFunction
    • LLMSynthesize
    • ChatEvaluate
    • LLMConfiguration
    • ImageSynthesize
    • SpeechRecognize

    • Service Connections
    • AlephAlpha
    • Anthropic
    • Cohere
    • DeepSeek
    • GoogleGemini
    • Groq
    • MistralAI
    • TogetherAI
    • GoogleSpeech
    • See Also
      • ServiceExecute
      • ServiceConnect
      • LLMFunction
      • LLMSynthesize
      • ChatEvaluate
      • LLMConfiguration
      • ImageSynthesize
      • SpeechRecognize

      • Service Connections
      • AlephAlpha
      • Anthropic
      • Cohere
      • DeepSeek
      • GoogleGemini
      • Groq
      • MistralAI
      • TogetherAI
      • GoogleSpeech

"OpenAI" (Service Connection)

This service connection requires LLM access »
Use the OpenAI API with the Wolfram Language.

Connecting & Authenticating

ServiceConnect["OpenAI"] creates a connection to the OpenAI API. If a previously saved connection can be found, it will be used; otherwise, a new authentication request will be launched. »
Use of this connection requires internet access and an OpenAI account.

Requests

ServiceExecute["OpenAI","Requests"] gives a list of all available requests.
ServiceExecute["OpenAI","request",params] sends a request to the OpenAI API, using parameters params. The following gives possible requests.
The list of available requests and their output formats may change with API updates in different versions of the Wolfram Language.

"TestConnection" — returns Success for working connection, Failure otherwise

Text

"Completion" — create text completion for a given prompt

Parameters:
  • "Prompt"(required)the prompt for which to generate completions
    "BestOf"Automaticnumber of completions to generate before selecting the "best"
    "Echo"Automaticinclude the prompt in the completion
    "FrequencyPenalty"Automaticpenalize tokens based on their existing frequency in the text so far (between -2 and 2)
    "LogProbs"Automaticinclude the log probabilities on the most likely tokens, as well as the chosen tokens (between 0 and 5)
    "MaxTokens"Automaticmaximum number of tokens to generate
    "Model"Automaticname of the model to use
    "N"Automaticnumber of completions to return
    "PresencePenalty"Automaticpenalize new tokens based on whether they appear in the text so far (between -2 and 2)
    "StopTokens"Noneup to four strings where the API will stop generating further tokens
    "Stream"Automaticreturn the result as server-sent events
    "Suffix"Automaticsuffix that comes after a completion
    "Temperature"Automaticsampling temperature (between 0 and 2)
    "ToolChoice"Automaticwhich (if any) tool is called by the model
    "Tools"Automaticone or more LLMTool objects available to the model
    "TotalProbabilityCutoff"Nonean alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with the requested probability mass
    "User"Automaticunique identifier representing the end user
  • "Chat" — create a response for the given chat conversation

    Parameters:
  • "Messages"(required)a list of messages in the conversation, each given as an association with "Role" and "Content" keys
    "FrequencyPenalty"Automaticpenalize tokens based on their existing frequency in the text so far (between -2 and 2)
    "LogProbs"Automaticinclude the log probabilities on the most likely tokens, as well as the chosen tokens (between 0 and 5)
    "MaxTokens"Automaticmaximum number of tokens to generate
    "Model"Automaticname of the model to use
    "N"Automaticnumber of chat completions to return
    "PresencePenalty"Automaticpenalize new tokens based on whether they appear in the text so far (between -2 and 2)
    "StopTokens"Noneup to four strings where the API will stop generating further tokens
    "Stream"Automaticreturn the result as server-sent events
    "Suffix"Automaticsuffix that comes after a completion
    "Temperature"Automaticsampling temperature (between 0 and 2)
    "ToolChoice"Automaticwhich (if any) tool is called by the model
    "Tools"Automaticone or more LLMTool objects available to the model
    "TotalProbabilityCutoff"Nonean alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with the requested probability mass
    "User"Automaticunique identifier representing the end user
  • "Embedding" — create an embedding vector representing the input text

    Parameters:
  • "Input"(required)one or a list of texts to get embeddings for
    "EncodingFormat"Automaticformat to return the embeddings
    "EncodingLength"Automaticnumber of dimensions of the result
    "Model"Automaticname of the model to use
    "User"Automaticunique identifier representing the end user
  • Image

    "ImageCreate" — create a square image given a prompt

    Parameters:
  • "Prompt"(required)text description of the desired image
    "Model"Automaticname of the model to use
    "N"Automaticnumber of images to generate
    "Quality"Automaticcontrol the quality of the result; possible values include "hd"
    "Size"Automaticsize of the generated image
    "Style"Automaticstyle of generated images; possible values include "vivid" or "natural"
    "User"Automaticunique identifier representing the end user
  • "ImageVariation" — create a variation of a given image

    Parameters:
  • "Image"(required)image to use as the basis for the variation
    "N"Automaticnumber of images to generate
    "Size"Automaticsize of the generated image
    "User"Automaticunique identifier representing the end user
  • "ImageEdit" — create an edited image given an original image and a prompt

    Parameters:
  • "Image"(required)image to edit; requires an alpha channel if a mask is not provided
    "Mask"Noneadditional image whose fully transparent areas indicate where the input should be edited
    "N"Automaticnumber of images to generate
    "Prompt"Nonetext description of the desired image edit
    "Size"Automaticsize of the generated image
    "User"Automaticunique identifier representing the end user
  • Audio

    "AudioTranscription" — transcribe an audio recording into the input language

    Parameters:
  • "Audio"(required)the Audio object to transcribe
    "Language"Automaticlanguage of the input audio
    "Model"Automaticname of the model to use
    "Prompt"Noneoptional text to guide the model's style or continue a previous audio segment
    "Temperature"Automaticsampling temperature (between 0 and 1)
    "TimestampGranularities"Automaticthe timestamp granularity of transcription (either "word" or "segment")
  • "AudioTranslation" — translate an audio recording into English

    Parameters:
  • "Audio"(required)the Audio object to translate
    "Model"Automaticname of the model to use
    "Prompt"Noneoptional text to guide the model's style or continue a previous audio segment
    "Temperature"Automaticsampling temperature (between 0 and 1)
  • "SpeechSynthesize" — synthesize speech from text

    Parameters:
  • "Input"(required)the text to synthesize
    "Model"Automaticname of the model to use
    "Speed"Automaticthe speed of the produced speech
    "Voice"Automaticthe voice to use for the synthesis
  • Model Lists

    "ChatModelList" — list models available for the "Chat" request

    "CompletionModelList" — list models available for the "Completion" request

    "EmbeddingModelList" — list models available for the "Embedding" request

    "ModerationModelList" — list models available for the "Moderation" request

    "ImageModelList" — list models available for the image-related requests

    "SpeechSynthesizeModelList" — list models available for the "SpeechSynthesize" request

    "AudioModelList" — list models available for the "AudioTranscribe" request

    Moderation

    "Moderation" — classify if text violates OpenAI's Content Policy

    Parameters:
  • "Input"(required)the text to classify
    "Model"Automaticname of the model to use
  • Examples

    open all close all

    Basic Examples  (1)

    Create a new connection:

    Complete a piece of text:

    Generate a response from a chat:

    Compute the embedding for a sentence:

    Generate an Image from a prompt:

    Transcribe an Audio object:

    Synthesize a piece of text:

    Scope  (10)

    Text  (4)

    Completion  (1)

    Change the sampling temperature:

    Increase the number of characters returned:

    Return multiple completions:

    Include the prompt in the returned completion:

    Chat  (2)

    Respond to a chat containing multiple messages:

    Change the sampling temperature:

    Increase the number of characters returned:

    Return multiple completions:

    Allow the model to use an LLMTool:

    Send multimodal input:

    Send a chat request asynchronously using ServiceSubmit and collect the response using the HandlerFunctions and HandlerFunctionsKeys options:

    Embedding  (1)

    Compute the embedding for multiple sentences:

    Plot the results:

    Compute the embeddings for a list of words:

    Plot the results:

    Image  (3)

    ImageCreate  (1)

    Create an Image:

    Return multiple results:

    Change the size of the returned Image:

    Use a different model:

    ImageVariation  (1)

    Create a variation of an Image:

    Return multiple results:

    Change the size of the returned Image:

    ImageEdit  (1)

    Use an Image with an alpha channel to indicate where the editing will take place:

    Use a non-transparent Image and a mask to indicate where the editing will take place:

    Return multiple results:

    Change the size of the returned Image:

    Audio  (3)

    AudioTranscription  (1)

    Transcribe an Audio object:

    Use a prompt to provide context for the transcription:

    Transcribe a recording made in a different language:

    Increase the temperature used for the sampling:

    Include timestamps in the transcription:

    AudioTranslation  (1)

    Translate an Audio object into English:

    Use a prompt to provide context for the translation:

    Increase the temperature used for the sampling:

    SpeechSynthesize  (1)

    Synthesize a piece of text:

    Use a different voice for the synthesis:

    Authentication  (4)

    If no connections exist, ServiceConnect will prompt a dialog where an API key can be entered:

    The API key can also be specified using the Authentication option:

    Use credentials stored in SystemCredential:

    The credentials are stored directly by the framework, since SystemCredential["key"] evaluates to a string:

    Only store the SystemCredential key rather than its value by using RuleDelayed:

    Retrieve the value of the authentication credentials used in a specific service object:

    Overwrite the authentication credentials of an existing service object:

    See Also

    ServiceExecute  ▪  ServiceConnect  ▪  LLMFunction  ▪  LLMSynthesize  ▪  ChatEvaluate  ▪  LLMConfiguration  ▪  ImageSynthesize  ▪  SpeechRecognize

    Service Connections: AlephAlpha  ▪  Anthropic  ▪  Cohere  ▪  DeepSeek  ▪  GoogleGemini  ▪  Groq  ▪  MistralAI  ▪  TogetherAI  ▪  GoogleSpeech

    History

    Introduced in 2023 (13.3)

    Top
    Introduction for Programmers
    Introductory Book
    Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
    Top
    • Products
    • Wolfram|One
    • Mathematica
    • Notebook Assistant + LLM Kit
    • System Modeler

    • Wolfram|Alpha Notebook Edition
    • Wolfram|Alpha Pro
    • Mobile Apps

    • Wolfram Player
    • Wolfram Engine

    • Volume & Site Licensing
    • Server Deployment Options
    • Consulting
    • Wolfram Consulting
    • Repositories
    • Data Repository
    • Function Repository
    • Community Paclet Repository
    • Neural Net Repository
    • Prompt Repository

    • Wolfram Language Example Repository
    • Notebook Archive
    • Wolfram GitHub
    • Learning
    • Wolfram U
    • Wolfram Language Documentation
    • Webinars & Training
    • Educational Programs

    • Wolfram Language Introduction
    • Fast Introduction for Programmers
    • Fast Introduction for Math Students
    • Books

    • Wolfram Community
    • Wolfram Blog
    • Public Resources
    • Wolfram|Alpha
    • Wolfram Problem Generator
    • Wolfram Challenges

    • Computer-Based Math
    • Computational Thinking
    • Computational Adventures

    • Demonstrations Project
    • Wolfram Data Drop
    • MathWorld
    • Wolfram Science
    • Wolfram Media Publishing
    • Customer Resources
    • Store
    • Product Downloads
    • User Portal
    • Your Account
    • Organization Access

    • Support FAQ
    • Contact Support
    • Company
    • About Wolfram
    • Careers
    • Contact
    • Events
    Wolfram Community Wolfram Blog
    Legal & Privacy Policy
    WolframAlpha.com | WolframCloud.com
    © 2025 Wolfram
    © 2025 Wolfram | Legal & Privacy Policy |
    English