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.export MOMOR_API_KEY="…"Send a request
Point any OpenAI-compatible SDK at the
/v1address 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." } ] }'import os from openai import OpenAI client = OpenAI(base_url="https://api.momor.ai/v1", api_key=os.environ["MOMOR_API_KEY"]) reply = client.chat.completions.create( model="openai/gpt-5.4-mini", max_tokens=1024, messages=[{"role": "user", "content": "Summarise this contract in three points."}], ) print(reply.choices[0].message.content)import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.momor.ai/v1", apiKey: process.env.MOMOR_API_KEY }); const reply = await client.chat.completions.create({ model: "openai/gpt-5.4-mini", max_tokens: 1024, messages: [{ role: "user", content: "Summarise this contract in three points." }], }); console.log(reply.choices[0].message.content);using System.ClientModel; using OpenAI; using OpenAI.Chat; var client = new ChatClient( model: "openai/gpt-5.4-mini", credential: new ApiKeyCredential(Environment.GetEnvironmentVariable("MOMOR_API_KEY")!), options: new OpenAIClientOptions { Endpoint = new Uri("https://api.momor.ai/v1") }); ChatCompletion reply = await client.CompleteChatAsync( [new UserChatMessage("Summarise this contract in three points.")], new ChatCompletionOptions { MaxOutputTokenCount = 1024 }); Console.WriteLine(reply.Content[0].Text);The answer is a standard chat completion, with
modelnaming the model that served it. Itsidis the call’s request id, also sent in theX-Momor-Request-Idheader: read the call back with Get a generation to see each provider tried and what each attempt cost.Stream the answer
Set
streamtotrueto receive the answer as server-sent events. TheX-Momor-ProviderandX-Momor-Modelheaders 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." } ] }'stream = client.chat.completions.create( model="openai/gpt-5.4-mini", max_tokens=1024, stream=True, messages=[{"role": "user", "content": "Summarise this contract in three points."}], ) for chunk in stream: if chunk.choices: print(chunk.choices[0].delta.content or "", end="")const stream = await client.chat.completions.create({ model: "openai/gpt-5.4-mini", max_tokens: 1024, stream: true, messages: [{ role: "user", content: "Summarise this contract in three points." }], }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); }await foreach (StreamingChatCompletionUpdate update in client.CompleteChatStreamingAsync( [new UserChatMessage("Summarise this contract in three points.")], new ChatCompletionOptions { MaxOutputTokenCount = 1024 })) { foreach (ChatMessageContentPart part in update.ContentUpdate) { Console.Write(part.Text); } }Let Gateway choose
Instead of one model, add more in
models. Gateway tries every modelmodelnames, then each entry ofmodelsin 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 astier/high; see choosing a model.{ "model": "anthropic/claude-sonnet-5", "models": ["openai/gpt-5.6-terra", "tier/high"], "max_tokens": 1024, "messages": [{ "role": "user", "content": "…" }] }
Get started / Quickstart
Get started
Quickstart
Get an API key, send a request, and stream the answer. You need a Gateway organization: API keys belong to one.
Was this page helpful?
Updated Oct 22, 2026