Skip to main content

Mistral AI API (1.0.0)

Download OpenAPI specification:Download

Our Chat Completion and Embeddings APIs specification. Create your account on La Plateforme to get access and read the docs to learn how to use it.

Chat

Chat Completion API.

Chat Completion

Authorizations:
ApiKey
Request Body schema: application/json
required
model
required
string (Model)

ID of the model to use. You can use the List Available Models API to see all of your available models, or see our Model overview for model descriptions.

Temperature (number) or Temperature (null) (Temperature)

What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both. The default value varies depending on the model you are targeting. Call the /models endpoint to retrieve the appropriate value.

top_p
number (Top P) [ 0 .. 1 ]
Default: 1

Nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.

Max Tokens (integer) or Max Tokens (null) (Max Tokens)

The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length.

stream
boolean (Stream)
Default: false

Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.

Stop (string) or Array of Stop (strings) (Stop)

Stop generation if this token is detected. Or if one of these tokens is detected when providing an array

Random Seed (integer) or Random Seed (null) (Random Seed)

The seed to use for random sampling. If set, different calls will generate deterministic results.

required
Array of any (Messages)

The prompt(s) to generate completions for, encoded as a list of dict with role and content.

object (ResponseFormat)
Array of Tools (objects) or Tools (null) (Tools)
ToolChoice (object) or ToolChoiceEnum (string) (Tool Choice)
Default: "auto"
presence_penalty
number (Presence Penalty) [ -2 .. 2 ]
Default: 0

presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative.

frequency_penalty
number (Frequency Penalty) [ -2 .. 2 ]
Default: 0

frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition.

N (integer) or N (null) (N)

Number of completions to return for each request, input tokens are only billed once.

object (Prediction)
Default: {"type":"content","content":""}

Enable users to specify expected results, optimizing response times by leveraging known or predictable content. This approach is especially effective for updating text documents or code files with minimal changes, reducing latency while maintaining high-quality results.

parallel_tool_calls
boolean (Parallel Tool Calls)
Default: true
safe_prompt
boolean
Default: false

Whether to inject a safety prompt before all conversations.

Responses

Request samples

Content type
application/json
{
  • "model": "mistral-small-latest",
  • "temperature": 1.5,
  • "top_p": 1,
  • "max_tokens": 0,
  • "stream": false,
  • "stop": "string",
  • "random_seed": 0,
  • "messages": [
    ],
  • "response_format": {
    },
  • "tools": [
    ],
  • "tool_choice": "auto",
  • "presence_penalty": 0,
  • "frequency_penalty": 0,
  • "n": 1,
  • "prediction": {
    },
  • "parallel_tool_calls": true,
  • "safe_prompt": false
}

Response samples

Content type
{
  • "id": "cmpl-e5cc70bb28c444948073e77776eb30ef",
  • "object": "chat.completion",
  • "model": "mistral-small-latest",
  • "usage": {
    },
  • "created": 1702256327,
  • "choices": [
    ]
}

FIM

Fill-in-the-middle API.

Fim Completion

FIM completion.

Authorizations:
ApiKey
Request Body schema: application/json
required
model
required
string (Model)
Default: "codestral-2405"

ID of the model to use. Only compatible for now with:

  • codestral-2405
  • codestral-latest
Temperature (number) or Temperature (null) (Temperature)

What sampling temperature to use, we recommend between 0.0 and 0.7. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both. The default value varies depending on the model you are targeting. Call the /models endpoint to retrieve the appropriate value.

top_p
number (Top P) [ 0 .. 1 ]
Default: 1

Nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.

Max Tokens (integer) or Max Tokens (null) (Max Tokens)

The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length.

stream
boolean (Stream)
Default: false

Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.

Stop (string) or Array of Stop (strings) (Stop)

Stop generation if this token is detected. Or if one of these tokens is detected when providing an array

Random Seed (integer) or Random Seed (null) (Random Seed)

The seed to use for random sampling. If set, different calls will generate deterministic results.

prompt
required
string (Prompt)

The text/code to complete.

Suffix (string) or Suffix (null) (Suffix)
Default: ""

Optional text/code that adds more context for the model. When given a prompt and a suffix the model will fill what is between them. When suffix is not provided, the model will simply execute completion starting with prompt.

Min Tokens (integer) or Min Tokens (null) (Min Tokens)

The minimum number of tokens to generate in the completion.

Responses

Request samples

Content type
application/json
{
  • "model": "codestral-2405",
  • "temperature": 1.5,
  • "top_p": 1,
  • "max_tokens": 0,
  • "stream": false,
  • "stop": "string",
  • "random_seed": 0,
  • "prompt": "def",
  • "suffix": "return a+b",
  • "min_tokens": 0
}

Response samples

Content type
{
  • "id": "cmpl-e5cc70bb28c444948073e77776eb30ef",
  • "object": "chat.completion",
  • "model": "codestral-latest",
  • "usage": {
    },
  • "created": 1702256327,
  • "choices": [
    ]
}

