Skip to content

API

One API for models and agents

Send a request with your key and pay in the same credits as the app. Each reply says which model answered and what it cost.

A first request

Make a key in the app’s Settings after you sign in and verify your email. A key looks like KEY_ID.SECRET; the whole key is shown once, so keep it. Send it in the x-api-key header.

cURL
curl https://api.mayuai.com/v1/ai/chat \
  -H "x-api-key: KEY_ID.SECRET" \
  -H "content-type: application/json" \
  -d '{"model":"auto","messages":[{"role":"user","content":"Hello"}]}'

The model auto lets MayuAI choose (how); or name a model from the Model Hub. The reply carries model, provider, fallback and usage with the credits the request cost and the credits you have left. The address is https://api.mayuai.com; the call is POST /v1/ai/chat.

What is in the API

  • Models API

    Chat and tool calls on the models in the catalog.

    Open
  • Agents API

    Create, run and read agents and their runs.

    Open
  • Usage

    What each request cost, and your balance.

    Open
  • SDKs

    Not available yet

    Client libraries.

  • CLI

    Not available yet

    MayuAI from a terminal.

  • Plugins

    Not available yet

    Editor and tool plugins.

  • Webhooks

    Not available yet

    Events sent to your server.

Rate limits

Per account, by plan: the limits the service enforces.
PlanAI requests a minuteRequests an hour
Free5200
Starter15800
Pro302,000
Developer15015,000
Agency17517,500
EnterpriseAgreed with youAgreed with you

When a request fails

A failed request returns an HTTP status and a JSON body with an error. The agent and routing endpoints give a code, a plain message and a requestId to quote to us. A request that fails is not charged: the credits set aside for it go back.

What you can build on it

  • Chat in your own product

    Send messages to a model or to auto, and show the answer, streamed if you like.

  • Spend you can see

    Each reply carries its credits, so your program can track what each request cost.

  • Agents run from code

    Create, run and read agents with a signed-in account's token.

Common questions

How do I get an API key?

Sign in, verify your email, and make a key in the app's Settings. The whole key is shown once, so keep it.

How do I send a first request?

POST to /v1/ai/chat at https://api.mayuai.com with the key in the x-api-key header and a model and messages in the body.

Does the API tell me what a request cost?

Yes. A chat reply carries its usage: the tokens used, the credits charged and the credits you have left.

Are there rate limits?

Yes. Limits apply per account and by plan, and the table on this page shows what the service enforces.

Where to go next

  • Models API

    The chat endpoint, field by field.

    Open
  • Agents API

    Create, run and read agents.

    Open
  • Find a model

    Model ids and what each costs per 1,000 tokens.

    Open
  • Credits and plans

    Plans

    A key spends the credits of the account that made it.

    Open

Not open to the public yet

Send one request to a model, and read what it cost in the reply.

Existing accounts can sign in. To ask about access, contact us.