Skip to content
ContractSpec
Start here
AI index

Mistral

Integrate Mistral models for chat, reasoning, embeddings, speech-to-text, and conversational voice workflows. ContractSpec ships first-class Mistral support across contracts, provider runtime wiring, and CLI provider selection.

Setup

# .env
MISTRAL_API_KEY=...

Chat and reasoning

capabilityId: mistral-chat
provider:
  type: mistral
  operation: chatCompletion

inputs:
  messages:
    type: array
  model:
    type: string
    default: "mistral-large-latest"
  temperature:
    type: number
    optional: true

outputs:
  content:
    type: string
  usage:
    type: object

Embeddings

capabilityId: mistral-embeddings
provider:
  type: mistral
  operation: createEmbedding

inputs:
  text:
    type: string
  model:
    type: string
    default: "mistral-embed"

outputs:
  embedding:
    type: array
    items:
      type: number

Speech-to-Text (Voxtral)

capabilityId: mistral-stt
provider:
  type: mistral
  operation: transcribe

inputs:
  audio:
    type: bytes
  format:
    type: string
  language:
    type: string
    optional: true

outputs:
  text:
    type: string
  segments:
    type: array
  language:
    type: string

Conversational voice sessions

Use the conversational provider for session-based realtime voice flows (turn handling, events, and interruption-safe streaming).

Best practices

  • Choose model families by workload: coding, reasoning, or speech

  • Persist session IDs for conversational continuity across turns

  • Capture token and latency telemetry for provider-level tuning

  • Set explicit fallbacks for network and rate-limit failures