Mistral AI FIM API

Fill-in-the-Middle code completion operations

Operations 1

POST /fim/completions Mistral AI Create a FIM completion #

Documentation

Specifications

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/mistral-fim-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

mistral-fim-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Mistral AI FIM API
  description: Fill-in-the-Middle code completion API powered by Codestral. Generates code between a given prompt prefix and optional suffix, supporting over 80 programming languages for inline code completion and code generation.
  version: '1.0'
  contact:
    name: Mistral AI Support
    url: https://docs.mistral.ai/
    email: support@mistral.ai
  termsOfService: https://mistral.ai/terms/
servers:
- url: https://api.mistral.ai/v1
  description: Mistral AI Production
- url: https://codestral.mistral.ai/v1
  description: Codestral Dedicated Endpoint
security:
- bearerAuth: []
tags:
- name: FIM
  description: Fill-in-the-Middle code completion operations
paths:
  /fim/completions:
    post:
      operationId: createFimCompletion
      summary: Mistral AI Create a FIM completion
      description: Generate code to fill in between a given prompt prefix and optional suffix. Powered by Codestral for high-quality code completions across 80+ programming languages.
      tags:
      - FIM
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FimCompletionRequest'
      responses:
        '200':
          description: FIM completion response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FimCompletionResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/FimCompletionStreamResponse'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Rate limit exceeded
components:
  schemas:
    FimCompletionStreamResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          enum:
          - chat.completion.chunk
        created:
          type: integer
        model:
          type: string
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              delta:
                type: object
                properties:
                  role:
                    type: string
                  content:
                    type: string
              finish_reason:
                type:
                - string
                - 'null'
    FimCompletionResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          enum:
          - chat.completion
        created:
          type: integer
        model:
          type: string
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              message:
                type: object
                properties:
                  role:
                    type: string
                  content:
                    type: string
              finish_reason:
                type: string
                enum:
                - stop
                - length
        usage:
          type: object
          properties:
            prompt_tokens:
              type: integer
            completion_tokens:
              type: integer
            total_tokens:
              type: integer
    FimCompletionRequest:
      type: object
      required:
      - model
      - prompt
      properties:
        model:
          type: string
          description: ID of the model to use
          examples:
          - codestral-latest
        prompt:
          type: string
          description: The text before the code to complete (prefix)
        suffix:
          type: string
          description: The text after the code to complete (optional suffix)
        temperature:
          type: number
          minimum: 0
          maximum: 2
          default: 0.7
          description: Sampling temperature
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          description: Nucleus sampling parameter
        max_tokens:
          type: integer
          minimum: 1
          description: Maximum number of tokens to generate
        stream:
          type: boolean
          default: false
          description: Whether to stream partial completions
        stop:
          oneOf:
          - type: string
          - type: array
            items:
              type: string
          description: Stop sequences
        random_seed:
          type: integer
          description: Random seed for deterministic generation
        min_tokens:
          type: integer
          minimum: 0
          description: Minimum number of tokens to generate
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Mistral AI API key or Codestral API key
externalDocs:
  description: Mistral AI FIM API Documentation
  url: https://docs.mistral.ai/api/endpoint/fim