Skip to main content
POST
/
v2
/
rewriter
/
ask-ai
Ask AI
curl --request POST \
  --url https://api.velt.dev/v2/rewriter/ask-ai \
  --header 'Content-Type: application/json' \
  --header 'x-velt-api-key: <x-velt-api-key>' \
  --header 'x-velt-auth-token: <x-velt-auth-token>' \
  --data '
{
  "data": {
    "model": "<string>",
    "prompt": "<string>",
    "text": "<string>"
  }
}
'
{
  "result": {
    "success": true,
    "text": "The rewritten or processed text returned by the model."
  }
}
Use this API to send a text rewriting or processing request to an AI model. The model provider is resolved automatically from the model name prefix.
Customer API keys are stored encrypted in the workspace aiModelsConfig and decrypted server-side. Configure your provider API keys in the Velt Console before using this endpoint.

Endpoint

POST https://api.velt.dev/v2/rewriter/ask-ai

Headers

x-velt-api-key
string
required
Your API key.
x-velt-auth-token
string
required

Body

Params

data
object
required
OpenAI reasoning models (o1-*, o3-*, o4-*) use a user-only message format. The prompt is prepended to the text in a single user message rather than sent as a separate system prompt.

Supported models (non-exhaustive)

ProviderExample models
OpenAIgpt-4o, gpt-4o-mini, gpt-4.1, o3, o3-mini, o4-mini
Anthropicclaude-sonnet-4-0, claude-opus-4-0, claude-haiku-4-5
Geminigemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite

Example Requests

Rewrite text using Claude

{
  "data": {
    "model": "claude-3-5-sonnet-20241022",
    "prompt": "Rewrite the following text to be more concise and professional.",
    "text": "Hey so I was just thinking that maybe we could potentially look into making some changes to the way we do things around here."
  }
}

Rewrite text using GPT-4o

{
  "data": {
    "model": "gpt-4o",
    "prompt": "Fix the grammar and spelling in the following text.",
    "text": "Their going to the store to by some apples."
  }
}

Process text using a reasoning model

{
  "data": {
    "model": "o3-mini",
    "prompt": "Summarize the key points from the following text.",
    "text": "Long document text content goes here..."
  }
}

Response

Success Response

{
  "result": {
    "success": true,
    "text": "The rewritten or processed text returned by the model."
  }
}

Error Response

{
  "result": {
    "success": false,
    "error": "No API key configured for provider: OpenAI"
  }
}

Failure Response

{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
{
  "result": {
    "success": true,
    "text": "The rewritten or processed text returned by the model."
  }
}