Skip to main content
Version: 3.6.2-rc.1

Connect a custom OpenAI-compatible server

This guide shows how to connect a model from any provider or server that uses the OpenAI API format, so your tenant can use it in Chat and through the platform API, the same way as the platform's own models.

Use it when the model isn't from OpenAI, Azure OpenAI or Anthropic, but its server accepts OpenAI-style requests, for example a hosted provider such as Mistral, Groq or Together AI, or a self-hosted server such as vLLM or Ollama.

Before you start​

  1. The Editor or Owner role in your tenant. See Roles in a tenant.
  2. These values from your provider's documentation or account:
    • Base URL: the server's address without /v1, such as https://api.mistral.ai.
    • API key for the server.
    • Model ID exactly as the provider spells it, such as mistral-large-latest.
  3. A server the platform can reach. The platform calls the server, not your browser. A self-hosted server needs an address the platform's network can reach. localhost doesn't work.
important

The platform adds /v1/... to the Base URL itself. If you enter https://api.mistral.ai/v1, requests go to .../v1/v1/chat/completions and fail.

Connect to a custom OpenAI-compatible server​

  1. In the sidebar of the CM portal, go to Models → External Models → Connect external model.

  2. Fill in the form:

    FieldEnterExample
    ProviderCustom OpenAI-compatible—
    Provider model IDThe model ID exactly as the provider spells it. It can't be changed later.mistral-large-latest
    API keyYour provider keysk-...
    Base URLThe server's address, without /v1 or any other path. http:// works for a server inside your network.https://api.mistral.ai
    API model idThe name your apps use to call the model. It copies Provider model ID until you edit it. It must be unique on the platform and can't be changed later.mistral-large
    Display nameThe name people see in the portal and in ChatMistral Large
    Model typeChat, Embedding, Reranker, OCR, Transcription, Guardrail or Decision. Choosing it ticks the matching modalities. See Choose the model type and modalities.Chat
    Input modalitiesWhat the model accepts. Keep the ticked ones and add any the model also supports. See Choose the model type and modalities.Text
    Output modalitiesWhat the model returns. Keep the ticked ones. See Choose the model type and modalities.Text
    Context lengthThe model's maximum tokens per request. Optional, but most servers don't report it, and apps and Chat use it to size prompts.128000
  3. Select Connect model. The model appears on the External Models tab.

  4. Share it. Right now only you and the tenant's Owners can use it. Open the model, go to the Users tab and share it with the people, groups or whole tenant that should use it. See Share a resource.

note

Connect model saves the form without contacting the server. If a value is wrong, you only find out when the first request fails, so test the model to verify it works.

Server paths the platform calls​

The platform calls these paths on your Base URL, so your server must offer the ones for the model type you choose:

Model typePath
Chat/v1/responses from Chat, /v1/chat/completions from code
Embedding/v1/embeddings
Reranker/rerank
OCR/v1/chat/completions
Transcription/v1/audio/transcriptions
Guardrail/v1/responses
Decision/v1/systemone

Test it​

In Chat: select Open chat in the sidebar, pick your model and send a message.

From code:

  1. Open the model and copy its full API model id. The platform puts your tenant's name in front of the id you entered, so mistral-large becomes something like acme/mistral-large.

  2. On the same page, select Create API key. It opens the key form with this model already granted.

  3. Copy the API URL from the bottom of the sidebar, then call the model:

    curl "<API URL>/v1/chat/completions" \
    -H "Authorization: Bearer <your platform API key>" \
    -H "Content-Type: application/json" \
    -d '{"model": "acme/mistral-large", "messages": [{"role": "user", "content": "Hello"}]}'

    Use your platform API key, not the provider's key.

warning

Test both. Chat uses your server's /v1/responses, and the curl call above uses /v1/chat/completions. Many OpenAI-compatible servers offer only the second, so the model can work from code but fail in Chat.

Good to know​

  • Which APIs work: Responses, Chat Completions, Embeddings, Rerank and Audio transcriptions, as long as your server offers the matching path. The Messages API also works through your server's /v1/responses.
  • Tool calling is limited on the Responses API. tool_choice can only be auto or none.
  • The provider bills usage, unless the server is self-hosted. The platform also counts the tokens in your tenant's usage.
  • Prompts are sent to that server. Make sure it meets your organization's data policy.

Troubleshooting​

ProblemWhat to check
Every request fails with 404Base URL has no /v1 or other path at the end.
Calls from code work, but Chat failsYour server must offer /v1/responses. If it only offers /v1/chat/completions, use the model from code.
Requests fail with "model not found" from the serverProvider model ID is spelled exactly as the provider lists it. It can't be edited, so connect the model again with the right ID.
Every request fails with an authentication errorThe API key is valid for this server.
Connection errors or timeoutsThe server is running and reachable from the platform's network. localhost doesn't work.
Connect model fails because the id is takenAnother model, alias or preset agent already uses that API model id. Choose a unique one.
The model works for you but others can't see itShare it on the model's Users tab.
The model is missing from ChatModel type is Chat, and the model is shared with you.
A call from code returns 404 with model "..." not found or not readySet model to the full API model id, with your tenant's name in front.
A call from code is refused with a permission errorThe API key is granted this model. Create one from the model's page with Create API key.