demand.ai API
    demand.ai API
    • Generate a completion
      POST
    • Generate a chat completion
      POST
    • Generate Embeddings
      POST
    • Schemas
      • Schemas
        • postGenerate
        • postChat
        • generateResponse
        • chatResponse
        • chatResponseFinal
        • Success
        • postEmbed
        • Error
        • embedResponse
      • Response
        • Unauthorized
        • BadRequest

      Generate a completion

      POST
      /generate
      Generate a response for a given prompt with a provided model. This is a streaming endpoint, so there will be a series of responses. The final response object will include statistics and additional data from the request.

      Request

      Body Params application/json

      Examples

      Responses

      🟢200OK
      application/json
      Body

      🟠400Bad Request
      🟠401Unauthorized
      Request Request Example
      Shell
      JavaScript
      Java
      Swift
      curl --location --request POST 'https://api.demandai.de/v1/generate' \
      --header 'Content-Type: application/json' \
      --data-raw '{
          "model": "gemma3:12b",
          "prompt": "Why is the sky blue?",
          "stream": false
      }'
      Response Response Example
      200 - Example 1
      {
          "model": "gemma3:12b",
          "created_at": "2025-08-03T13:55:26.107Z",
          "response": "The sky is blue because it is the color of the sky.",
          "done": true,
          "done_reason": "stop",
          "context": [
              1,
              2,
              3
          ],
          "total_duration": 5043500667,
          "load_duration": 5025959,
          "prompt_eval_count": 26,
          "prompt_eval_duration": 325953000,
          "eval_count": 290,
          "eval_duration": 4709213000
      }
      Modified at 2025-11-04 14:45:50
      Next
      Generate a chat completion
      Built with