OpenAI
Access GPT-4o, DALL-E 3, Whisper, TTS, embeddings, and fine-tuning through the OpenAI API.
OFFICIALBEARER0 INSTALLS
OpenAPI Specificationv3.0.3
{
"openapi": "3.0.3",
"info": {
"title": "OpenAI API",
"version": "2.0.0",
"description": "OpenAI provides AI models for text generation, embeddings, and more. Use this API to generate chat completions, create text embeddings for search and similarity, and list available models. Supports GPT-4, GPT-3.5-turbo, and embedding models."
},
"servers": [
{
"url": "https://api.openai.com/v1"
}
],
"paths": {
"/chat/completions": {
"post": {
"operationId": "createChatCompletion",
"summary": "Create a chat completion",
"description": "Generate a model response for a conversation. Use this to get AI-generated text, answer questions, summarize content, translate text, write code, or perform any text-based task. Provide a list of messages representing the conversation history and the model will generate the next assistant response. Returns the generated message along with token usage statistics and a finish reason.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"model",
"messages"
],
"properties": {
"model": {
"type": "string",
"description": "The model ID to use for completion (e.g. 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo'). Determines the model's capabilities, speed, and cost. Use 'gpt-4' for highest quality, 'gpt-3.5-turbo' for faster and cheaper responses."
},
"messages": {
"type": "array",
"description": "The conversation messages. Each message has a 'role' (system/user/assistant) and 'content'. The system message sets behavior, user messages are inputs, and assistant messages are prior responses. Provide the full conversation history for context-aware responses.",
"items": {
"type": "object",
"required": [
"role",
"content"
],
"properties": {
"role": {
"type": "string",
"description": "The role of the message author. 'system' sets the assistant's behavior, 'user' is the human input, 'assistant' is a prior model response.",
"enum": [
"system",
"user",
"assistant"
]
},
"content": {
"type": "string",
"description": "The text content of the message."
}
}
}
},
"temperature": {
"type": "number",
"description": "Sampling temperature between 0 and 2. Lower values (e.g. 0.2) produce more focused and deterministic output. Higher values (e.g. 1.0) produce more creative and varied output. Defaults to 1.",
"minimum": 0,
"maximum": 2,
"default": 1
},
"max_tokens": {
"type": "integer",
"description": "The maximum number of tokens to generate in the response. One token is roughly 4 characters. Set this to control response length and cost. If omitted, the model generates until it finishes or hits its context limit."
},
"top_p": {
"type": "number",
"description": "Nucleus sampling parameter (0-1). The model considers tokens with cumulative probability up to this value. An alternative to temperature — use one or the other, not both. Defaults to 1.",
"minimum": 0,
"maximum": 1,
"default": 1
},
"n": {
"type": "integer",
"description": "Number of completion choices to generate. Defaults to 1. Higher values increase cost proportionally.",
"default": 1
}
}
}
}
}
},
"responses": {
"200": {
"description": "The completion response containing id, model, choices (each with message content, role, and finish_reason), and usage statistics (prompt_tokens, completion_tokens, total_tokens)."
}
}
}
},
"/embeddings": {
"post": {
"operationId": "createEmbedding",
"summary": "Create embeddings",
"description": "Generate vector embeddings for input text. Use this to create numerical representations of text for semantic search, clustering, recommendations, or similarity comparisons. Each input string is converted to a high-dimensional float vector. Returns an array of embedding objects, one per input string, with the vector data and token usage.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"model",
"input"
],
"properties": {
"model": {
"type": "string",
"description": "The embedding model ID to use (e.g. 'text-embedding-3-small', 'text-embedding-3-large', 'text-embedding-ada-002'). Different models produce different vector dimensions and quality levels."
},
"input": {
"description": "The text to generate embeddings for. Can be a single string or an array of strings for batch processing. Each string should be under 8,192 tokens for most models.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"encoding_format": {
"type": "string",
"description": "The format for the returned embeddings. 'float' returns an array of floats (default), 'base64' returns a base64-encoded string.",
"enum": [
"float",
"base64"
],
"default": "float"
}
}
}
}
}
},
"responses": {
"200": {
"description": "An object containing the embedding data array (each with index and embedding vector), the model used, and usage statistics (prompt_tokens, total_tokens)."
}
}
}
},
"/models": {
"get": {
"operationId": "listModels",
"summary": "List models",
"description": "Retrieve a list of all models available to your OpenAI account. Use this to discover which models you have access to, check model availability, or find the exact model ID string needed for other API calls. Returns model objects with their IDs, owner, and creation timestamps.",
"responses": {
"200": {
"description": "An object with a data array of model objects. Each model includes id (the string to use in API calls), object type, created timestamp, and owned_by (e.g. 'openai', 'system')."
}
}
}
}
}
}