Agents

Agents API.

Agents Completion

Authorizations:
ApiKey
Request Body schema: application/json
required
Max Tokens (integer) or Max Tokens (null) (Max Tokens)

The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length.

stream
boolean (Stream)
Default: false

Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.

Stop (string) or Array of Stop (strings) (Stop)

Stop generation if this token is detected. Or if one of these tokens is detected when providing an array

Random Seed (integer) or Random Seed (null) (Random Seed)

The seed to use for random sampling. If set, different calls will generate deterministic results.

required
Array of any (Messages)

The prompt(s) to generate completions for, encoded as a list of dict with role and content.

object (ResponseFormat)
Array of Tools (objects) or Tools (null) (Tools)
ToolChoice (object) or ToolChoiceEnum (string) (Tool Choice)
Default: "auto"
presence_penalty
number (Presence Penalty) [ -2 .. 2 ]
Default: 0

presence_penalty determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative.

frequency_penalty
number (Frequency Penalty) [ -2 .. 2 ]
Default: 0

frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition.

N (integer) or N (null) (N)

Number of completions to return for each request, input tokens are only billed once.

object (Prediction)
Default: {"type":"content","content":""}

Enable users to specify expected results, optimizing response times by leveraging known or predictable content. This approach is especially effective for updating text documents or code files with minimal changes, reducing latency while maintaining high-quality results.

parallel_tool_calls
boolean (Parallel Tool Calls)
Default: true
agent_id
required
string

The ID of the agent to use for this completion.

Responses

Request samples

Content type
application/json
{
  • "max_tokens": 0,
  • "stream": false,
  • "stop": "string",
  • "random_seed": 0,
  • "messages": [
    ],
  • "response_format": {
    },
  • "tools": [
    ],
  • "tool_choice": "auto",
  • "presence_penalty": 0,
  • "frequency_penalty": 0,
  • "n": 1,
  • "prediction": {
    },
  • "parallel_tool_calls": true,
  • "agent_id": "string"
}

Response samples

Content type
application/json
{
  • "id": "cmpl-e5cc70bb28c444948073e77776eb30ef",
  • "object": "chat.completion",
  • "model": "mistral-small-latest",
  • "usage": {
    },
  • "created": 1702256327,
  • "choices": [
    ]
}

Embeddings

Embeddings API.

Embeddings

Embeddings

Authorizations:
ApiKey
Request Body schema: application/json
required
model
required
string (Model)

ID of the model to use.

required
Input (string) or Array of Input (strings) (Input)

Text to embed.

Responses

Request samples

Content type
application/json
{
  • "model": "mistral-embed",
  • "input": [
    ]
}

Response samples

Content type
application/json
{
  • "id": "cmpl-e5cc70bb28c444948073e77776eb30ef",
  • "object": "chat.completion",
  • "model": "mistral-small-latest",
  • "usage": {
    },
  • "data": [
    ]
}

Classifiers

Classifiers API.

Moderations

Authorizations:
ApiKey
Request Body schema: application/json
required
model
required
string (Model)

ID of the model to use.

required
Input (string) or Array of Input (strings) (Input)

Text to classify.

Responses

Request samples

Content type
application/json
{
  • "model": "string",
  • "input": "string"
}

Response samples

Content type
application/json
{
  • "id": "mod-e5cc70bb28c444948073e77776eb30ef",
  • "model": "string",
  • "results": [
    ]
}

Chat Moderations

Authorizations:
ApiKey
Request Body schema: application/json
required
required
Array of Input (any) or Array of Input (any) (Input)

Chat to classify

model
required
string (Model)

Responses

Request samples

Content type
application/json
{
  • "input": [
    ],
  • "model": "string"
}

Response samples

Content type
application/json
{
  • "id": "mod-e5cc70bb28c444948073e77776eb30ef",
  • "model": "string",
  • "results": [
    ]
}

Classifications

Authorizations:
ApiKey
Request Body schema: application/json
required
model
required
string (Model)

ID of the model to use.

required
Input (string) or Array of Input (strings) (Input)

Text to classify.

Responses

Request samples

Content type
application/json
{
  • "model": "string",
  • "input": "string"
}

Response samples

Content type
application/json
{
  • "id": "mod-e5cc70bb28c444948073e77776eb30ef",
  • "model": "string",
  • "results": [
    ]
}

Chat Classifications

Authorizations:
ApiKey
Request Body schema: application/json
required
model
required
string (Model)
required
InstructRequest (object) or Array of ChatClassificationRequestInputs (objects) (ChatClassificationRequestInputs)

Chat to classify

Responses

Request samples

Content type
application/json
{
  • "model": "string",
  • "input": {
    }
}

Response samples

Content type
application/json
{
  • "id": "mod-e5cc70bb28c444948073e77776eb30ef",
  • "model": "string",
  • "results": [
    ]
}

