POST
/
mistral
/
{region}
/
v1
/
fim
/
completions

Creates a code completion using the Codestral model from Mistral.

All parameters from the Mistral fill-in-the-middle Completion endpoint are supported according to the Mistral specifications.

Rate limits

The rate limit for the FIM Completion endpoint is 500 RPM (requests per minute) and 60.000 TPM (tokens per minute). Rate limits are defined at the workspace level - and not at an API key level. Each model has its own rate limit. If you exceed your rate limit, you will receive a 429 Too Many Requests response.

Please note that the rate limits are subject to change, refer to this documentation for the most up-to-date information. In case you need a higher rate limit, please contact us at support@langdock.com.

Using the Continue AI Code Assistant

Using the Codestral model, combined with chat completion models from the Langdock API, makes it possible to use the open-source AI code assistant Continue (continue.dev) fully via the Langdock API.

Continue is available as a VS Code extension and as a JetBrains extension. To customize the models used by Continue, you can edit the configuration file at ~/.continue/config.json (MacOS / Linux) or %USERPROFILE%\.continue\config.json (Windows).

Below is an example setup for using Continue with the Codestral model for autocomplete and Claude 3.5 Sonnet and GPT-4o models for chats and edits, all served from the Langdock API.

{
  "models": [
    {
      "title": "GPT-4o",
      "provider": "openai",
      "model": "gpt-4o",
      "apiKey": "<YOUR_LANGDOCK_API_KEY>",
      "apiBase": "https://api.langdock.com/openai/eu/v1"
    },
    {
      "title": "Claude 3.5 Sonnet",
      "provider": "anthropic",
      "model": "claude-3-5-sonnet-20240620",
      "apiKey": "<YOUR_LANGDOCK_API_KEY>",
      "apiBase": "https://api.langdock.com/anthropic/eu/v1"
    }
  ],
  "tabAutocompleteModel": {
    "title": "Codestral",
    "provider": "mistral",
    "model": "codestral-2405",
    "apiKey": "<YOUR_LANGDOCK_API_KEY>",
    "apiBase": "https://api.langdock.com/mistral/eu/v1"
  }
  /* ... other configuration ... */
}

Path Parameters

region
enum<string>
required

The region of the API to use.

Available options:
eu

Body

application/json
model
string
default: codestral-2405required

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

  • codestral-2405
prompt
string
required

The text/code to complete.

temperature
number

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.

Required range: 0 < x < 1.5
top_p
number
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.

Required range: 0 < x < 1
max_tokens
integer

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.

Required range: x > 0
stream
boolean
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

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

random_seed
integer

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

Required range: x > 0
suffix
string
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

The minimum number of tokens to generate in the completion.

Required range: x > 0

Response

200 - application/json
id
string
required
object
string
required
model
string
required
usage
object
required
created
integer
choices
object[]