Every request to the Muapi.ai API — whether it is submitting a generation job, polling for results, uploading a file, or checking your account balance — must include a valid API key. Muapi.ai uses a customDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/anil-matcha/open-generative-ai/llms.txt
Use this file to discover all available pages before exploring further.
x-api-key header for authentication rather than the conventional Authorization: Bearer scheme. Open Generative AI stores this key in browser localStorage and attaches it to every outbound request made by muapi.js, so you only need to enter it once in the app UI. When integrating muapi.js directly in your own code, you pass the key as the first argument to every exported function.
Getting an API Key
Create a Muapi.ai account
Sign up for a free account at https://muapi.ai. New accounts start with a free credit allocation so you can begin generating immediately.
Open the Access Keys page
Navigate to https://muapi.ai/access-keys. This page lists all your API keys and lets you create new ones.
Passing the Key in Requests
All requests tohttps://api.muapi.ai must include the key in the x-api-key HTTP header.
Use
x-api-key, not Authorization: Bearer YOUR_API_KEY. Requests that use the Authorization header instead of x-api-key will be rejected.In the Open Generative AI App
When you enter your API key in the app’s key-entry modal, it is saved to browserlocalStorage under the key muapi_key. The key is read from storage on every generation request and passed to muapi.js as the first argument. It is never sent to any server other than api.muapi.ai.
You can inspect or clear the stored key at any time in your browser’s developer tools:
In the JavaScript Client
When importingmuapi.js functions directly, pass your API key as the first argument:
x-api-key header of every HTTP request made by the function, including the initial POST to submit the job and each subsequent GET to poll for the result.
Checking Your Balance
UsegetUserBalance to confirm your key is valid and to see your remaining credit balance before running expensive generation jobs:
GET /api/v1/account/balance with the x-api-key header. A successful response confirms the key is active and returns your current credit information.
Authentication Errors
If the API returns an HTTP 401 (Unauthorized) or HTTP 403 (Forbidden) response,muapi.js does two things:
- Throws an error with the HTTP status and response body, halting the generation.
- Dispatches a
muapi:auth-requiredcustom event on thewindowobject (when running in a browser), carrying the status code and error message asevent.detail.
- The key value was copied incorrectly (e.g. whitespace included, or the label was entered instead of the value)
- The key has been deleted or rotated in the Muapi.ai dashboard
- The account has exhausted its credit balance
