MorphogenDocs

Limits and balance

Request speed, sizes, spending limits and how the balance is reserved.

There are three kinds of limits: request speed, request size and money. The platform sets speed and sizes, and you set the spending limits.

Speed

WhatValue
Requests per minute120 per key by default
Tokens per minute200,000 per key by default

Exceeding them gives 429 rate_limit_exceeded and a Retry-After header in seconds. Repeat the request after that pause. These are the defaults for a new key; they may differ for your organization.

Sizes

WhatValue
Request body32 MiB
Speech recognition request26 MiB
Images in one request1 to 10 (n)
Video generation timeat most one hour, then the job gets failed with the code timeout

Balance and reserve

Before each model request, the maximum possible amount is reserved on the balance. After the response, the actual amount is charged and the remainder is returned. For text, the reserve is counted from the input size and max_tokens. If max_tokens is not passed, the model's response ceiling is used: for flagship models it is 128,000 tokens, and the reserve per request ends up well above the actual cost. With a small balance this gives 402 insufficient_funds, although the response itself would cost pennies. Pass max_tokens (in /v1/responses it is max_output_tokens).

For images, the reserve equals the number of images multiplied by the price of one. For video, it is the seconds multiplied by the price per second at the chosen resolution. A video reserve lives for up to two hours.

  • Errors 400, 401, 403 and 404 do not reserve money.
  • A request interrupted by the client is charged by what was actually received.
  • A video with the failed status costs nothing.

Spending limits

Limits are set in rubles and counted in Moscow time.

LimitWhere to setError
Day and month per keywhen creating and editing a key402 key_limit_exceeded
Day and month per employee, team, organizationin the organization settings402 spend_limit_exceeded

A request is rejected if, together with it, the spending for the period would exceed the limit. Keys and their limits: Keys and access. List of codes: Errors.

Space

The X-Morphogen-Space: spc_… header assigns the request's spending to a space. Format: spc_ and 8 to 64 characters of 0-9a-z. A header with any other value is ignored without an error. The platform checks the right to use the space.

On this page