Skip to main content
Version: 3.6.2-rc.1

Connect OpenAI models

This guide shows how to connect an OpenAI model, such as GPT-4o, so your tenant can use it in Chat and through the platform API, the same way as the platform's own models.

Before you start​

Have these ready:

  1. The Editor or Owner role in your tenant. See Roles in a tenant.
  2. An OpenAI API key. Create one at platform.openai.com → API keys.
  3. The model's ID exactly as OpenAI spells it, for example gpt-4o. You can find it in OpenAI's model list.

Connect to an OpenAI model​

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

  2. Fill in the form:

    FieldEnterExample
    ProviderKeep OpenAI—
    Provider model IDThe model ID exactly as OpenAI spells it. It can't be changed later.gpt-4o
    API keyYour OpenAI keysk-...
    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.gpt-4o
    Display nameThe name people see in the portal and in ChatGPT-4o
    Model typeChat, Embedding, Transcription or Guardrail. 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, Image
    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, from OpenAI's docs. Optional, but OpenAI doesn'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.

important

Connect model saves the form without checking the key or model ID with OpenAI. If either is wrong, you only find out when the first request fails, so test the model to verify it works.

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 gpt-4o becomes something like acme/gpt-4o.

  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/gpt-4o", "messages": [{"role": "user", "content": "Hello"}]}'

    Use your platform API key, not the OpenAI key.

Good to know​

  • The connection always goes to https://api.openai.com. To use another OpenAI-compatible server, choose Custom OpenAI-compatible instead.
  • Which APIs work: Responses, Chat Completions, Embeddings and Audio transcriptions. The Messages API also works, but it uses Anthropic's format and the platform translates it.
  • OpenAI bills usage to your OpenAI account. The platform also counts the tokens in your tenant's usage.
  • Prompts are sent to OpenAI. Make sure that's allowed by your organization's data policy.
  • Web searches cost extra. Anyone who can use this model can also run web searches with it, through the Responses API's web_search tool or from Codex CLI. OpenAI charges each search to your account, and the platform doesn't count them in usage. See Search the web and Web search on gpt-6.x models.

Troubleshooting​

ProblemWhat to check
Every request fails with an authentication errorThe OpenAI key is valid, has credit, and has access to this model.
Requests fail with "model not found" or a similar error from OpenAIThe Provider model ID is spelled exactly as OpenAI lists it. It can't be edited, so connect the model again with the right ID.
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.