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 | array of strings | No | 250 | Optional. Up to 10 context strings (max 250 chars each) to provide additional information for the prompt. |
prompt | string | Yes | 1000 | 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. Defaults to AUTO. |
Response
Name | Type | Description |
---|---|---|
description | string | The description of the prompt. |
response | string | The generated or completed text based on the prompt and context. |
Errors
{
"error": "string",
"code": "string"
}
HTTP Status | Error Code | Message |
---|---|---|
400 | INVALID_PAYLOAD | Occurs when the payload is invalid. E.g., missing required fields, context too long, or too many context items. |
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. |