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

NameTypeRequiredMaxDescription
contextstringNo50000Optional. Additional context to provide information for the prompt.
searchOnWebbooleanNo-Optional. If true, the service will search the web for additional context to improve the prompt generation. Default is false.
promptstringYes2000The main user input or prompt to generate a completion for.
languagestringNo-Optional. The language code for the output. Supported: auto, en, es, fr, de, zh, ja, ko, pt, it, ru, ar, hi.

Response

NameTypeDescription
data.responsestringThe generated or completed text based on the prompt and context.
data.languagestringThe language code of the generated response.
metadata.costnumberThe cost of generating this response.

Errors

{
  "error": "string",
  "code": "string"
}
HTTP StatusError CodeMessage
400INVALID_PAYLOADOccurs when the payload is invalid. E.g., missing required fields or context too long.
400INVALID_REQUESTEx.: The request is invalid.
400TEXT_PROMPT_GENERATION_ERROREx: could not generate prompt or completion | parsing error
400HARM_CONTENTEx.: The content is harmful and cannot be processed.
400INSUFFICIENT_BALANCEThe user has insufficient balance
401UNAUTHORIZEDEx.: The token is invalid.
429TOO_MANY_REQUESTSEx.: The request limit has been reached.