34.5 Prices, answers kept, and errors
This applies to every hosted Relatude service. Each call is charged to the license's credit account
for the service, and every answer carries Credits (what the call cost) and CreditsLeft (what is
left). GetOperationsAsync, GetFormatsAsync and GetLanguagesAsync give the prices for free.
| Service | Charged | Kept on your server |
|---|---|---|
| Embeddings | By the characters sent | Every embedding, by text and model |
| Completions | By the characters sent and received | Nothing |
| Images | The same price for every operation | Descriptions, answers to questions and "already upright". Not the images the service makes |
| Files to text | Per file; a long recording per part | The text, by file content and languages |
| Translation | By the characters sent | Each translation and each detected language, text by text |
| IP lookup | Free | Nothing |
| Text messages | Per message part | Nothing |
Repeated calls. Your server keeps the answers in the last column, so the same call is not sent
again. Only what is missing goes to the service: translate a hundred texts with one new, and only
that one is sent. An answer from your server says Cached and costs nothing. The hosted services keep
answers too, and answer a repeated call at the price they set for that. Pass fresh: true for a new
answer, such as another take on a description; it is charged in full.
CacheTypein the image, file and translation settings chooses where your server keeps their answers:Native(the default, a file beside the AI embedding cache),MemoryorNone. Answers are kept for 90 days.db.MaintenanceAsync(MaintenanceAction.ClearAiCache)empties these caches and the embedding cache.- A store built from code wraps its provider itself:
new CachingTranslationProvider(provider, new NativeKvServiceAnswerCache(path)), and likewiseCachingImagingProviderandCachingFileToTextProvider.
Errors. A refused call throws a RelatudeServiceException. Its message is the service's own
reason, written for whoever configured the installation, and StatusCode says what went wrong:
| Status | Meaning |
|---|---|
| 400 | The call is wrong, such as a language the service does not translate |
| 402 | Out of credits, or the license has no credit account for the service |
| 403 | The key or the license may not be used |
| 415 | A file type nothing can read |
| 422 | The image or the text was turned down |
| 424 | The license server did not confirm the charge. The call may have been charged all the same |
| 501 | The operation is not offered |
| 502 | It could not be done right now |
MayHaveBeenCharged is false for refusals made before anything is charged, and true otherwise.
Credits are never given back. The providers retry by themselves only when nothing can have been
charged, so no call is paid for twice. Retry a call that may have been charged only if paying twice
is acceptable.