Limits, credits and capacity
The three limits every conversation runs under (credits, concurrent conversations and a time limit) and the other limits you may run into.
Three limits shape every conversation:
- Credits. A conversation spends credits for as long as it runs. You can buy credits, and some plans include an allotment that refreshes.
- Concurrent conversations. Your plan caps how many conversations can run at the same time, and how many can start in an hour.
- Time limit. Each conversation runs for at most a set length of time.
Your plan sets the numbers, and they can change, so read them from the API rather than writing them into your code.
Check your limits
Your server can read your current limits and what you've used with get your usage:
curl https://api.nuancelabs.ai/usage -H "Authorization: Bearer $NUANCE_API_KEY"Its limits object holds how many conversations you can run at once, how many you can start in an hour, your daily credits, and how many API keys you can have (limits.api_keys).
Credits
A conversation spends credits from the moment the persona starts it until it ends, rounded up to a whole credit per conversation. Getting ready spends nothing, and a conversation that never starts spends nothing. Your plan sets how much time a credit covers.
Credits you buy last until they're spent. Some plans also include an allotment that refreshes on a schedule; it's used first and doesn't carry over.
Once you're out of credits, a new token or conversation is refused with 429 credits_spent, and renews_at says when your allotment refreshes.
On the beta plan
The beta plan, which every organization starts on, gives you a set number of credits each UTC day. A conversation's credits come from the day it started, and a running conversation's credits so far already count. The day's credits renew at 00:00 UTC and don't carry over. Credits added to your account last until they're spent, and are used once the day's are gone.
Concurrent conversations
Your plan sets how many conversations your API keys may have active at once, ones still starting included. A new one past the limit is refused with 409 concurrency_limit.
Your server can list your active conversations, oldest first, and end one by its id to free a place, such as one whose page closed without ending it. Both take your API key and work only on your organization's conversations.
- A conversation that hasn't started ends at once and spends nothing.
- A running one ends within a few seconds, once the persona leaves, and spends credits until then. It ends as if the user hung up (its
session.closedmay give the reasonerrorrather thanclose_requested). - One that already ended is left as it is.
Conversations started per hour
Your plan also sets how many conversations your API keys may start in any hour (limits.hourly_conversations). Every conversation created in the last hour counts, whether it ran, ended or never started, except one turned away with capacity_unavailable. Past the limit, a start is refused with 429 start_limit, and retry_after_seconds says when the oldest of the hour's conversations will be an hour old.
Your server can also create only that many session tokens in any hour, counted separately: past it, POST /session-tokens answers 429 start_limit and creates none. So create a token when the user is about to start, not when the page loads.
Time limit
A conversation can run for up to 60 minutes. You can set a shorter limit with max_session_seconds in POST /conversation; asking for more is refused with 400 session_too_long.
On a plan where you buy credits, Nuance sets aside credits for a conversation's whole time limit when it starts, and gives back what it didn't use when it ends. So a conversation starts only if your balance, minus what your running conversations have set aside, covers its time limit. If you leave out max_session_seconds, the conversation gets as long as your balance covers, up to the maximum. If your balance can't cover what you asked for, or even a minute, POST /conversation returns 429 credits_spent.
When the limit is longer than 30 seconds, the persona is told to wrap up about 30 seconds before the end. The started event on the events request and session.expires_at in session.started both say when it ends.
Other limits
These matter less often, but you may run into them.
Session tokens
A session token has to start its conversation within 60 seconds of being created. It starts one conversation, then works only for that conversation, until 300 seconds after it ends.
When Nuance is short of capacity
Conversations run on shared capacity, and some of it can be taken back while a conversation runs. Nuance never puts a conversation in a waiting line: it starts within a few seconds, or it is turned away.
- No capacity now:
POST /conversationanswers429capacity_unavailablewithretry_after_seconds. Nothing was spent, and the same token can retry while it is under 60 seconds old. The refused start doesn't count toward conversations started per hour. - Too many starts at once:
POST /conversationanswers503busy. Retry afterretry_after_seconds. - The persona getting ready: once Nuance has reserved capacity, it can take up to about half a minute, and the events request reports
preparing. - Capacity taken back: the conversation ends early with
session.closedreasonerror, or the call drops first. Either way,endedfollows on the events request.
When a start is turned away or a conversation ends early, let the user start again; a new conversation usually lands on other capacity. Errors explains each code.
Keeping a conversation alive
This matters only in a native app; the SDK handles it for you. Keep polling for events for the whole conversation. If Nuance gets no events request for 90 seconds, it ends the conversation. A conversation your app never polls at all ends 60 seconds after it was created.
Prompt reviews
Nuance reviews each new combination of prompt and tools the first time you create a token with it (Safety), so that first token takes a few seconds longer. The persona's instructions for using your tools count as part of the tools, and the same prompt with different tools counts as new. A combination Nuance has already reviewed isn't reviewed or counted again.
Your organization has a daily limit on reviews, counted across its API keys over any 24 hours. Past it, a token for a new prompt and tools is refused with 400 app_review_held (Safety refusals), and Nuance reviews it within a day.
When a review can't finish in time, the prompt works until it does, usually within 10 minutes. If the review then refuses it, Nuance emails the person who made your organization (at most once a day), and your organization's overview on the platform lists each refused prompt with the reason.
Size limits
| What | Limit |
|---|---|
| A conversation | 60 minutes (Time limit). |
An event_ | 512 characters. |
| An event you send | 64,000 bytes as one packet; a larger one goes as a text stream. A session. and the resulting settings must each fit in one packet. |
| An event you get | 15 KiB as one packet; larger ones come as message. packets. |
An append's content, or a response.'s instructions | 2,000 characters. |
Typed words, or one tool result's output | 24,000 characters; an object counts as its compact JSON. Both need tools on (responses). |
| Images in one tool result | 4, each a base64 data: URL of a JPEG or PNG, scaled to fit 1,920 px. Remote URLs and file ids are not supported. |
| A floor hold | 1 to 3,600 seconds in seconds, and a reason of up to 200 characters. |
| Tools | 16 run, of up to 128 listed. A name is letters, digits, _ and -, up to 64 characters; a description up to 2,000; parameters up to 16,000 as compact JSON. A tool past these is dropped, and the token's warnings name it. A tool's annotations over 2,000 characters of compact JSON is refused with 422 interface_. |
| The persona's instructions for using your tools | 65,536 characters, in delegation.. |
| Tool calls for one request from the user | 8 rounds of calls, then one more turn to answer. The persona also gets 60 seconds of its own working time; the time your tools take doesn't count. |