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 chat completion

      POST
      /chat
      Generate the next message in a chat with a provided model. This is a streaming endpoint, so there will be a series of responses. Streaming can be disabled using 'stream': false. The final response object will include statistics and additional data from the request.

      Request

      Body Params application/json

      Examples

      Responses

      🟢200OK
      application/json
      A stream of JSON objects is returned
      Body

      🟠400Bad Request
      🟠401Unauthorized
      Request Request Example
      Shell
      JavaScript
      Java
      Swift
      curl --location --request POST 'https://api.demandai.de/v1/chat' \
      --header 'Content-Type: application/json' \
      --data-raw '{
          "model": "gemma3:12b",
          "messages": [
              {
                  "role": "user",
                  "content": "why is the sky blue?"
              }
          ],
          "stream": true
      }'
      Response Response Example
      200 - Example 1
      {
          "model": "gemma3:12b",
          "created_at": "2025-08-03T13:55:26.107Z",
          "message": [
              {
                  "role": "assistant",
                  "content": "The"
              }
          ],
          "done": false
      }
      Modified at 2025-11-04 14:45:50
      Previous
      Generate a completion
      Next
      Generate Embeddings
      Built with