openai_chat_completion
Create chat completions with OpenAI models. Send a conversation and receive AI-generated text or structured JSON responses.
Instructions
Create a chat completion using OpenAI models via AceDataCloud.
Sends a conversation to the specified model and returns the generated response.
Supports all major GPT and o-series models.
Use this when:
- You need to have a conversation with an AI model
- You want to generate text responses based on a prompt
- You need structured JSON output from a model
Returns:
JSON response containing the model's reply and usage information.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | How many chat completion choices to generate for each input. Default is 1. | |
| model | No | The model to use for chat completion. Options include gpt-4.1, gpt-4o, gpt-5, o1, o3, o4-mini, and many more. Default is gpt-4.1. | gpt-4.1 |
| messages | Yes | A list of messages comprising the conversation. Each message must have a 'role' ('system', 'user', or 'assistant') and 'content' field. Example: [{'role': 'user', 'content': 'Hello!'}] | |
| max_tokens | No | The maximum number of tokens to generate. If not specified, the model uses its default limit. | |
| temperature | No | Sampling temperature between 0 and 2. Higher values (e.g. 0.8) make output more random, lower values (e.g. 0.2) make it more focused. Default is 1. | |
| service_tier | No | Specifies the processing tier. Options: 'auto' (default), 'default', 'flex', 'scale', 'priority'. | |
| reasoning_effort | No | Constrains effort on reasoning for reasoning models. Options: 'minimal', 'low', 'medium', 'high'. Default is 'medium'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |