Why use one key instead of four accounts?
If you want to use more than one model family, the usual path is four sign-ups, four billing setups, four dashboards and four different SDKs. Each provider has its own key format, its own spending limits and its own invoice. For a side project or a small team that is a lot of overhead just to compare two models.
A gateway puts one account in front of all of them. You keep one balance, one set of keys and one usage log, and your code talks to a single endpoint. When a new model is listed, you can try it by changing a string instead of signing up somewhere else.
- One balance: top up once, spend on any listed model.
- One code path: the OpenAI chat completions format works for every model family, including Claude and Gemini.
- One usage log: every call shows the model, input and output tokens, and the cost.
- No subscription: you pay only for the tokens you use. If you do not use it for a month, you pay nothing that month.
How do I get started?
- Sign up with your email or Google account. Verified new accounts get a small trial credit the first time they open the console.
- Top up your balance in the console at Top up. The top-up page shows the payment methods currently available.
- Open API Keys, click Create key, give it a name (for example the project name) and copy it. It starts with
sk-. - Set the base URL in your client to
https://api.macloudai.com/v1and use the key as your API key. - Pick a model from the models page and put its exact name in the
modelparameter. - Send a test request, then check Usage to see the tokens and the cost of that call.
In the console, the left menu has API Keys. The Create key button is at the top right of that page. Copy the key right away and store it in an environment variable or secret manager, not in your source code.
Python example (OpenAI SDK)
Install the official OpenAI package with pip install openai. The only changes from a normal OpenAI setup are base_url and the key.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.macloudai.com/v1",
api_key=os.environ["MACLOUD_API_KEY"], # sk-...
)
r = client.chat.completions.create(
model="hk-5-5",
messages=[{"role": "user", "content": "Explain HTTP caching in three sentences."}],
)
print(r.choices[0].message.content)
print(r.usage) # prompt_tokens, completion_tokens
Node.js example (OpenAI SDK)
Install with npm install openai. This works in Node 18 or newer.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.macloudai.com/v1",
apiKey: process.env.MACLOUD_API_KEY, // sk-...
});
const r = await client.chat.completions.create({
model: "tt-6-luna",
messages: [{ role: "user", content: "Write a regex that matches an ISO date." }],
});
console.log(r.choices[0].message.content);
curl example
Useful for checking that a key works before you touch any code:
curl https://api.macloudai.com/v1/chat/completions \
-H "Authorization: Bearer sk-..." \
-H "Content-Type: application/json" \
-d '{
"model": "gem-3.8-flash",
"messages": [{"role": "user", "content": "Say hello in five languages."}]
}'
How do I switch models?
Change the model string. Nothing else in the request changes: same endpoint, same key, same message format. This makes it easy to send the same prompt to several models and compare the answers and the cost:
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.macloudai.com/v1", api_key=os.environ["MACLOUD_API_KEY"])
prompt = "Summarize the pros and cons of SQLite for a mobile app."
for model in ["hk-5-5", "tt-6-luna", "gem-3.8-flash", "deepseek-v4.1-flash"]:
r = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": prompt}],
)
print("==", model, r.usage.prompt_tokens, "in /", r.usage.completion_tokens, "out")
print(r.choices[0].message.content, "\n")
Streaming works the same way: pass stream=True (Python) or stream: true (Node) and read the chunks as you would with OpenAI.
Copy model names exactly as they appear on the models page. A name that is misspelled or not listed returns a 404 error. Names can differ from what a provider uses in its own console, so do not guess.
Can I still use the Anthropic SDK for Claude?
Yes. The gateway also speaks the Anthropic Messages format at https://api.macloudai.com (without /v1). This is what Claude Code uses, and it is handy if your code already uses the Anthropic SDK:
import os
import anthropic
client = anthropic.Anthropic(base_url="https://api.macloudai.com", api_key=os.environ["MACLOUD_API_KEY"])
r = client.messages.create(
model="hk-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(r.content[0].text)
| Format | Base URL | Auth header | Models |
|---|---|---|---|
| OpenAI chat completions | https://api.macloudai.com/v1 | Authorization: Bearer sk-... | All listed models |
| Anthropic Messages | https://api.macloudai.com | x-api-key or Authorization: Bearer | Claude models |
How is it billed?
Each model has an input price and an output price per 1 million tokens. After every call, the cost is deducted from your prepaid balance. There is no monthly fee and no minimum monthly spend. If the balance runs out, requests are rejected until you top up again; your balance does not expire while the account is active. Current prices:
Real prices now
Estimated from the prices on the models page: 2,000 input tokens and 500 output tokens per chat. The console shows the actual charge.
| Models | Per chat | 1,000 chats |
|---|---|---|
| GEM 3.8 Flash | Rp 4 | Rp 4.434 |
| TT-6 Luna | Rp 11 | Rp 10.642 |
| TT-6.1 Terra | Rp 7 | Rp 7.263 |
| HK-5.5 | Rp 3 | Rp 3.487 |
| GEM 4 Argon | Rp 85 | Rp 84.649 |
| TT-6.1 Sol | Rp 15 | Rp 14.526 |
For a deeper look at how to estimate a bill, see how token pricing works. Conversation content is not stored; only token counts, the model name and the time are recorded for billing.
FAQ
Q1Is this the same as the official OpenAI or Anthropic API?
Q2Do I need a separate key for each model?
Q3Can I call Gemini and DeepSeek with the OpenAI SDK?
Q4Is there a monthly fee?
Q5What happens when my balance runs out?
More guides
- How to use Claude Code with a custom API endpoint
- Claude Code API errors and fixes: 401, 403, 404, 429, 5xx
- How to use Cursor with your own API key and base URL
- Claude vs GPT vs Gemini vs DeepSeek: which model for which job
How AI API token pricing works and how to estimate your bill
- Add AI to n8n workflows with an OpenAI-compatible API