Agents
complete
agents.complete
Run an agent on a list of messages with the agent’s instructions and tools; spends Mistral credits
Risk: destructive
await corsair.mistralai.api.agents.complete({ agent_id: '<agent id>', messages: [{ role: 'user', content: 'Summarize ticket #4521' }] });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Id of the agent to run. |
max_tokens | number | No | — |
min_tokens | number | No | — |
stop | string | string[] | No | — |
random_seed | number | No | — |
metadata | Record<string, any> | No | — |
messages | object[] | Yes | Conversation so far: { role: “system” | “user” | “assistant” | “tool”, content }. |
response_format | object | No | — |
tools | object[] | No | — |
tool_choice | auto | none | any | required | object | No | — |
presence_penalty | number | No | — |
frequency_penalty | number | No | — |
repetition_penalty | number | No | — |
top_k | number | No | — |
n | number | No | — |
logprobs | boolean | No | — |
top_logprobs | number | No | — |
prediction | object | No | — |
parallel_tool_calls | boolean | No | — |
reasoning_effort | none | minimal | low | medium | high | xhigh | max | No | — |
prompt_mode | reasoning | No | — |
guardrails | object[] | No | — |
prompt_cache_key | string | No | — |
service_tier | auto | standard_only | No | — |
messages full type
messages full type
(
{
role: system,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[]
} | {
role: user,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null
} | {
role: assistant,
content?: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null,
tool_calls?: {
id?: string,
type?: function,
function: {
name: string,
arguments: string | Record<string, any>
},
index?: number
}[] | null,
prefix?: boolean | null
} | {
role: tool,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null,
tool_call_id?: string | null,
name?: string | null
}
)[]
response_format full type
response_format full type
{
type: text | json_object | json_schema,
json_schema?: {
name: string,
description?: string,
schema: Record<string, any>,
strict?: boolean
}
}
tools full type
tools full type
(
{
type: function,
function: {
name: string,
description?: string,
strict?: boolean,
parameters: Record<string, any>
}
} | {
type: image_generation,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: document_library,
library_ids: string[],
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: connector,
connector_id: string,
authorization?: Record<string, any>,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
}
)[]
tool_choice full type
tool_choice full type
auto | none | any | required | {
type: function,
function: {
name: string
}
}
prediction full type
prediction full type
{
type: content,
content: string
}
guardrails full type
guardrails full type
{
block_on_error?: boolean,
moderation_llm_v1?: Record<string, any>,
moderation_llm_v2?: Record<string, any>
}[]
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
model | string | Yes | — |
created | number | null | No | — |
usage | object | null | No | — |
choices | object[] | Yes | — |
usage full type
usage full type
{
prompt_tokens?: number | null,
completion_tokens?: number | null,
total_tokens?: number | null,
prompt_audio_seconds?: number | null
} | null
choices full type
choices full type
{
index: number,
message?: {
role?: string | null,
content?: string | any[] | null,
tool_calls?: {
id?: string,
type?: function,
function: {
name: string,
arguments: string | Record<string, any>
},
index?: number
}[] | null,
prefix?: boolean | null
} | null,
finish_reason?: string | null
}[]
create
agents.create
Create an agent: a model with instructions, tools and default settings (beta). Mistral refuses agent creation for some organizations with 403 “Use Managed Agents instead”; existing agents can still be listed, read, versioned and deleted
Risk: write
await corsair.mistralai.api.agents.create({ model: 'mistral-medium-latest', name: 'Support triage', instructions: 'Classify each ticket and answer in one sentence.', tools: [{ type: 'web_search' }] });
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model id, for example mistral-small-latest. models.list lists the ones this key can use. |
name | string | Yes | — |
instructions | string | No | — |
tools | object[] | No | — |
completion_args | object | No | — |
guardrails | object[] | No | — |
description | string | No | — |
handoffs | string[] | No | Ids of agents this one can hand the conversation to. |
metadata | Record<string, any> | No | — |
version_message | string | No | — |
tools full type
tools full type
(
{
type: function,
function: {
name: string,
description?: string,
strict?: boolean,
parameters: Record<string, any>
}
} | {
type: web_search,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: web_search_premium,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: code_interpreter,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: image_generation,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: document_library,
library_ids: string[],
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: connector,
connector_id: string,
authorization?: Record<string, any>,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
}
)[]
completion_args full type
completion_args full type
{
stop?: string | string[],
presence_penalty?: number,
frequency_penalty?: number,
temperature?: number,
top_p?: number,
max_tokens?: number,
random_seed?: number,
prediction?: {
type: content,
content: string
},
response_format?: {
type: text | json_object | json_schema,
json_schema?: {
name: string,
description?: string,
schema: Record<string, any>,
strict?: boolean
}
},
tool_choice?: auto | none | any | required,
reasoning_effort?: none | minimal | low | medium | high | xhigh | max
}
guardrails full type
guardrails full type
{
block_on_error?: boolean,
moderation_llm_v1?: Record<string, any>,
moderation_llm_v2?: Record<string, any>
}[]
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
name | string | Yes | — |
model | string | Yes | — |
description | string | null | No | — |
instructions | string | null | No | — |
tools | Record<string, any>[] | null | No | — |
completion_args | Record<string, any> | null | No | — |
handoffs | string[] | null | No | — |
metadata | Record<string, any> | null | No | — |
version | number | Yes | — |
versions | number[] | null | No | — |
version_message | string | null | No | — |
owner_id | string | null | No | — |
created_at | string | Yes | — |
updated_at | string | Yes | — |
deployment_chat | boolean | null | No | — |
source | string | null | No | — |
delete
agents.delete
Delete an agent; cannot be undone (beta)
Risk: destructive · Irreversible
await corsair.mistralai.api.agents.delete({ agent_id: '<agent id>' });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent id, from agents.create or agents.list. |
| Name | Type | Required | Description |
|---|---|---|---|
success | true | Yes | — |
deleteAlias
agents.deleteAlias
Remove a version alias from an agent; the version itself stays (beta)
Risk: destructive
await corsair.mistralai.api.agents.deleteAlias({ agent_id: '<agent id>', alias: 'staging' });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent id, from agents.create or agents.list. |
alias | string | Yes | — |
| Name | Type | Required | Description |
|---|---|---|---|
success | true | Yes | — |
get
agents.get
Get an agent, at its current version or at a given version or alias (beta)
Risk: read
await corsair.mistralai.api.agents.get({ agent_id: '<agent id>', agent_version: 'production' });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent id, from agents.create or agents.list. |
agent_version | number | string | No | A version number or an alias; the current version if omitted. |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
name | string | Yes | — |
model | string | Yes | — |
description | string | null | No | — |
instructions | string | null | No | — |
tools | Record<string, any>[] | null | No | — |
completion_args | Record<string, any> | null | No | — |
handoffs | string[] | null | No | — |
metadata | Record<string, any> | null | No | — |
version | number | Yes | — |
versions | number[] | null | No | — |
version_message | string | null | No | — |
owner_id | string | null | No | — |
created_at | string | Yes | — |
updated_at | string | Yes | — |
deployment_chat | boolean | null | No | — |
source | string | null | No | — |
getVersion
agents.getVersion
Get one version of an agent by number or alias (beta)
Risk: read
await corsair.mistralai.api.agents.getVersion({ agent_id: '<agent id>', version: '2' });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent id, from agents.create or agents.list. |
version | string | Yes | A version number or an alias, as a string. |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
name | string | Yes | — |
model | string | Yes | — |
description | string | null | No | — |
instructions | string | null | No | — |
tools | Record<string, any>[] | null | No | — |
completion_args | Record<string, any> | null | No | — |
handoffs | string[] | null | No | — |
metadata | Record<string, any> | null | No | — |
version | number | Yes | — |
versions | number[] | null | No | — |
version_message | string | null | No | — |
owner_id | string | null | No | — |
created_at | string | Yes | — |
updated_at | string | Yes | — |
deployment_chat | boolean | null | No | — |
source | string | null | No | — |
list
agents.list
List agents, filtered by name, search text or metadata; page with page_token (beta)
Risk: read
await corsair.mistralai.api.agents.list({ page_size: 20, search: 'support' });
| Name | Type | Required | Description |
|---|---|---|---|
page_size | number | No | — |
page_token | string | No | next_page_token from the previous page. |
name | string | No | — |
search | string | No | — |
id | string | No | — |
deployment_chat | boolean | No | — |
sources | (api | playground | agent_builder_v1)[] | No | — |
metadata | Record<string, any> | No | Only agents whose metadata has these key/values. |
page_token, the next_page_token of the previous page.
Output
| Name | Type | Required | Description |
|---|---|---|---|
object | string | null | No | — |
data | object[] | Yes | — |
next_page_token | string | null | No | — |
data full type
data full type
{
id: string,
object?: string | null,
name: string,
model: string,
description?: string | null,
instructions?: string | null,
tools?: Record<string, any>[] | null,
completion_args?: Record<string, any> | null,
handoffs?: string[] | null,
metadata?: Record<string, any> | null,
version: number,
versions?: number[] | null,
version_message?: string | null,
owner_id?: string | null,
created_at: string,
updated_at: string,
deployment_chat?: boolean | null,
source?: string | null
}[]
listAliases
agents.listAliases
List an agent’s version aliases (beta)
Risk: read
await corsair.mistralai.api.agents.listAliases({ agent_id: '<agent id>' });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent id, from agents.create or agents.list. |
object[]
Output full type
Output full type
{
alias: string,
version: number,
created_at: string,
updated_at: string
}[]
listVersions
agents.listVersions
List an agent’s versions; page with page and page_size (beta)
Risk: read
await corsair.mistralai.api.agents.listVersions({ agent_id: '<agent id>', page: 0, page_size: 10 });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent id, from agents.create or agents.list. |
page | number | No | — |
page_size | number | No | — |
object[]
Output full type
Output full type
{
id: string,
object?: string | null,
name: string,
model: string,
description?: string | null,
instructions?: string | null,
tools?: Record<string, any>[] | null,
completion_args?: Record<string, any> | null,
handoffs?: string[] | null,
metadata?: Record<string, any> | null,
version: number,
versions?: number[] | null,
version_message?: string | null,
owner_id?: string | null,
created_at: string,
updated_at: string,
deployment_chat?: boolean | null,
source?: string | null
}[]
setVersion
agents.setVersion
Switch an agent to another of its versions (beta)
Risk: write
await corsair.mistralai.api.agents.setVersion({ agent_id: '<agent id>', version: 2 });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent id, from agents.create or agents.list. |
version | number | Yes | The version to make current. |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
name | string | Yes | — |
model | string | Yes | — |
description | string | null | No | — |
instructions | string | null | No | — |
tools | Record<string, any>[] | null | No | — |
completion_args | Record<string, any> | null | No | — |
handoffs | string[] | null | No | — |
metadata | Record<string, any> | null | No | — |
version | number | Yes | — |
versions | number[] | null | No | — |
version_message | string | null | No | — |
owner_id | string | null | No | — |
created_at | string | Yes | — |
updated_at | string | Yes | — |
deployment_chat | boolean | null | No | — |
source | string | null | No | — |
update
agents.update
Change an agent; each update creates a new version (beta)
Risk: write
await corsair.mistralai.api.agents.update({ agent_id: '<agent id>', instructions: 'Answer in two sentences at most.', version_message: 'Shorter answers' });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent id, from agents.create or agents.list. |
model | string | No | — |
name | string | No | — |
deployment_chat | boolean | No | — |
instructions | string | No | — |
tools | object[] | No | — |
completion_args | object | No | — |
guardrails | object[] | No | — |
description | string | No | — |
handoffs | string[] | No | Ids of agents this one can hand the conversation to. |
metadata | Record<string, any> | No | — |
version_message | string | No | — |
tools full type
tools full type
(
{
type: function,
function: {
name: string,
description?: string,
strict?: boolean,
parameters: Record<string, any>
}
} | {
type: web_search,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: web_search_premium,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: code_interpreter,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: image_generation,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: document_library,
library_ids: string[],
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: connector,
connector_id: string,
authorization?: Record<string, any>,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
}
)[]
completion_args full type
completion_args full type
{
stop?: string | string[],
presence_penalty?: number,
frequency_penalty?: number,
temperature?: number,
top_p?: number,
max_tokens?: number,
random_seed?: number,
prediction?: {
type: content,
content: string
},
response_format?: {
type: text | json_object | json_schema,
json_schema?: {
name: string,
description?: string,
schema: Record<string, any>,
strict?: boolean
}
},
tool_choice?: auto | none | any | required,
reasoning_effort?: none | minimal | low | medium | high | xhigh | max
}
guardrails full type
guardrails full type
{
block_on_error?: boolean,
moderation_llm_v1?: Record<string, any>,
moderation_llm_v2?: Record<string, any>
}[]
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
name | string | Yes | — |
model | string | Yes | — |
description | string | null | No | — |
instructions | string | null | No | — |
tools | Record<string, any>[] | null | No | — |
completion_args | Record<string, any> | null | No | — |
handoffs | string[] | null | No | — |
metadata | Record<string, any> | null | No | — |
version | number | Yes | — |
versions | number[] | null | No | — |
version_message | string | null | No | — |
owner_id | string | null | No | — |
created_at | string | Yes | — |
updated_at | string | Yes | — |
deployment_chat | boolean | null | No | — |
source | string | null | No | — |
upsertAlias
agents.upsertAlias
Point a version alias such as production at an agent version, creating it if needed (beta)
Risk: write
await corsair.mistralai.api.agents.upsertAlias({ agent_id: '<agent id>', alias: 'production', version: 2 });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent id, from agents.create or agents.list. |
alias | string | Yes | Alias name, for example production. |
version | number | Yes | The version the alias points to. |
| Name | Type | Required | Description |
|---|---|---|---|
alias | string | Yes | — |
version | number | Yes | — |
created_at | string | Yes | — |
updated_at | string | Yes | — |
Audio
speech
audio.speech
Turn text into speech; returns base64 audio (mp3 by default); spends Mistral credits
Risk: destructive
await corsair.mistralai.api.audio.speech({ input: 'Your order has shipped.', voice_id: '<voice id>', response_format: 'mp3' });
| Name | Type | Required | Description |
|---|---|---|---|
input | string | Yes | Text to speak. |
model | string | No | — |
voice_id | string | No | A voice from voices.list. |
ref_audio | string | No | Base64 reference audio to clone, instead of voice_id. |
response_format | pcm | wav | mp3 | flac | opus | No | — |
expressiveness | number | No | — |
metadata | Record<string, any> | No | — |
audio_data is base64 audio in response_format (mp3 by default).
Output
| Name | Type | Required | Description |
|---|---|---|---|
audio_data | string | Yes | The audio, base64, in response_format (mp3 by default). |
transcribe
audio.transcribe
Transcribe audio from base64 content, a URL or an uploaded file, optionally with speakers and timestamps; spends Mistral credits
Risk: destructive
await corsair.mistralai.api.audio.transcribe({ model: 'voxtral-mini-latest', file_url: 'https://example.com/call.mp3', timestamp_granularities: ['segment'] });
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | A transcription model, for example voxtral-mini-latest. |
content_base64 | string | No | File content, base64 (a data: URL prefix is accepted). |
filename | string | No | Name of the audio file, with content_base64. |
file_url | string | No | Public URL of the audio. |
file_id | string | No | An uploaded file id. |
language | string | No | — |
temperature | number | No | — |
diarize | boolean | No | — |
context_bias | string[] | No | — |
timestamp_granularities | (segment | word)[] | No | — |
content_base64 (with filename), file_url or file_id.
Output
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | — |
text | string | Yes | — |
language | string | null | No | — |
segments | object[] | null | No | — |
usage | object | null | No | — |
segments full type
segments full type
{
text: string,
start?: number | null,
end?: number | null,
speaker_id?: string | null
}[] | null
usage full type
usage full type
{
prompt_tokens?: number | null,
completion_tokens?: number | null,
total_tokens?: number | null,
prompt_audio_seconds?: number | null
} | null
Audio Agents
create
audioAgents.create
Create a voice agent: speech-to-text, LLM and text-to-speech settings, instructions and tools
Risk: write
await corsair.mistralai.api.audioAgents.create({ name: 'Receptionist', configuration: { llm: { model: 'mistral-small-latest' }, tts: { voice_id: '<voice id>' }, instructions: 'Greet callers and take a message.' } });
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | — |
description | string | No | — |
configuration | object | Yes | — |
configuration full type
configuration full type
{
llm?: {
model?: string
},
tts?: {
model?: string,
voice_id?: string,
expressiveness?: number
},
stt?: Record<string, any>,
turn?: Record<string, any>,
instructions?: string,
tools?: Record<string, any>[],
welcome_message?: string
}
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
owner_id | string | Yes | — |
name | string | null | No | — |
description | string | null | No | — |
created_at | string | Yes | — |
updated_at | string | Yes | — |
version | number | null | No | — |
configuration | Record<string, any> | null | No | — |
delete
audioAgents.delete
Delete a voice agent; cannot be undone
Risk: destructive · Irreversible
await corsair.mistralai.api.audioAgents.delete({ agent_id: '<audio agent id>' });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Audio agent id (uuid), from audioAgents.list. |
| Name | Type | Required | Description |
|---|---|---|---|
success | true | Yes | — |
get
audioAgents.get
Get a voice agent, optionally at a given version
Risk: read
await corsair.mistralai.api.audioAgents.get({ agent_id: '<audio agent id>' });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Audio agent id (uuid), from audioAgents.list. |
version | number | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
owner_id | string | Yes | — |
name | string | null | No | — |
description | string | null | No | — |
created_at | string | Yes | — |
updated_at | string | Yes | — |
version | number | null | No | — |
configuration | Record<string, any> | null | No | — |
list
audioAgents.list
List voice agents; page with page_token
Risk: read
await corsair.mistralai.api.audioAgents.list({ page_size: 10 });
| Name | Type | Required | Description |
|---|---|---|---|
page_size | number | No | — |
page_token | string | No | next_page_token from the previous page. |
search | string | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
data | object[] | Yes | — |
next_page_token | string | null | No | — |
data full type
data full type
{
id: string,
owner_id: string,
name?: string | null,
description?: string | null,
created_at: string,
updated_at: string,
version?: number | null,
configuration?: Record<string, any> | null
}[]
listSessions
audioAgents.listSessions
List a voice agent’s sessions; page with page_token
Risk: read
await corsair.mistralai.api.audioAgents.listSessions({ agent_id: '<audio agent id>', page_size: 10 });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Audio agent id (uuid), from audioAgents.list. |
page_size | number | No | — |
page_token | string | No | next_page_token from the previous page. |
| Name | Type | Required | Description |
|---|---|---|---|
data | object[] | Yes | — |
next_page_token | string | null | No | — |
data full type
data full type
{
id: string,
agent_id: string,
started_at?: string | null,
duration?: number | null,
phone_number_id?: string | null
}[]
listVersions
audioAgents.listVersions
List a voice agent’s versions; page with page_token
Risk: read
await corsair.mistralai.api.audioAgents.listVersions({ agent_id: '<audio agent id>', page_size: 10 });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Audio agent id (uuid), from audioAgents.list. |
page_size | number | No | — |
page_token | string | No | next_page_token from the previous page. |
| Name | Type | Required | Description |
|---|---|---|---|
data | object[] | Yes | — |
next_page_token | string | null | No | — |
data full type
data full type
{
id: string,
owner_id: string,
name?: string | null,
description?: string | null,
created_at: string,
updated_at: string,
version?: number | null,
configuration?: Record<string, any> | null
}[]
update
audioAgents.update
Replace a voice agent’s name, description and configuration
Risk: write
await corsair.mistralai.api.audioAgents.update({ agent_id: '<audio agent id>', name: 'Receptionist', configuration: { welcome_message: 'Hello, how can I help?' } });
| Name | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Audio agent id (uuid), from audioAgents.list. |
name | string | Yes | — |
description | string | No | — |
configuration | object | Yes | — |
configuration full type
configuration full type
{
llm?: {
model?: string
},
tts?: {
model?: string,
voice_id?: string,
expressiveness?: number
},
stt?: Record<string, any>,
turn?: Record<string, any>,
instructions?: string,
tools?: Record<string, any>[],
welcome_message?: string
}
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
owner_id | string | Yes | — |
name | string | null | No | — |
description | string | null | No | — |
created_at | string | Yes | — |
updated_at | string | Yes | — |
version | number | null | No | — |
configuration | Record<string, any> | null | No | — |
Batch
cancel
batch.cancel
Ask Mistral to cancel a batch job: status goes to CANCELLATION_REQUESTED, then CANCELLED; there is no way to resume it
Risk: destructive · Irreversible
await corsair.mistralai.api.batch.cancel({ job_id: '<batch job id>' });
| Name | Type | Required | Description |
|---|---|---|---|
job_id | string | Yes | Batch job id (uuid), from batch.create or batch.list. |
batch.get shows CANCELLATION_REQUESTED until the job reaches CANCELLED. There is no operation to resume a cancelled job.
Output
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
input_files | string[] | Yes | — |
metadata | Record<string, any> | null | No | — |
endpoint | string | Yes | — |
model | string | null | No | — |
agent_id | string | null | No | — |
output_file | string | null | No | File id of the results; read it with files.getSignedUrl. |
error_file | string | null | No | — |
errors | object[] | Yes | — |
outputs | Record<string, any>[] | null | No | — |
status | QUEUED | RUNNING | SUCCESS | FAILED | TIMEOUT_EXCEEDED | CANCELLATION_REQUESTED | CANCELLED | string | Yes | — |
created_at | number | Yes | — |
total_requests | number | Yes | — |
completed_requests | number | Yes | — |
succeeded_requests | number | Yes | — |
failed_requests | number | Yes | — |
started_at | number | null | No | — |
completed_at | number | null | No | — |
errors full type
errors full type
{
message: string,
count?: number | null
}[]
create
batch.create
Start a batch job that runs many requests to one endpoint, from uploaded .jsonl files or inline; spends Mistral credits and needs a Mistral plan with billing enabled (402 otherwise). Follow it with batch.get until status is SUCCESS, FAILED, TIMEOUT_EXCEEDED or CANCELLED
Risk: destructive
await corsair.mistralai.api.batch.create({ endpoint: '/v1/chat/completions', model: 'mistral-small-latest', input_files: ['<file id>'] });
| Name | Type | Required | Description |
|---|---|---|---|
endpoint | /v1/chat/completions | /v1/embeddings | /v1/fim/completions | /v1/moderations | /v1/chat/moderations | /v1/ocr | /v1/classifications | /v1/chat/classifications | /v1/conversations | /v1/audio/transcriptions | Yes | The API every request in the batch calls. |
input_files | string[] | No | Ids of .jsonl files uploaded with purpose batch, one request per line. |
requests | object[] | No | Requests inline, instead of input_files. |
model | string | No | — |
agent_id | string | No | — |
metadata | Record<string, string> | No | — |
timeout_hours | number | No | — |
input_files (ids of .jsonl files uploaded with purpose batch, one request per line) or requests inline. Every request goes to endpoint. Batch jobs need a Mistral plan with billing enabled; without it Mistral returns 402.
requests full type
requests full type
{
custom_id?: string,
body: Record<string, any>
}[]
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
input_files | string[] | Yes | — |
metadata | Record<string, any> | null | No | — |
endpoint | string | Yes | — |
model | string | null | No | — |
agent_id | string | null | No | — |
output_file | string | null | No | File id of the results; read it with files.getSignedUrl. |
error_file | string | null | No | — |
errors | object[] | Yes | — |
outputs | Record<string, any>[] | null | No | — |
status | QUEUED | RUNNING | SUCCESS | FAILED | TIMEOUT_EXCEEDED | CANCELLATION_REQUESTED | CANCELLED | string | Yes | — |
created_at | number | Yes | — |
total_requests | number | Yes | — |
completed_requests | number | Yes | — |
succeeded_requests | number | Yes | — |
failed_requests | number | Yes | — |
started_at | number | null | No | — |
completed_at | number | null | No | — |
errors full type
errors full type
{
message: string,
count?: number | null
}[]
delete
batch.delete
Ask Mistral to delete a batch job; cannot be undone
Risk: destructive · Irreversible
await corsair.mistralai.api.batch.delete({ job_id: '<batch job id>' });
| Name | Type | Required | Description |
|---|---|---|---|
job_id | string | Yes | Batch job id (uuid), from batch.create or batch.list. |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
deleted | boolean | null | No | — |
get
batch.get
Where a batch job stands: status, request counts, and output_file once it’s done
Risk: read
await corsair.mistralai.api.batch.get({ job_id: '<batch job id>' });
| Name | Type | Required | Description |
|---|---|---|---|
job_id | string | Yes | Batch job id (uuid), from batch.create or batch.list. |
inline | boolean | No | Include the results in outputs (small batches only). |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
input_files | string[] | Yes | — |
metadata | Record<string, any> | null | No | — |
endpoint | string | Yes | — |
model | string | null | No | — |
agent_id | string | null | No | — |
output_file | string | null | No | File id of the results; read it with files.getSignedUrl. |
error_file | string | null | No | — |
errors | object[] | Yes | — |
outputs | Record<string, any>[] | null | No | — |
status | QUEUED | RUNNING | SUCCESS | FAILED | TIMEOUT_EXCEEDED | CANCELLATION_REQUESTED | CANCELLED | string | Yes | — |
created_at | number | Yes | — |
total_requests | number | Yes | — |
completed_requests | number | Yes | — |
succeeded_requests | number | Yes | — |
failed_requests | number | Yes | — |
started_at | number | null | No | — |
completed_at | number | null | No | — |
errors full type
errors full type
{
message: string,
count?: number | null
}[]
list
batch.list
List batch jobs, filtered by status, model or date; page with page and page_size
Risk: read
await corsair.mistralai.api.batch.list({ status: ['RUNNING', 'QUEUED'], page_size: 20 });
| Name | Type | Required | Description |
|---|---|---|---|
page | number | No | — |
page_size | number | No | — |
model | string | No | — |
agent_id | string | No | — |
created_after | string | No | ISO 8601 date-time, for example 2026-11-01T00:00:00Z. |
created_by_me | boolean | No | — |
status | (QUEUED | RUNNING | SUCCESS | FAILED | TIMEOUT_EXCEEDED | CANCELLATION_REQUESTED | CANCELLED)[] | No | — |
order_by | created | -created | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
data | object[] | null | No | — |
object | string | null | No | — |
total | number | Yes | — |
data full type
data full type
{
id: string,
object?: string | null,
input_files: string[],
metadata?: Record<string, any> | null,
endpoint: string,
model?: string | null,
agent_id?: string | null,
output_file?: string | null,
error_file?: string | null,
errors: {
message: string,
count?: number | null
}[],
outputs?: Record<string, any>[] | null,
status: QUEUED | RUNNING | SUCCESS | FAILED | TIMEOUT_EXCEEDED | CANCELLATION_REQUESTED | CANCELLED | string,
created_at: number,
total_requests: number,
completed_requests: number,
succeeded_requests: number,
failed_requests: number,
started_at?: number | null,
completed_at?: number | null
}[] | null
Chat
complete
chat.complete
Generate a chat answer from a list of messages, with optional tools and JSON output; spends Mistral credits
Risk: destructive
await corsair.mistralai.api.chat.complete({ model: 'mistral-small-latest', messages: [{ role: 'system', content: 'Answer briefly.' }, { role: 'user', content: 'Capital of France?' }], temperature: 0.2 });
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model id, for example mistral-small-latest. models.list lists the ones this key can use. |
temperature | number | No | — |
top_p | number | No | — |
safe_prompt | boolean | No | Prepend Mistral’s safety system prompt. |
max_tokens | number | No | — |
min_tokens | number | No | — |
stop | string | string[] | No | — |
random_seed | number | No | — |
metadata | Record<string, any> | No | — |
messages | object[] | Yes | Conversation so far: { role: “system” | “user” | “assistant” | “tool”, content }. |
response_format | object | No | — |
tools | object[] | No | — |
tool_choice | auto | none | any | required | object | No | — |
presence_penalty | number | No | — |
frequency_penalty | number | No | — |
repetition_penalty | number | No | — |
top_k | number | No | — |
n | number | No | — |
logprobs | boolean | No | — |
top_logprobs | number | No | — |
prediction | object | No | — |
parallel_tool_calls | boolean | No | — |
reasoning_effort | none | minimal | low | medium | high | xhigh | max | No | — |
prompt_mode | reasoning | No | — |
guardrails | object[] | No | — |
prompt_cache_key | string | No | — |
service_tier | auto | standard_only | No | — |
stream is always false; the answer is in choices[0].message.content. Pass response_format: { type: "json_schema", json_schema: { name, schema } } for structured output.
messages full type
messages full type
(
{
role: system,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[]
} | {
role: user,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null
} | {
role: assistant,
content?: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null,
tool_calls?: {
id?: string,
type?: function,
function: {
name: string,
arguments: string | Record<string, any>
},
index?: number
}[] | null,
prefix?: boolean | null
} | {
role: tool,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null,
tool_call_id?: string | null,
name?: string | null
}
)[]
response_format full type
response_format full type
{
type: text | json_object | json_schema,
json_schema?: {
name: string,
description?: string,
schema: Record<string, any>,
strict?: boolean
}
}
tools full type
tools full type
(
{
type: function,
function: {
name: string,
description?: string,
strict?: boolean,
parameters: Record<string, any>
}
} | {
type: image_generation,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: document_library,
library_ids: string[],
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
} | {
type: connector,
connector_id: string,
authorization?: Record<string, any>,
tool_configuration?: {
exclude?: string[],
include?: string[],
requires_confirmation?: string[]
}
}
)[]
tool_choice full type
tool_choice full type
auto | none | any | required | {
type: function,
function: {
name: string
}
}
prediction full type
prediction full type
{
type: content,
content: string
}
guardrails full type
guardrails full type
{
block_on_error?: boolean,
moderation_llm_v1?: Record<string, any>,
moderation_llm_v2?: Record<string, any>
}[]
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
model | string | Yes | — |
created | number | null | No | — |
usage | object | null | No | — |
choices | object[] | Yes | — |
usage full type
usage full type
{
prompt_tokens?: number | null,
completion_tokens?: number | null,
total_tokens?: number | null,
prompt_audio_seconds?: number | null
} | null
choices full type
choices full type
{
index: number,
message?: {
role?: string | null,
content?: string | any[] | null,
tool_calls?: {
id?: string,
type?: function,
function: {
name: string,
arguments: string | Record<string, any>
},
index?: number
}[] | null,
prefix?: boolean | null
} | null,
finish_reason?: string | null
}[]
Classifiers
classify
classifiers.classify
Classify texts with a fine-tuned classifier model; spends Mistral credits
Risk: destructive
await corsair.mistralai.api.classifiers.classify({ model: '<fine-tuned classifier id>', input: ['I want a refund for my order'] });
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | A moderation or classifier model, for example mistral-moderation-latest. |
input | string | string[] | Yes | One text or a list of texts. |
metadata | Record<string, any> | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
model | string | Yes | — |
results | object[] | Yes | — |
results full type
results full type
Record<string, {
scores: Record<string, number>
}>[]
classifyChat
classifiers.classifyChat
Classify conversations with a fine-tuned classifier model; spends Mistral credits
Risk: destructive
await corsair.mistralai.api.classifiers.classifyChat({ model: '<fine-tuned classifier id>', input: { messages: [{ role: 'user', content: 'I want a refund' }] } });
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | A fine-tuned classifier model id. |
input | object | object[] | Yes | { messages } or a list of them. |
input full type
input full type
{
messages: (
{
role: system,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[]
} | {
role: user,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null
} | {
role: assistant,
content?: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null,
tool_calls?: {
id?: string,
type?: function,
function: {
name: string,
arguments: string | Record<string, any>
},
index?: number
}[] | null,
prefix?: boolean | null
} | {
role: tool,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null,
tool_call_id?: string | null,
name?: string | null
}
)[]
} | {
messages: (
{
role: system,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[]
} | {
role: user,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null
} | {
role: assistant,
content?: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null,
tool_calls?: {
id?: string,
type?: function,
function: {
name: string,
arguments: string | Record<string, any>
},
index?: number
}[] | null,
prefix?: boolean | null
} | {
role: tool,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null,
tool_call_id?: string | null,
name?: string | null
}
)[]
}[]
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
model | string | Yes | — |
results | object[] | Yes | — |
results full type
results full type
Record<string, {
scores: Record<string, number>
}>[]
moderate
classifiers.moderate
Score texts against moderation categories (sexual, hate, violence, self-harm…); spends Mistral credits
Risk: destructive
await corsair.mistralai.api.classifiers.moderate({ model: 'mistral-moderation-latest', input: ['Text to check'] });
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | A moderation or classifier model, for example mistral-moderation-latest. |
input | string | string[] | Yes | One text or a list of texts. |
metadata | Record<string, any> | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
model | string | Yes | — |
results | object[] | Yes | — |
results full type
results full type
{
categories?: Record<string, boolean> | null,
category_scores?: Record<string, number> | null
}[]
moderateChat
classifiers.moderateChat
Score a conversation against moderation categories; spends Mistral credits
Risk: destructive
await corsair.mistralai.api.classifiers.moderateChat({ model: 'mistral-moderation-latest', input: [{ role: 'user', content: 'Message to check' }] });
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | A moderation model, for example mistral-moderation-latest. |
input | object[] | Yes | One conversation, or a list of conversations. |
input full type
input full type
(
{
role: system,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[]
} | {
role: user,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null
} | {
role: assistant,
content?: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null,
tool_calls?: {
id?: string,
type?: function,
function: {
name: string,
arguments: string | Record<string, any>
},
index?: number
}[] | null,
prefix?: boolean | null
} | {
role: tool,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null,
tool_call_id?: string | null,
name?: string | null
}
)[] | (
{
role: system,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[]
} | {
role: user,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null
} | {
role: assistant,
content?: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null,
tool_calls?: {
id?: string,
type?: function,
function: {
name: string,
arguments: string | Record<string, any>
},
index?: number
}[] | null,
prefix?: boolean | null
} | {
role: tool,
content: string | (
{
type: text,
text: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: document_url,
document_url: string,
document_name?: string
} | {
type: file,
file_id: string
} | {
type: input_audio,
input_audio: string
} | {
type: string
}
)[] | null,
tool_call_id?: string | null,
name?: string | null
}
)[][]
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
model | string | Yes | — |
results | object[] | Yes | — |
results full type
results full type
{
categories?: Record<string, boolean> | null,
category_scores?: Record<string, number> | null
}[]
Embeddings
create
embeddings.create
Turn one or more texts into embedding vectors; spends Mistral credits
Risk: destructive
await corsair.mistralai.api.embeddings.create({ model: 'mistral-embed', input: ['How do I reset my password?', 'Billing questions'] });
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | An embedding model, for example mistral-embed. |
input | string | string[] | Yes | One text or a list of texts. |
output_dimension | number | No | — |
output_dtype | float | int8 | uint8 | binary | ubinary | No | — |
encoding_format | float | base64 | No | — |
metadata | Record<string, any> | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | null | No | — |
object | string | null | No | — |
model | string | null | No | — |
usage | object | null | No | — |
data | object[] | Yes | — |
usage full type
usage full type
{
prompt_tokens?: number | null,
completion_tokens?: number | null,
total_tokens?: number | null,
prompt_audio_seconds?: number | null
} | null
data full type
data full type
{
object?: string | null,
embedding?: number[] | string | null,
index?: number | null
}[]
Files
delete
files.delete
Delete an uploaded file; cannot be undone
Risk: destructive · Irreversible
await corsair.mistralai.api.files.delete({ file_id: '<file id>' });
| Name | Type | Required | Description |
|---|---|---|---|
file_id | string | Yes | File id (uuid), from files.upload or files.list. |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
deleted | boolean | null | No | — |
get
files.get
Get a file’s details
Risk: read
await corsair.mistralai.api.files.get({ file_id: '<file id>' });
| Name | Type | Required | Description |
|---|---|---|---|
file_id | string | Yes | File id (uuid), from files.upload or files.list. |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | Yes | — |
bytes | number | Yes | — |
created_at | number | Yes | — |
filename | string | Yes | — |
purpose | string | Yes | — |
sample_type | string | null | No | — |
num_lines | number | null | No | — |
mimetype | string | null | No | — |
source | string | null | No | — |
signature | string | null | No | — |
expires_at | number | null | No | — |
visibility | string | null | No | — |
deleted | boolean | null | No | — |
getSignedUrl
files.getSignedUrl
A temporary download URL for a file’s content, such as a batch job’s output_file
Risk: read
await corsair.mistralai.api.files.getSignedUrl({ file_id: '<file id>', expiry: 1 });
| Name | Type | Required | Description |
|---|---|---|---|
file_id | string | Yes | File id (uuid), from files.upload or files.list. |
expiry | number | No | Hours the URL stays valid (Mistral default 24). |
| Name | Type | Required | Description |
|---|---|---|---|
url | string | Yes | — |
list
files.list
List uploaded files, filtered by purpose or name; page with page and page_size
Risk: read
await corsair.mistralai.api.files.list({ purpose: 'batch', page: 0, page_size: 20 });
| Name | Type | Required | Description |
|---|---|---|---|
page | number | No | — |
page_size | number | No | — |
include_total | boolean | No | — |
purpose | fine-tune | batch | ocr | agentic_safety | audio | No | — |
search | string | No | — |
sample_type | (pretrain | instruct | batch_request | batch_result | batch_error)[] | No | — |
source | (upload | repository | mistral)[] | No | — |
mimetypes | string[] | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
data | object[] | Yes | — |
object | string | Yes | — |
total | number | null | No | — |
data full type
data full type
{
id: string,
object: string,
bytes: number,
created_at: number,
filename: string,
purpose: string,
sample_type?: string | null,
num_lines?: number | null,
mimetype?: string | null,
source?: string | null,
signature?: string | null,
expires_at?: number | null,
visibility?: string | null
}[]
upload
files.upload
Upload a file (base64, up to 512 MB) for batch jobs, fine-tuning or OCR; returns its id
Risk: write
await corsair.mistralai.api.files.upload({ filename: 'requests.jsonl', content_base64: '<base64 .jsonl>', purpose: 'batch' });
| Name | Type | Required | Description |
|---|---|---|---|
filename | string | Yes | Name to store the file under, for example requests.jsonl. |
content_base64 | string | Yes | File content, base64 (a data: URL prefix is accepted). |
purpose | fine-tune | batch | ocr | agentic_safety | audio | No | fine-tune, batch (a .jsonl of requests for batch.create), ocr or agentic_safety. |
visibility | workspace | user | No | — |
expiry | number | No | Hours until Mistral deletes the file. |
content_base64 is the file content; a data: URL prefix is accepted. Use purpose batch for batch input, fine-tune for training data, ocr for documents.
Output
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | Yes | — |
bytes | number | Yes | — |
created_at | number | Yes | — |
filename | string | Yes | — |
purpose | string | Yes | — |
sample_type | string | null | No | — |
num_lines | number | null | No | — |
mimetype | string | null | No | — |
source | string | null | No | — |
signature | string | null | No | — |
expires_at | number | null | No | — |
visibility | string | null | No | — |
Fim
complete
fim.complete
Fill in code between a prompt and a suffix with a Codestral model; spends Mistral credits
Risk: destructive
await corsair.mistralai.api.fim.complete({ model: 'codestral-latest', prompt: 'def fibonacci(n):', suffix: 'print(fibonacci(10))', max_tokens: 64 });
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | A code model, for example codestral-latest. |
prompt | string | Yes | Code before the gap. |
suffix | string | No | Code after the gap. |
temperature | number | No | — |
top_p | number | No | — |
max_tokens | number | No | — |
min_tokens | number | No | — |
stop | string | string[] | No | — |
random_seed | number | No | — |
metadata | Record<string, any> | No | — |
prompt_cache_key | string | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
model | string | Yes | — |
created | number | null | No | — |
usage | object | null | No | — |
choices | object[] | Yes | — |
usage full type
usage full type
{
prompt_tokens?: number | null,
completion_tokens?: number | null,
total_tokens?: number | null,
prompt_audio_seconds?: number | null
} | null
choices full type
choices full type
{
index: number,
message?: {
role?: string | null,
content?: string | any[] | null,
tool_calls?: {
id?: string,
type?: function,
function: {
name: string,
arguments: string | Record<string, any>
},
index?: number
}[] | null,
prefix?: boolean | null
} | null,
finish_reason?: string | null
}[]
Models
archive
models.archive
Archive a fine-tuned model; models.unarchive restores it
Risk: write
await corsair.mistralai.api.models.archive({ model_id: 'ft:open-mistral-7b:<org>:<date>:<id>' });
| Name | Type | Required | Description |
|---|---|---|---|
model_id | string | Yes | Model id, for example mistral-small-latest or ft:… for a fine-tune. |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
archived | boolean | null | No | — |
delete
models.delete
Delete a fine-tuned model; cannot be undone
Risk: destructive · Irreversible
await corsair.mistralai.api.models.delete({ model_id: 'ft:open-mistral-7b:<org>:<date>:<id>' });
| Name | Type | Required | Description |
|---|---|---|---|
model_id | string | Yes | Model id, for example mistral-small-latest or ft:… for a fine-tune. |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
deleted | boolean | null | No | — |
get
models.get
Get a model’s details and capabilities
Risk: read
await corsair.mistralai.api.models.get({ model_id: 'mistral-small-latest' });
| Name | Type | Required | Description |
|---|---|---|---|
model_id | string | Yes | Model id, for example mistral-small-latest or ft:… for a fine-tune. |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
created | number | null | No | — |
owned_by | string | null | No | — |
capabilities | Record<string, any> | null | No | — |
name | string | null | No | — |
description | string | null | No | — |
max_context_length | number | null | No | — |
aliases | string[] | null | No | — |
deprecation | string | null | No | — |
deprecation_replacement_model | string | null | No | — |
default_model_temperature | number | null | No | — |
type | string | null | No | base or fine-tuned. |
job | string | null | No | — |
root | string | null | No | — |
archived | boolean | null | No | — |
list
models.list
List the base and fine-tuned models this key can use, with their capabilities
Risk: read
await corsair.mistralai.api.models.list({});
| Name | Type | Required | Description |
|---|---|---|---|
provider | string | No | — |
model | string | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
object | string | null | No | — |
data | object[] | null | No | — |
data full type
data full type
{
id: string,
object?: string | null,
created?: number | null,
owned_by?: string | null,
capabilities?: Record<string, any> | null,
name?: string | null,
description?: string | null,
max_context_length?: number | null,
aliases?: string[] | null,
deprecation?: string | null,
deprecation_replacement_model?: string | null,
default_model_temperature?: number | null,
type?: string | null,
job?: string | null,
root?: string | null,
archived?: boolean | null
}[] | null
unarchive
models.unarchive
Restore an archived fine-tuned model
Risk: write
await corsair.mistralai.api.models.unarchive({ model_id: 'ft:open-mistral-7b:<org>:<date>:<id>' });
| Name | Type | Required | Description |
|---|---|---|---|
model_id | string | Yes | Model id, for example mistral-small-latest or ft:… for a fine-tune. |
models.archive.
Output
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
archived | boolean | null | No | — |
update
models.update
Rename a fine-tuned model or change its description
Risk: write
await corsair.mistralai.api.models.update({ model_id: 'ft:open-mistral-7b:<org>:<date>:<id>', name: 'Support tone v2' });
| Name | Type | Required | Description |
|---|---|---|---|
model_id | string | Yes | Model id, for example mistral-small-latest or ft:… for a fine-tune. |
name | string | No | — |
description | string | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | null | No | — |
created | number | null | No | — |
owned_by | string | null | No | — |
workspace_id | string | null | No | — |
root | string | null | No | — |
root_version | string | null | No | — |
archived | boolean | null | No | — |
name | string | null | No | — |
description | string | null | No | — |
capabilities | Record<string, any> | null | No | — |
max_context_length | number | null | No | — |
aliases | string[] | null | No | — |
job | string | null | No | — |
model_type | string | null | No | completion or classifier. |
Ocr
process
ocr.process
Read a PDF or image (URL or uploaded file) into markdown per page, with optional structured annotations; spends Mistral credits
Risk: destructive
await corsair.mistralai.api.ocr.process({ model: 'mistral-ocr-latest', document: { type: 'document_url', document_url: 'https://arxiv.org/pdf/2201.04234' }, pages: [0, 1] });
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | An OCR model, for example mistral-ocr-latest. |
document | object | Yes | { type: “document_url”, document_url } for a PDF, { type: “image_url”, image_url } for an image, or { type: “file”, file_id } for an uploaded file. document_url and image_url take a URL or a base64 data URL, for example “data:application/pdf;base64,…” or “data:image/png;base64,…”. |
pages | string | number[] | No | Pages to read, 0-based, for example [0, 1] or “0-3”. |
include_image_base64 | boolean | No | — |
image_limit | number | No | — |
image_min_size | number | No | — |
bbox_annotation_format | object | No | — |
document_annotation_format | object | No | — |
document_annotation_prompt | string | No | — |
table_format | markdown | html | No | — |
extract_header | boolean | No | — |
extract_footer | boolean | No | — |
include_blocks | boolean | No | — |
confidence_scores_granularity | word | page | block | No | — |
document full type
document full type
{
type: document_url,
document_url: string,
document_name?: string
} | {
type: image_url,
image_url: string | {
url: string,
detail?: string
}
} | {
type: file,
file_id: string
}
bbox_annotation_format full type
bbox_annotation_format full type
{
type: text | json_object | json_schema,
json_schema?: {
name: string,
description?: string,
schema: Record<string, any>,
strict?: boolean
}
}
document_annotation_format full type
document_annotation_format full type
{
type: text | json_object | json_schema,
json_schema?: {
name: string,
description?: string,
schema: Record<string, any>,
strict?: boolean
}
}
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | — |
pages | object[] | Yes | — |
document_annotation | string | null | No | — |
usage_info | object | Yes | — |
pages full type
pages full type
{
index: number,
markdown: string,
images?: {
id: string,
image_base64?: string | null,
image_annotation?: string | null
}[] | null,
header?: string | null,
footer?: string | null,
dimensions?: {
dpi: number,
height: number,
width: number
} | null
}[]
usage_info full type
usage_info full type
{
pages_processed: number,
doc_size_bytes?: number | null
}
Responses
countInputTokens
responses.countInputTokens
Count the input tokens a responses.create call would use, without running it
Risk: read
await corsair.mistralai.api.responses.countInputTokens({ model: 'mistral-medium-latest', input: 'Draft a two-line release note for v2.1' });
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model id, for example mistral-small-latest. models.list lists the ones this key can use. |
input | string | Record<string, any>[] | Yes | A prompt, or a list of items such as { role: “user”, content: ”…” }. |
instructions | string | No | — |
tools | object[] | No | — |
tool_choice | none | auto | required | object | No | — |
parallel_tool_calls | boolean | No | — |
reasoning | object | No | — |
text | object | No | — |
tools full type
tools full type
{
type: function | namespace,
name: string,
description?: string,
parameters?: Record<string, any>,
strict?: boolean,
tools?: Record<string, any>[]
}[]
tool_choice full type
tool_choice full type
none | auto | required | {
type: function,
name: string
}
reasoning full type
reasoning full type
{
effort?: none | minimal | low | medium | high | xhigh | max
}
text full type
text full type
{
format?: Record<string, any>,
verbosity?: low | medium | high
}
| Name | Type | Required | Description |
|---|---|---|---|
input_tokens | number | Yes | — |
object | string | Yes | — |
create
responses.create
Generate a response with the Responses API (input items, tools, reasoning); spends Mistral credits
Risk: destructive
await corsair.mistralai.api.responses.create({ model: 'mistral-medium-latest', input: 'Draft a two-line release note for v2.1', max_output_tokens: 120 });
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model id, for example mistral-small-latest. models.list lists the ones this key can use. |
input | string | Record<string, any>[] | Yes | A prompt, or a list of items such as { role: “user”, content: ”…” }. |
instructions | string | No | — |
tools | object[] | No | — |
tool_choice | none | auto | required | object | No | — |
parallel_tool_calls | boolean | No | — |
reasoning | object | No | — |
text | object | No | — |
max_output_tokens | number | No | — |
temperature | number | No | — |
top_p | number | No | — |
metadata | Record<string, string> | No | — |
max_tool_calls | number | No | — |
prompt_cache_key | string | No | — |
tools full type
tools full type
{
type: function | namespace,
name: string,
description?: string,
parameters?: Record<string, any>,
strict?: boolean,
tools?: Record<string, any>[]
}[]
tool_choice full type
tool_choice full type
none | auto | required | {
type: function,
name: string
}
reasoning full type
reasoning full type
{
effort?: none | minimal | low | medium | high | xhigh | max
}
text full type
text full type
{
format?: Record<string, any>,
verbosity?: low | medium | high
}
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
object | string | Yes | — |
created_at | number | Yes | — |
model | string | Yes | — |
status | string | null | No | — |
output | Record<string, any>[] | Yes | — |
error | object | null | No | — |
incomplete_details | object | null | No | — |
usage | object | null | No | — |
error full type
error full type
{
code: string,
message: string
} | null
incomplete_details full type
incomplete_details full type
{
reason?: string | null
} | null
usage full type
usage full type
{
input_tokens: number,
output_tokens: number,
total_tokens: number
} | null
Voices
create
voices.create
Create a custom voice from a base64 audio sample
Risk: write
await corsair.mistralai.api.voices.create({ name: 'Narrator', languages: ['en'], sample_audio: '<base64 audio>', sample_filename: 'sample.wav' });
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | — |
languages | string[] | No | — |
gender | female | male | neutral | No | — |
age | number | No | — |
tags | string[] | No | — |
description | string | No | — |
retention_notice | number | No | — |
color | string | No | — |
sample_audio | string | No | Base64 audio sample of the voice to clone. |
sample_filename | string | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
name | string | Yes | — |
slug | string | null | No | — |
languages | string[] | null | No | — |
gender | string | null | No | — |
age | number | null | No | — |
tags | string[] | null | No | — |
color | string | null | No | — |
description | string | null | No | — |
retention_notice | number | null | No | — |
created_at | string | Yes | — |
user_id | string | null | No | — |
kind | string | null | No | — |
type | string | Yes | preset or custom. |
delete
voices.delete
Delete a custom voice; cannot be undone
Risk: destructive · Irreversible
await corsair.mistralai.api.voices.delete({ voice_id: '<voice id>' });
| Name | Type | Required | Description |
|---|---|---|---|
voice_id | string | Yes | Voice id, from voices.list. |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
name | string | Yes | — |
slug | string | null | No | — |
languages | string[] | null | No | — |
gender | string | null | No | — |
age | number | null | No | — |
tags | string[] | null | No | — |
color | string | null | No | — |
description | string | null | No | — |
retention_notice | number | null | No | — |
created_at | string | Yes | — |
user_id | string | null | No | — |
kind | string | null | No | — |
type | string | Yes | preset or custom. |
get
voices.get
Get a voice
Risk: read
await corsair.mistralai.api.voices.get({ voice_id: '<voice id>' });
| Name | Type | Required | Description |
|---|---|---|---|
voice_id | string | Yes | Voice id, from voices.list. |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
name | string | Yes | — |
slug | string | null | No | — |
languages | string[] | null | No | — |
gender | string | null | No | — |
age | number | null | No | — |
tags | string[] | null | No | — |
color | string | null | No | — |
description | string | null | No | — |
retention_notice | number | null | No | — |
created_at | string | Yes | — |
user_id | string | null | No | — |
kind | string | null | No | — |
type | string | Yes | preset or custom. |
list
voices.list
List preset and custom voices for audio.speech; page with page_token
Risk: read
await corsair.mistralai.api.voices.list({ type: 'preset', page_size: 20 });
| Name | Type | Required | Description |
|---|---|---|---|
page_size | number | No | — |
page_token | string | No | next_page_token from the previous page. |
type | all | custom | preset | No | — |
gender | (female | male | neutral)[] | No | — |
language | string[] | No | — |
query | string | No | — |
kind | ivc | pvc | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
data | object[] | Yes | — |
next_page_token | string | null | No | — |
data full type
data full type
{
id: string,
name: string,
slug?: string | null,
languages?: string[] | null,
gender?: string | null,
age?: number | null,
tags?: string[] | null,
color?: string | null,
description?: string | null,
retention_notice?: number | null,
created_at: string,
user_id?: string | null,
kind?: string | null,
type: string
}[]
update
voices.update
Change a custom voice’s name, languages, tags or details
Risk: write
await corsair.mistralai.api.voices.update({ voice_id: '<voice id>', tags: ['calm', 'narration'] });
| Name | Type | Required | Description |
|---|---|---|---|
voice_id | string | Yes | Voice id, from voices.list. |
name | string | No | — |
languages | string[] | No | — |
gender | female | male | neutral | No | — |
age | number | No | — |
tags | string[] | No | — |
description | string | No | — |
retention_notice | number | No | — |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | — |
name | string | Yes | — |
slug | string | null | No | — |
languages | string[] | null | No | — |
gender | string | null | No | — |
age | number | null | No | — |
tags | string[] | null | No | — |
color | string | null | No | — |
description | string | null | No | — |
retention_notice | number | null | No | — |
created_at | string | Yes | — |
user_id | string | null | No | — |
kind | string | null | No | — |
type | string | Yes | preset or custom. |