Files

Files API

Upload File

Upload a file that can be used across various endpoints.

The size of individual files can be a maximum of 512 MB. The Fine-tuning API only supports .jsonl files.

Please contact us if you need to increase these storage limits.

Authorizations:
ApiKey
Request Body schema: multipart/form-data
required
file
required
string <binary> (File)

The File object (not file name) to be uploaded. To upload a file and specify a custom file name you should format your request as such:

file=@path/to/your/file.jsonl;filename=custom_name.jsonl

Otherwise, you can just keep the original file name:

file=@path/to/your/file.jsonl
purpose
string (FilePurpose)
Enum: "fine-tune" "batch" "ocr"

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f09",
  • "object": "file",
  • "bytes": 13000,
  • "created_at": 1716963433,
  • "filename": "files_upload.jsonl",
  • "purpose": "fine-tune",
  • "sample_type": "pretrain",
  • "num_lines": 0,
  • "source": "upload"
}

List Files

Returns a list of files that belong to the user's organization.

Authorizations:
ApiKey
query Parameters
page
integer (Page)
Default: 0
page_size
integer (Page Size)
Default: 100
Array of Sample Type (strings) or Sample Type (null) (Sample Type)
Array of Source (strings) or Source (null) (Source)
Search (string) or Search (null) (Search)
FilePurpose (string) or null

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "object": "string",
  • "total": 0
}

Retrieve File

Returns information about a specific file.

Authorizations:
ApiKey
path Parameters
file_id
required
string <uuid> (File Id)

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f09",
  • "object": "file",
  • "bytes": 13000,
  • "created_at": 1716963433,
  • "filename": "files_upload.jsonl",
  • "purpose": "fine-tune",
  • "sample_type": "pretrain",
  • "num_lines": 0,
  • "source": "upload",
  • "deleted": true
}

Delete File

Delete a file.

Authorizations:
ApiKey
path Parameters
file_id
required
string <uuid> (File Id)

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f09",
  • "object": "file",
  • "deleted": false
}

Download File

Download a file

Authorizations:
ApiKey
path Parameters
file_id
required
string <uuid> (File Id)

Responses

Get Signed Url

Authorizations:
ApiKey
path Parameters
file_id
required
string <uuid> (File Id)
query Parameters
expiry
integer (Expiry)
Default: 24

Number of hours before the url becomes invalid. Defaults to 24h

Responses

Response samples

Content type
application/json
{
  • "url": "string"
}

Fine Tuning

Fine-tuning API

Get Fine Tuning Jobs

Get a list of fine-tuning jobs for your organization and user.

Authorizations:
ApiKey
query Parameters
page
integer (Page)
Default: 0

The page number of the results to be returned.

page_size
integer (Page Size)
Default: 100

The number of items to return per page.

Model (string) or Model (null) (Model)

The model name used for fine-tuning to filter on. When set, the other results are not displayed.

Created After (string) or Created After (null) (Created After)

The date/time to filter on. When set, the results for previous creation times are not displayed.

Created Before (string) or Created Before (null) (Created Before)
created_by_me
boolean (Created By Me)
Default: false

When set, only return results for jobs created by the API caller. Other results are not displayed.

Status (string) or Status (null) (Status)

The current job state to filter on. When set, the other results are not displayed.

Wandb Project (string) or Wandb Project (null) (Wandb Project)

The Weights and Biases project to filter on. When set, the other results are not displayed.

Wandb Name (string) or Wandb Name (null) (Wandb Name)

The Weight and Biases run name to filter on. When set, the other results are not displayed.

Suffix (string) or Suffix (null) (Suffix)

The model suffix to filter on. When set, the other results are not displayed.

Responses

Response samples

Content type
application/json
{
  • "data": [ ],
  • "object": "list",
  • "total": 0
}

Create Fine Tuning Job

Create a new fine-tuning job, it will be queued for processing.

Authorizations:
ApiKey
query Parameters
Dry Run (boolean) or Dry Run (null) (Dry Run)
  • If true the job is not spawned, instead the query returns a handful of useful metadata for the user to perform sanity checks (see LegacyJobMetadataOut response).
  • Otherwise, the job is started and the query returns the job ID along with some of the input parameters (see JobOut response).
Request Body schema: application/json
required
model
required
string (FineTuneableModel)
Enum: "open-mistral-7b" "mistral-small-latest" "codestral-latest" "mistral-large-latest" "open-mistral-nemo" "ministral-3b-latest" "ministral-8b-latest"

The name of the model to fine-tune.

Array of objects (Training Files)
Default: []
Array of Validation Files (strings) or Validation Files (null) (Validation Files)

A list containing the IDs of uploaded files that contain validation data. If you provide these files, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in checkpoints when getting the status of a running fine-tuning job. The same data should not be present in both train and validation files.

Suffix (string) or Suffix (null) (Suffix)

