POST /api/generate

Generate Text

Generate text based on a prompt with fine-grained control. Adjust temperature for creativity, set output format, provide custom system prompts, and control generation length.

$0.05 per request

> REQUEST

POST /api/generate

{
  "text": "Write a brief introduction for a blog post about sustainable gardening.",
  "options": {
    "maxTokens": 150,
    "temperature": 0.8,
    "format": "markdown"
  }
}

> RESPONSE

{
  "result": {
    "text": "# Embracing Sustainable Gardening\n\nIn an era of environmental awareness...",
    "prompt_length": 98,
    "output_length": 287,
    "format": "markdown"
  },
  "tokens_used": { "prompt_tokens": 67, "completion_tokens": 89, "total_tokens": 156 }
}

> OPTIONS