Skip to main content

POST /api/ai/generate

This public API endpoint allows you to generate text completions using supported AI models (e.g., Gemini). You must provide a valid access key for authentication.

Endpoint

Request Body

Send a JSON object with the following fields:

accessKey object

configs object

Supported Models

  • gemini-2.0-flash
  • gemini-2.0-flash-lite
  • gemini-2.5-flash
  • gemini-2.5-flash-lite
  • gemini-2.5-pro

Example Request

Example Response

Errors

  • 400 Missing accessKey — You must provide both id and value in the accessKey object.
  • 400 Invalid model — The model is not allowed for your key.
  • 400 Invalid accessKey — The credentials are invalid.
  • 400 Missing prompt — The prompt field is required.
  • 400 Missing API key — Internal error, contact support.

Notes

  • You must have a valid access key with the required model scope.
  • The response includes the original input, the model output, token usage, cost breakdown, and the finish reason.