The same API key for your clients: AI and the rest of our API with one key

API & DocumentationWhat You Can Automate·· 112 views· 4 min read

In short: AI uses the same key and the same address as the rest of our API. If you already have a key for domains, DNS or SMS, you only need to add the AI permissions to a key. Your clients and your team do not open an account anywhere else. That is what makes AI reselling simple to set up.

One address, one key

Every AI operation lives at https://api.mozout.com/v1, and the key goes in the Authorization: Bearer header, as in every other operation. The same key works with the OpenAI SDK, with the coding tools, with the MCP server at https://api.mozout.com/mcp, and with the aio command in the terminal.

Permission What for
ai:read Seeing the models, the generations and the AI credit balance.
ai:write Chatting with the models, using agents and creating images, video and voice.
billing:purchase Buying AI credits from your account credit through the API. It is a sensitive permission and comes switched off: turn it on only for the key that buys.

One key per program

The same key does not mean a single key. Create one key for each program, tool or client you serve, with only ai:read and ai:write. If one leaks or is no longer needed, you revoke that one and the others keep working.

1 Open the API page in My MozOut and create the key. A key never creates another key: they are all made there.
2 Choose the mode: sandbox_ to test without spending, prod_ to work.
3 Tick only ai:read and ai:write.
4 Keep the key in an environment variable, for example MOZOUT_API_KEY, never in the code.

Each field is explained in creating an API key, and how to keep them in order in looking after your API keys.

What the key spends

With a prod_ key, requests are paid with Coding Plan points, on the plan's models, or with AI credits, which have their own balance, separate from your account credit. GET /v1/ai/balance shows the credits and, with a plan, the points left for the week and the month. A sandbox_ key spends nothing.

The key stays on the server. Never put it in code that runs in the browser or in a mobile app: anyone who sees it can spend your credits. If you think it has leaked, follow what to do when a key leaks.

Answers that point to a key problem

Answer When What to do
401 unauthorized The key is missing or wrong, or the tool did not read the environment variable. Check the key and open a new terminal after setting the variable.
403 insufficient_scope The key does not have ai:read or ai:write. Create a key with the right permission.
402 insufficient_credits There are not enough AI credits for the request. Nothing was charged. Buy credits in All in One AI or lower max_tokens.
To find out what a key can do, call GET /v1/token: it returns the key's mode, permissions, validity and limits, and never the key itself.

Want to give your clients AI with the key you already use? See the AI reselling page.

See AI reselling

SEE ALSO

Creating an API key: name, mode, permissions, validity, IP list and spending limit

Looking after your API keys: one per program, expiry, revoking and replacing a key

An API key or token has leaked: what to do, in the right order

Using the OpenAI SDK with All in One AI: only the address and the key change

AI reselling in the Reseller Program

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from R118.80/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.