A string that will be added to your fine-tuning model name. For example, a suffix of "my-great-model" would produce a model name like ft:open-mistral-7b:my-great-model:xxx...

Array of Integrations (any) or Integrations (null) (Integrations)

A list of integrations to enable for your fine-tuning job.

auto_start
boolean (Auto Start)

This field will be required in a future release.

invalid_sample_skip_percentage
number (Invalid Sample Skip Percentage) [ 0 .. 0.5 ]
Default: 0
FineTuneableModelType (string) or null
required
CompletionTrainingParametersIn (object) or ClassifierTrainingParametersIn (object) (Hyperparameters)
Array of Repositories (any) or Repositories (null) (Repositories)
Array of Classifier Targets (objects) or Classifier Targets (null) (Classifier Targets)

Responses

Request samples

Content type
application/json
{
  • "model": "open-mistral-7b",
  • "training_files": [ ],
  • "validation_files": [
    ],
  • "suffix": "string",
  • "integrations": [
    ],
  • "auto_start": true,
  • "invalid_sample_skip_percentage": 0,
  • "job_type": "completion",
  • "hyperparameters": {
    },
  • "repositories": [
    ],
  • "classifier_targets": [
    ]
}

Response samples

Content type
application/json
Example
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "auto_start": true,
  • "model": "open-mistral-7b",
  • "status": "QUEUED",
  • "created_at": 0,
  • "modified_at": 0,
  • "training_files": [
    ],
  • "validation_files": [ ],
  • "object": "job",
  • "fine_tuned_model": "string",
  • "suffix": "string",
  • "integrations": [
    ],
  • "trained_tokens": 0,
  • "metadata": {
    },
  • "job_type": "completion",
  • "hyperparameters": {
    },
  • "repositories": [ ]
}

Get Fine Tuning Job

Get a fine-tuned job details by its UUID.

Authorizations:
ApiKey
path Parameters
job_id
required
string <uuid> (Job Id)

The ID of the job to analyse.

Responses

Response samples

Content type
application/json
Example
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "auto_start": true,
  • "model": "open-mistral-7b",
  • "status": "QUEUED",
  • "created_at": 0,
  • "modified_at": 0,
  • "training_files": [
    ],
  • "validation_files": [ ],
  • "object": "job",
  • "fine_tuned_model": "string",
  • "suffix": "string",
  • "integrations": [
    ],
  • "trained_tokens": 0,
  • "metadata": {
    },
  • "job_type": "classifier",
  • "hyperparameters": {
    },
  • "events": [ ],
  • "checkpoints": [ ],
  • "classifier_targets": [
    ]
}

Cancel Fine Tuning Job

Request the cancellation of a fine tuning job.

Authorizations:
ApiKey
path Parameters
job_id
required
string <uuid> (Job Id)

The ID of the job to cancel.

Responses

Response samples

Content type
application/json
Example
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "auto_start": true,
  • "model": "open-mistral-7b",
  • "status": "QUEUED",
  • "created_at": 0,
  • "modified_at": 0,
  • "training_files": [
    ],
  • "validation_files": [ ],
  • "object": "job",
  • "fine_tuned_model": "string",
  • "suffix": "string",
  • "integrations": [
    ],
  • "trained_tokens": 0,
  • "metadata": {
    },
  • "job_type": "classifier",
  • "hyperparameters": {
    },
  • "events": [ ],
  • "checkpoints": [ ],
  • "classifier_targets": [
    ]
}

Start Fine Tuning Job

Request the start of a validated fine tuning job.

Authorizations:
ApiKey
path Parameters
job_id
required
string <uuid> (Job Id)

Responses

Response samples

Content type
application/json
Example
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "auto_start": true,
  • "model": "open-mistral-7b",
  • "status": "QUEUED",
  • "created_at": 0,
  • "modified_at": 0,
  • "training_files": [
    ],
  • "validation_files": [ ],
  • "object": "job",
  • "fine_tuned_model": "string",
  • "suffix": "string",
  • "integrations": [
    ],
  • "trained_tokens": 0,
  • "metadata": {
    },
  • "job_type": "classifier",
  • "hyperparameters": {
    },
  • "events": [ ],
  • "checkpoints": [ ],
  • "classifier_targets": [
    ]
}

Models

Model Management API

List Models

List all models available to the user.

Authorizations:
ApiKey

Responses

Response samples

Content type
application/json
{
  • "object": "list",
  • "data": [
    ]
}

Retrieve Model

Retrieve a model information.

Authorizations:
ApiKey
path Parameters
model_id
required
string (Model Id)
Example: ft:open-mistral-7b:587a6b29:20240514:7e773925

The ID of the model to retrieve.

Responses

Response samples

