DocsAPI keys

Get started

Quickstart

Get an API key, send a request, and stream the answer. You need a Gateway organization: API keys belong to one.

  1. Get an API key

    An API key belongs to a Gateway organization, and only its owner can create one, while signed in: in Settings › API keys, or with POST /organization/apikeys. The key is shown once. No Gateway organization yet? Create one. Authentication has the details.

    Keep keys on your serverAnyone with the key can spend your organization’s credits. Don’t put it in a browser or a mobile app.
    Terminal
    export MOMOR_API_KEY="…"
  2. Send a request

    Point any OpenAI-compatible SDK at the /v1 address below and use your Momor key. Ask for a model by its ID from the model catalog.

    curl https://api.momor.ai/v1/chat/completions \
      -H "Authorization: Bearer $MOMOR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "openai/gpt-5.4-mini",
        "max_tokens": 1024,
        "messages": [
          { "role": "user", "content": "Summarise this contract in three points." }
        ]
      }'

    The answer is a standard chat completion, with model naming the model that served it. Its id is the call’s request id, also sent in the X-Momor-Request-Id header: read the call back with Get a generation to see each provider tried and what each attempt cost.

  3. Stream the answer

    Set stream to true to receive the answer as server-sent events. The X-Momor-Provider and X-Momor-Model headers name who is answering. A provider that fails before it sends anything is passed over for the next one; once output has begun, a failure ends the stream with an error chunk, and the call is not restarted on another provider. Momor’s own API can roll over instead.

    curl https://api.momor.ai/v1/chat/completions \
      -H "Authorization: Bearer $MOMOR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "openai/gpt-5.4-mini",
        "max_tokens": 1024,
        "stream": true,
        "messages": [
          { "role": "user", "content": "Summarise this contract in three points." }
        ]
      }'
  4. Let Gateway choose

    Instead of one model, add more in models. Gateway tries every model model names, then each entry of models in order, and moves on when one can’t serve the call. A selector can be a model ID, a publisher’s model, or a tier such as tier/high; see choosing a model.

    Request body
    {
      "model": "anthropic/claude-sonnet-5",
      "models": ["openai/gpt-5.6-terra", "tier/high"],
      "max_tokens": 1024,
      "messages": [{ "role": "user", "content": "…" }]
    }

Next

Updated Oct 22, 2026
Esc