Serverless AI Text Prompt Generation
AI powered text prompt generation service that generates prompts or completions based on user input, context and language. You can generate code, text, or any other content based on the user input and context.
Endpoint
Generate a prompt or completion based on user input, context, and language
POSThttps://api.xtartapp.com/text/prompt
*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 | No | 50000 | Optional. Additional context to provide information for the prompt. |
searchOnWeb | boolean | No | - | Optional. If true, the service will search the web for additional context to improve the prompt generation. Default is false. |
prompt | string | Yes | 2000 | The main user input or prompt to generate a completion for. |
language | string | No | - | Optional. The language code for the output. Supported: auto, en, es, fr, de, zh, ja, ko, pt, it, ru, ar, hi. |
Response
Name | Type | Description |
---|---|---|
data.response | string | The generated or completed text based on the prompt and context. |
data.language | string | The language code of the generated response. |
metadata.cost | number | The cost of generating this response. |
Errors
{
"error": "string",
"code": "string"
}
HTTP Status | Error Code | Message |
---|---|---|
400 | INVALID_PAYLOAD | Occurs when the payload is invalid. E.g., missing required fields or context too long. |
400 | INVALID_REQUEST | Ex.: The request is invalid. |
400 | TEXT_PROMPT_GENERATION_ERROR | Ex: could not generate prompt or completion | 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. |