Content type
application/json
Example
{
  • "id": "string",
  • "object": "model",
  • "created": 0,
  • "owned_by": "mistralai",
  • "capabilities": {
    },
  • "name": "string",
  • "description": "string",
  • "max_context_length": 32768,
  • "aliases": [ ],
  • "deprecation": "2019-08-24T14:15:22Z",
  • "default_model_temperature": 0,
  • "type": "base"
}

Delete Model

Delete a fine-tuned model.

Authorizations:
ApiKey
path Parameters
model_id
required
string (Model Id)
Example: ft:open-mistral-7b:587a6b29:20240514:7e773925

The ID of the model to delete.

Responses

Response samples

Content type
application/json
{
  • "id": "ft:open-mistral-7b:587a6b29:20240514:7e773925",
  • "object": "model",
  • "deleted": true
}

Update Fine Tuned Model

Update a model name or description.

Authorizations:
ApiKey
path Parameters
model_id
required
string (Model Id)
Example: ft:open-mistral-7b:587a6b29:20240514:7e773925

The ID of the model to update.

Request Body schema: application/json
required
Name (string) or Name (null) (Name)
Description (string) or Description (null) (Description)

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string"
}

Response samples

Content type
application/json
Example
{
  • "id": "string",
  • "object": "model",
  • "created": 0,
  • "owned_by": "string",
  • "root": "string",
  • "archived": true,
  • "name": "string",
  • "description": "string",
  • "capabilities": {
    },
  • "max_context_length": 32768,
  • "aliases": [ ],
  • "job": "4bbaedb0-902b-4b27-8218-8f40d3470a54",
  • "classifier_targets": [
    ],
  • "model_type": "classifier"
}

Archive Fine Tuned Model

Archive a fine-tuned model.

Authorizations:
ApiKey
path Parameters
model_id
required
string (Model Id)
Example: ft:open-mistral-7b:587a6b29:20240514:7e773925

The ID of the model to archive.

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "object": "model",
  • "archived": true
}

Unarchive Fine Tuned Model

Un-archive a fine-tuned model.

Authorizations:
ApiKey
path Parameters
model_id
required
string (Model Id)
Example: ft:open-mistral-7b:587a6b29:20240514:7e773925

The ID of the model to unarchive.

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "object": "model",
  • "archived": false
}

Batch

Batch API

Get Batch Jobs

Get a list of batch jobs for your organization and user.

Authorizations:
ApiKey
query Parameters
page
integer (Page)
Default: 0
page_size
integer (Page Size)
Default: 100
Model (string) or Model (null) (Model)
Metadata (object) or Metadata (null) (Metadata)
Created After (string) or Created After (null) (Created After)
created_by_me
boolean (Created By Me)
Default: false
Array of Status (strings) or Status (null) (Status)

Responses

Response samples

Content type
application/json
{
  • "data": [ ],
  • "object": "list",
  • "total": 0
}

Create Batch Job

Create a new batch job, it will be queued for processing.

Authorizations:
ApiKey
Request Body schema: application/json
required
input_files
required
Array of strings <uuid> (Input Files) [ items <uuid > ]
endpoint
required
string (ApiEndpoint)
Enum: "/v1/chat/completions" "/v1/embeddings" "/v1/fim/completions" "/v1/moderations" "/v1/chat/moderations"
model
required
string (Model)
Metadata (object) or Metadata (null) (Metadata)
timeout_hours
integer (Timeout Hours)
Default: 24

Responses

Request samples

Content type
application/json
{
  • "input_files": [
    ],
  • "endpoint": "/v1/chat/completions",
  • "model": "string",
  • "metadata": {
    },
  • "timeout_hours": 24
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "object": "batch",
  • "input_files": [
    ],
  • "metadata": { },
  • "endpoint": "string",
  • "model": "string",
  • "output_file": "c7c9cb17-f818-4ee3-85de-0d2f8954882c",
  • "error_file": "6b79e6a4-c3aa-4da1-8fb4-9e2520d26bfa",
  • "errors": [
    ],
  • "status": "QUEUED",
  • "created_at": 0,
  • "total_requests": 0,
  • "completed_requests": 0,
  • "succeeded_requests": 0,
  • "failed_requests": 0,
  • "started_at": 0,
  • "completed_at": 0
}

Get Batch Job

Get a batch job details by its UUID.

Authorizations:
ApiKey
path Parameters
job_id
required
string <uuid> (Job Id)

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "object": "batch",
  • "input_files": [
    ],
  • "metadata": { },
  • "endpoint": "string",
  • "model": "string",
  • "output_file": "c7c9cb17-f818-4ee3-85de-0d2f8954882c",
  • "error_file": "6b79e6a4-c3aa-4da1-8fb4-9e2520d26bfa",
  • "errors": [
    ],
  • "status": "QUEUED",
  • "created_at": 0,
  • "total_requests": 0,
  • "completed_requests": 0,
  • "succeeded_requests": 0,
  • "failed_requests": 0,
  • "started_at": 0,
  • "completed_at": 0
}

Cancel Batch Job

