Skip to main content
POST
/
v1
/
completions
Text Completions
curl --request POST \
  --url https://api.ajstudioz.co.in/v1/completions \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": {},
  "stream": true,
  "max_tokens": 123,
  "temperature": 123,
  "top_p": 123,
  "stop": {}
}
'
{
  "id": "cmpl-d9f3kx2m",
  "object": "text_completion",
  "created": 1751760000,
  "model": "gemma3:27b",
  "choices": [
    {
      "text": " bright and full of promise. The kingdom of Verdania was known for three things: its azure mountains, its vibrant festivals, and the mysterious Oracle who lived in the ancient tower at the city's center.",
      "index": 0,
      "finish_reason": "length"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 50,
    "total_tokens": 62
  }
}

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 text completion for a single prompt string. This is the legacy OpenAI-compatible format. For most use cases, prefer the Chat Completions endpoint.

Request

Headers

Authorization
string
required
Bearer token: Bearer YOUR_API_KEY

Body

model
string
required
Model identifier. See available models.
prompt
string or array
required
The prompt to complete. Can be a string or an array of strings for batch completions.
stream
boolean
default:"false"
Stream the completion as Server-Sent Events.
max_tokens
integer
default:"16"
Maximum number of tokens to generate.
temperature
number
default:"1"
Sampling temperature (0–2).
top_p
number
default:"1"
Nucleus sampling probability.
stop
string or array
Stop sequences.

Response

id
string
Unique completion ID.
object
string
"text_completion"
created
integer
Unix timestamp.
model
string
The model used.
choices
array
Completion results:
  • text — generated text
  • index — choice index
  • finish_reason"stop" or "length"
usage
object
Token usage: prompt_tokens, completion_tokens, total_tokens.

Example

from openai import OpenAI

client = OpenAI(
    base_url="https://api.ajstudioz.co.in/v1",
    api_key="YOUR_API_KEY"
)

response = client.completions.create(
    model="gemma3:27b",
    prompt="The future of artificial intelligence is",
    max_tokens=100,
    temperature=0.8
)

print(response.choices[0].text)
{
  "id": "cmpl-d9f3kx2m",
  "object": "text_completion",
  "created": 1751760000,
  "model": "gemma3:27b",
  "choices": [
    {
      "text": " bright and full of promise. The kingdom of Verdania was known for three things: its azure mountains, its vibrant festivals, and the mysterious Oracle who lived in the ancient tower at the city's center.",
      "index": 0,
      "finish_reason": "length"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 50,
    "total_tokens": 62
  }
}