Skip to content

Text Completions

POST https://api.studiolm.dev/v1/completions

Legacy endpoint maintained for compatibility. For new integrations, use Chat Completions.

Example

curl https://api.studiolm.dev/v1/completions \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemma-3-12b-it-qat",
    "prompt": "Write a poem about the ocean",
    "max_tokens": 150
  }'
import requests

response = requests.post(
    "https://api.studiolm.dev/v1/completions",
    headers={"Authorization": "Bearer sk-..."},
    json={
        "model": "gemma-3-12b-it-qat",
        "prompt": "Write a poem about the ocean",
        "max_tokens": 150,
    },
)
print(response.json()["choices"][0]["text"])

Parameters

Parameter Type Default Description
model string required Model ID
prompt string required Input text to complete
temperature number 0.7 Randomness (0–2)
max_tokens integer 1000 Max tokens to generate
stream boolean false Stream via SSE

Response

{
  "id": "cmpl-abc123",
  "object": "text_completion",
  "model": "gemma-3-12b-it-qat",
  "choices": [{
    "text": "The ocean stretches endlessly...",
    "index": 0,
    "finish_reason": "stop"
  }],
  "usage": {"prompt_tokens": 8, "completion_tokens": 60, "total_tokens": 68}
}