Request the cancellation of a batch job.

Authorizations:
ApiKey
path Parameters
job_id
required
string <uuid> (Job Id)

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "object": "batch",
  • "input_files": [
    ],
  • "metadata": { },
  • "endpoint": "string",
  • "model": "string",
  • "output_file": "c7c9cb17-f818-4ee3-85de-0d2f8954882c",
  • "error_file": "6b79e6a4-c3aa-4da1-8fb4-9e2520d26bfa",
  • "errors": [
    ],
  • "status": "QUEUED",
  • "created_at": 0,
  • "total_requests": 0,
  • "completed_requests": 0,
  • "succeeded_requests": 0,
  • "failed_requests": 0,
  • "started_at": 0,
  • "completed_at": 0
}

OCR API

OCR API

OCR

Authorizations:
ApiKey
Request Body schema: application/json
required
required
Model (string) or Model (null) (Model)
id
string (Id)
required
DocumentURLChunk (object) or ImageURLChunk (object) (Document)

Document to run OCR on

Array of Pages (integers) or Pages (null) (Pages)

Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0

Include Image Base64 (boolean) or Include Image Base64 (null) (Include Image Base64)

Include image URLs in response

Image Limit (integer) or Image Limit (null) (Image Limit)

Max images to extract

Image Min Size (integer) or Image Min Size (null) (Image Min Size)

Minimum height and width of image to extract

ResponseFormat (object) or null

Structured output class for extracting useful information from each extracted bounding box / image from document. Only json_schema is valid for this field

ResponseFormat (object) or null

Structured output class for extracting useful information from the entire document. Only json_schema is valid for this field

Responses

Request samples

Content type
application/json
{
  • "model": "string",
  • "id": "string",
  • "document": {
    },
  • "pages": [
    ],
  • "include_image_base64": true,
  • "image_limit": 0,
  • "image_min_size": 0,
  • "bbox_annotation_format": {
    },
  • "document_annotation_format": {
    }
}

Response samples

Content type
application/json
{
  • "pages": [
    ],
  • "model": "string",
  • "document_annotation": "string",
  • "usage_info": {
    }
}

(beta) Agents API

(beta) Agents API

Create a agent that can be used within a conversation.

Create a new agent giving it instructions, tools, description. The agent is then available to be used as a regular assistant in a conversation or as part of an agent pool from which it can be used.

Authorizations:
ApiKey
Request Body schema: application/json
required
Instructions (string) or Instructions (null) (Instructions)

Instruction prompt the model will follow during the conversation.

Array of any (Tools)

List of tools which are available to the model during the conversation.

object (CompletionArgs)

Completion arguments that will be used to generate assistant responses. Can be overridden at each message request.

model
required
string (Model)
name
required
string (Name)
Description (string) or Description (null) (Description)
Array of Handoffs (strings) or Handoffs (null) (Handoffs)

Responses

Request samples

Content type
application/json
{
  • "instructions": "string",
  • "tools": [
    ],
  • "completion_args": {
    },
  • "model": "string",
  • "name": "string",
  • "description": "string",
  • "handoffs": [
    ]
}

Response samples

