Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content
Guides

Connect with plain HTTP

Mubit takes each provider's own requests. Send the request you send today to Mubit's host, under the provider's prefix, with your Mubit key in place of the provider key.

The API reference has all of it in one place, with limits, retries and sizes.

Host

The host is https://api.mubit.ai. Use the base URL your console's Connect page shows.

Paths

Each provider has a prefix. After it, use the provider's own path.

ProviderPrefixExamples
OpenAI/openai/v1POST /openai/v1/chat/completions, POST /openai/v1/responses, POST /openai/v1/embeddings, GET /openai/v1/models
Anthropic/anthropicPOST /anthropic/v1/messages, POST /anthropic/v1/messages/count_tokens, GET /anthropic/v1/models
Gemini/geminiPOST /gemini/v1beta/models/{model}:generateContent, POST /gemini/v1beta/models/{model}:streamGenerateContent?alt=sse, GET /gemini/v1beta/models
OpenAI-compatible services/compat/{service}/v1POST /compat/openrouter/v1/chat/completions

For OpenAI-compatible services, see OpenAI-compatible services. For the base URL each SDK takes, see Paths in the API reference.

A path outside these prefixes gets 404 unknown_route. Organization and admin endpoints are not available through Mubit: they get 403 admin_path_refused.

ℹ️Note

The starter credit serves fewer paths. After the prefix: on Anthropic, /v1/messages, /v1/messages/count_tokens and /v1/models; on OpenAI, /chat/completions, /responses, /embeddings and /models; on Gemini, /{version}/models/{model}:generateContent and :streamGenerateContent, where {version} is a version such as v1beta or v1; on an OpenAI-compatible service, /chat/completions and /models. Any other path gets 403 starter_credit_route until you add your own key for that provider. The starter credit covers only the providers the console names.

Key

Send your Mubit key in the header your provider uses for its key:

ProviderHeader
OpenAI and OpenAI-compatible servicesAuthorization: Bearer YOUR_MUBIT_KEY
Anthropicx-api-key: YOUR_MUBIT_KEY, or Authorization: Bearer YOUR_MUBIT_KEY
Geminix-goog-api-key: YOUR_MUBIT_KEY

Send one key, and only your Mubit key. Mubit refuses a call that carries a provider key, a sign-in token, or a second, different key, with a 401. For Gemini, send the key in the header, not in ?key=.

Examples

Each example sends one support message and prints the answer with its headers (-i).

OpenAI
curl -i https://api.mubit.ai/openai/v1/chat/completions \
  -H "Authorization: Bearer $MUBIT_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "gpt-6-luna",
    "messages": [
      {"role": "system", "content": "Sort the support message into one category: billing, bug, account or other. Reply with the category only."},
      {"role": "user", "content": "The export button on my dashboard shows an error."}
    ]
  }'

The examples read your key from MUBIT_API_KEY. To stream, see the page for your provider: OpenAI, Anthropic or Gemini.

Headers

Mubit passes most other headers to the provider as you sent them, such as anthropic-version and anthropic-beta. It doesn't pass on cookies.

Mubit reads these optional headers, and doesn't send them to the provider:

HeaderWhat it does
x-middleware-storefalse keeps the call's request and answer out of Mubit's record.
x-middleware-recordfull, metadata or off: how much of the call Mubit keeps.

Every answer carries the header x-middleware-request-id: the call's ID in Mubit. Response headers lists the headers Mubit sends back.

What Mubit forwards and trains on

  • Forwarded: when Mubit sends a call on to a provider, it sends your request with that provider's key, or the starter credit's key, in place of your Mubit key. Other headers go on as Headers lists. On the starter credit, some models, paths and options are refused: see Starter credit errors.
  • Trained on: adapters train only on kept examples: the recorded calls Mubit accepts for a task. A call recorded without its request and reply is never a kept example.

Answers and errors

Mubit passes your provider's answers back to your app, its errors included.

Mubit's own errors use your provider's error format. Their type is middleware_gateway_error, and they name a code, such as missing_key or unknown_route. In Gemini's format, both are in the error's ErrorInfo detail: the code is its reason, and the type is in its metadata. For example, a call to OpenAI's path with no key gets:

{"error":{"code":"missing_key","message":"No API key was provided. Send your Mubit key where the provider's SDK sends its API key.","param":null,"request_id":"mreq_…","type":"middleware_gateway_error"}}

The API reference shows the format for each provider, and Troubleshooting lists the codes and what to do.