Skip to main content
POST
/
api
/
generate
Generate
curl --request POST \
  --url https://api.ajstudioz.co.in/api/generate \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "stream": true,
  "system": "<string>",
  "options": {},
  "context": [
    {}
  ],
  "raw": true
}
'
{
  "model": "gemma3:27b",
  "created_at": "2026-03-07T12:00:00Z",
  "response": "The sky appears blue because of a phenomenon called Rayleigh scattering. When sunlight enters Earth's atmosphere, it collides with gas molecules. Sunlight consists of all colors of the visible spectrum, but blue light has a shorter wavelength and is scattered more readily than other colors. This scattered blue light reaches our eyes from all directions across the sky, making it appear blue.",
  "done": true,
  "done_reason": "stop",
  "context": [1, 2, 3, 4, 5],
  "total_duration": 4523456789,
  "load_duration": 456789,
  "prompt_eval_count": 9,
  "prompt_eval_duration": 234567890,
  "eval_count": 82,
  "eval_duration": 4288888899
}

Documentation Index

Fetch the complete documentation index at: https://student-213fb9fc.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Generate a response for a given prompt with a provided model. This is the basic text completion endpoint, compatible with the Ollama /api/generate format.

Request

Headers

Authorization
string
required
Bearer token: Bearer YOUR_API_KEY
Content-Type
string
required
application/json

Body

model
string
required
The model name to use. See available models.Example: "gemma3:27b", "deepseek-v3.2", "kimi-k2:1t"
prompt
string
required
The prompt to generate a response for.
stream
boolean
default:"true"
If true, responses are streamed as they are generated. If false, the full response is returned in one request.
system
string
System message to set the behavior of the assistant.
options
object
Model parameter overrides. Supports the following fields:
  • temperature (float) — sampling temperature (0–2)
  • top_p (float) — nucleus sampling
  • top_k (integer) — top-k sampling
  • num_predict (integer) — max tokens to generate
  • stop (array of strings) — stop sequences
context
array
The context returned from a previous request, used to keep a short conversational memory.
raw
boolean
default:"false"
If true, no formatting is applied to the prompt. Use only when applying your own custom prompt template.

Response

model
string
The model used for generation.
created_at
string
ISO 8601 timestamp of when the response was generated.
response
string
The generated text. Empty if streaming is in progress.
done
boolean
true when generation is complete.
done_reason
string
Reason generation stopped. One of: stop, length, error.
context
array
An encoding of the conversation for use in the next request (to keep memory).
total_duration
integer
Total time in nanoseconds.
eval_count
integer
Number of tokens generated.

Examples

curl https://api.ajstudioz.co.in/api/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemma3:27b",
    "prompt": "Why is the sky blue?",
    "stream": false
  }'
{
  "model": "gemma3:27b",
  "created_at": "2026-03-07T12:00:00Z",
  "response": "The sky appears blue because of a phenomenon called Rayleigh scattering. When sunlight enters Earth's atmosphere, it collides with gas molecules. Sunlight consists of all colors of the visible spectrum, but blue light has a shorter wavelength and is scattered more readily than other colors. This scattered blue light reaches our eyes from all directions across the sky, making it appear blue.",
  "done": true,
  "done_reason": "stop",
  "context": [1, 2, 3, 4, 5],
  "total_duration": 4523456789,
  "load_duration": 456789,
  "prompt_eval_count": 9,
  "prompt_eval_duration": 234567890,
  "eval_count": 82,
  "eval_duration": 4288888899
}