Content type
application/json
{
  • "instructions": "string",
  • "tools": [
    ],
  • "completion_args": {
    },
  • "model": "string",
  • "name": "string",
  • "description": "string",
  • "handoffs": [
    ],
  • "object": "agent",
  • "id": "string",
  • "version": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

List agent entities.

Retrieve a list of agent entities sorted by creation time.

Authorizations:
ApiKey
query Parameters
page
integer (Page)
Default: 0
page_size
integer (Page Size)
Default: 20

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Retrieve an agent entity.

Given an agent retrieve an agent entity with its attributes.

Authorizations:
ApiKey
path Parameters
agent_id
required
string (Agent Id)

Responses

Response samples

Content type
application/json
{
  • "instructions": "string",
  • "tools": [
    ],
  • "completion_args": {
    },
  • "model": "string",
  • "name": "string",
  • "description": "string",
  • "handoffs": [
    ],
  • "object": "agent",
  • "id": "string",
  • "version": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Update an agent entity.

Update an agent attributes and create a new version.

Authorizations:
ApiKey
path Parameters
agent_id
required
string (Agent Id)
Request Body schema: application/json
required
Instructions (string) or Instructions (null) (Instructions)

Instruction prompt the model will follow during the conversation.

Array of any (Tools)

List of tools which are available to the model during the conversation.

object (CompletionArgs)

Completion arguments that will be used to generate assistant responses. Can be overridden at each message request.

Model (string) or Model (null) (Model)
Name (string) or Name (null) (Name)
Description (string) or Description (null) (Description)
Array of Handoffs (strings) or Handoffs (null) (Handoffs)

Responses

Request samples

Content type
application/json
{
  • "instructions": "string",
  • "tools": [
    ],
  • "completion_args": {
    },
  • "model": "string",
  • "name": "string",
  • "description": "string",
  • "handoffs": [
    ]
}

Response samples

Content type
application/json
{
  • "instructions": "string",
  • "tools": [
    ],
  • "completion_args": {
    },
  • "model": "string",
  • "name": "string",
  • "description": "string",
  • "handoffs": [
    ],
  • "object": "agent",
  • "id": "string",
  • "version": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Update an agent version.

Switch the version of an agent.

Authorizations:
ApiKey
path Parameters
agent_id
required
string (Agent Id)
query Parameters
version
required
integer (Version)

Responses

Response samples

Content type
application/json
{
  • "instructions": "string",
  • "tools": [
    ],
  • "completion_args": {
    },
  • "model": "string",
  • "name": "string",
  • "description": "string",
  • "handoffs": [
    ],
  • "object": "agent",
  • "id": "string",
  • "version": 0,
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

(beta) Converstations API

(beta) Converstations API

Create a conversation and append entries to it.

Create a new conversation, using a base model or an agent and append entries. Completion and tool executions are run and the response is appended to the conversation.Use the returned conversation_id to continue the conversation.

Authorizations:
ApiKey
Request Body schema: application/json
required
required
ConversationInputs (string) or (Array of InputEntries (MessageInputEntry (object) or FunctionResultEntry (object))) (ConversationInputs)
Stream (boolean) or Stream (boolean) (Stream)
Default: false
Value: false
Store (boolean) or Store (null) (Store)
Default: null
Handoff Execution (string) or Handoff Execution (null) (Handoff Execution)
Default: null
Instructions (string) or Instructions (null) (Instructions)
Default: null
Array of Tools (any) or Tools (null) (Tools)
Default: null
CompletionArgs (object) or null
Default: null
Name (string) or Name (null) (Name)
Default: null
Description (string) or Description (null) (Description)
Default: null
Agent Id (string) or Agent Id (null) (Agent Id)
Default: null
Model (string) or Model (null) (Model)
Default: null

Responses

Request samples

Content type
application/json
{
  • "inputs": "string",
  • "stream": false,
  • "store": null,
  • "handoff_execution": null,
  • "instructions": null,
  • "tools": null,
  • "completion_args": null,
  • "name": null,
  • "description": null,
  • "agent_id": null,
  • "model": null
}

Response samples

Content type
application/json
{
  • "object": "conversation.response",
  • "conversation_id": "string",
  • "outputs": [
    ],
  • "usage": {
    }
}

List all created conversations.

Retrieve a list of conversation entities sorted by creation time.

Authorizations:
ApiKey
query Parameters
page
integer (Page)
Default: 0
page_size
integer (Page Size)
Default: 100

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Retrieve a conversation information.

Given a conversation_id retrieve a conversation entity with its attributes.

Authorizations:
ApiKey
path Parameters
conversation_id
required
string (Conversation Id)

Responses

Response samples

Content type
application/json
Example
{
  • "instructions": "string",
  • "tools": [
    ],
  • "completion_args": {
    },
  • "name": "string",
  • "description": "string",
  • "object": "conversation",
  • "id": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "model": "string"
}

Append new entries to an existing conversation.

Run completion on the history of the conversation and the user entries. Return the new created entries.

Authorizations:
ApiKey
path Parameters
conversation_id
required
string (Conversation Id)

ID of the conversation to which we append entries.

Request Body schema: application/json
required
required
ConversationInputs (string) or (Array of InputEntries (MessageInputEntry (object) or FunctionResultEntry (object))) (ConversationInputs)
stream
boolean (Stream)
Default: false
Value: false

Whether to stream back partial progress. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.

store
boolean (Store)
Default: true

Whether to store the results into our servers or not.

handoff_execution
string (Handoff Execution)
Default: "server"
Enum: "client" "server"
object (CompletionArgs)

Completion arguments that will be used to generate assistant responses. Can be overridden at each message request.

Responses

Request samples

Content type
application/json
{
  • "inputs": "string",
  • "stream": false,
  • "store": true,
  • "handoff_execution": "client",
  • "completion_args": {
    }
}

Response samples

Content type
application/json
{
  • "object": "conversation.response",
  • "conversation_id": "string",
  • "outputs": [
    ],
  • "usage": {
    }
}

Retrieve all entries in a conversation.

Given a conversation_id retrieve all the entries belonging to that conversation. The entries are sorted in the order they were appended, those can be messages, connectors or function_call.

Authorizations:
ApiKey
path Parameters
conversation_id
required
string (Conversation Id)

Responses

Response samples

Content type
application/json
{
  • "object": "conversation.history",
  • "conversation_id": "string",
  • "entries": [
    ]
}

Retrieve all messages in a conversation.

Given a conversation_id retrieve all the messages belonging to that conversation. This is similar to retrieving all entries except we filter the messages only.

Authorizations:
ApiKey
path Parameters
conversation_id
required
string (Conversation Id)

Responses

Response samples

Content type
application/json
{
  • "object": "conversation.messages",
  • "conversation_id": "string",
  • "messages": [
    ]
}

Restart a conversation starting from a given entry.

Given a conversation_id and an id, recreate a conversation from this point and run completion. A new conversation is returned with the new entries returned.

Authorizations:
ApiKey
path Parameters
conversation_id
required
string (Conversation Id)
Request Body schema: application/json
required
required
ConversationInputs (string) or (Array of InputEntries (MessageInputEntry (object) or FunctionResultEntry (object))) (ConversationInputs)
stream
boolean (Stream)
Default: false
Value: false

Whether to stream back partial progress. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.

store
boolean (Store)
Default: true

Whether to store the results into our servers or not.

handoff_execution
string (Handoff Execution)
Default: "server"
Enum: "client" "server"
from_entry_id
required
string (From Entry Id)
object (CompletionArgs)

Completion arguments that will be used to generate assistant responses. Can be overridden at each message request.

Responses

Request samples

Content type
application/json
{
  • "inputs": "string",
  • "stream": false,
  • "store": true,
  • "handoff_execution": "client",
  • "from_entry_id": "string",
  • "completion_args": {
    }
}

Response samples

Content type
application/json
{
  • "object": "conversation.response",
  • "conversation_id": "string",
  • "outputs": [
    ],
  • "usage": {
    }
}

Create a conversation and append entries to it.

Create a new conversation, using a base model or an agent and append entries. Completion and tool executions are run and the response is appended to the conversation.Use the returned conversation_id to continue the conversation.

Authorizations:
ApiKey
Request Body schema: application/json
required
required
ConversationInputs (string) or (Array of InputEntries (MessageInputEntry (object) or FunctionResultEntry (object))) (ConversationInputs)
Stream (boolean) or Stream (boolean) (Stream)
Default: true
Value: true
Store (boolean) or Store (null) (Store)
Default: null
Handoff Execution (string) or Handoff Execution (null) (Handoff Execution)
Default: null
Instructions (string) or Instructions (null) (Instructions)
Default: null
Array of Tools (any) or Tools (null) (Tools)
Default: null
CompletionArgs (object) or null
Default: null
Name (string) or Name (null) (Name)
Default: null
Description (string) or Description (null) (Description)
Default: null
Agent Id (string) or Agent Id (null) (Agent Id)
Default: null
Model (string) or Model (null) (Model)
Default: null

Responses

Request samples

Content type
application/json
{
  • "inputs": "string",
  • "stream": true,
  • "store": null,
  • "handoff_execution": null,
  • "instructions": null,
  • "tools": null,
  • "completion_args": null,
  • "name": null,
  • "description": null,
  • "agent_id": null,
  • "model": null
}

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Append new entries to an existing conversation.

Run completion on the history of the conversation and the user entries. Return the new created entries.

Authorizations:
ApiKey
path Parameters
conversation_id
required
string (Conversation Id)

ID of the conversation to which we append entries.

Request Body schema: application/json
required
required
ConversationInputs (string) or (Array of InputEntries (MessageInputEntry (object) or FunctionResultEntry (object))) (ConversationInputs)
stream
boolean (Stream)
Default: true
Value: true

Whether to stream back partial progress. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.

store
boolean (Store)
Default: true

Whether to store the results into our servers or not.

handoff_execution
string (Handoff Execution)
Default: "server"
Enum: "client" "server"
object (CompletionArgs)

Completion arguments that will be used to generate assistant responses. Can be overridden at each message request.

Responses

Request samples

Content type
application/json
{
  • "inputs": "string",
  • "stream": true,
  • "store": true,
  • "handoff_execution": "client",
  • "completion_args": {
    }
}

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Restart a conversation starting from a given entry.

Given a conversation_id and an id, recreate a conversation from this point and run completion. A new conversation is returned with the new entries returned.

Authorizations:
ApiKey
path Parameters
conversation_id
required
string (Conversation Id)
Request Body schema: application/json
required
required
ConversationInputs (string) or (Array of InputEntries (MessageInputEntry (object) or FunctionResultEntry (object))) (ConversationInputs)
stream
boolean (Stream)
Default: true
Value: true

Whether to stream back partial progress. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.

store
boolean (Store)
Default: true

Whether to store the results into our servers or not.

handoff_execution
string (Handoff Execution)
Default: "server"
Enum: "client" "server"
from_entry_id
required
string (From Entry Id)
object (CompletionArgs)

Completion arguments that will be used to generate assistant responses. Can be overridden at each message request.

Responses

Request samples

Content type
application/json
{
  • "inputs": "string",
  • "stream": true,
  • "store": true,
  • "handoff_execution": "client",
  • "from_entry_id": "string",
  • "completion_args": {
    }
}

Response samples

Content type
application/json
{
  • "detail": [
    ]
}