Serverless AI Text Generation
AI powered text generation service that creates engaging, relevant content based on the provided context in multiple languages.
Endpoint
Text generation based on context
POSThttps://api.xtartapp.com/text/generation
*Authentication
You must use a Bearer token provided by the dashboard to use for authentication. Add the token to the Authorization header.
Request body
Name | Type | Required | Max | Description |
---|---|---|---|---|
context | string | Yes | 250 | Short description of the content to generate. |
language | string | Yes | - | The language to generate the text in. Supported languages: en, es, fr, de, zh, ja, ko, pt, it, ru, ar, hi |
Response
Name | Type | Description |
---|---|---|
data | object | The data of the text generation |
data.generatedText | string | The generated text based on the context |
data.language | string | The language used for text generation |
metadata | object | Metadata about the text generation process |
metadata.cost | number | The cost of the text generation request |
Errors
{
"error": "string",
"code": "string"
}
HTTP Status | Error Code | Message |
---|---|---|
400 | INVALID_PAYLOAD | Occurs when the payload is invalid. |
400 | INVALID_REQUEST | Ex.: The request is invalid. |
400 | TEXT_GENERATION_ERROR | Ex: could not generate text | parsing error |
400 | HARM_CONTENT | Ex.: The content is harmful and cannot be processed. |
400 | INSUFFICIENT_BALANCE | The user has insufficient balance |
401 | UNAUTHORIZED | Ex.: The token is invalid. |
429 | TOO_MANY_REQUESTS | Ex.: The request limit has been reached. |