API References
Chat Completions
Generates a model response for the given conversation
Create chat completions
Generates a model response completions for the given conversation.
Endpoint
POST /api/v1/chat/completionsAuthorization
Type: Bearer Token
API key is required to authorize requests. Obtain a key from your Routernesia dashboard.
Header: Authorization: Bearer <token>
Request Body
cURL
curl --location 'https://api.routernesia.id/api/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"model": "qwen/qwen3-32b-04-28",
"messages": [
{
"role": "user",
"content": "Can you explain the theory of relativity in simple terms?"
}
]
}'Response Body
Success Response (200)
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "Sure! The **theory of relativity** is a way of understanding how the universe works, especially when it comes to **space, time, and motion**. It was developed by **Albert Einstein** in the early 20th century and has two main parts: **special relativity** and **general relativity**.\n\n---\n\n### π **Special Relativity (1905)**\n\nThis part is about **objects moving at constant speeds**, especially close to the **speed of light**.\n\n**Key ideas:**\n\n1. **The speed of light is always the same** β no matter how fast you're moving when you measure it.\n2. **Time and space are not fixed** β they can change depending on how fast you're moving relative to someone else.\n - **Time slows down** for someone moving very fast (called **time dilation**).\n - **Objects get shorter** in the direction they're moving (called **length contraction**).\n3. **E = mcΒ²** β Energy and mass are related. A little bit of mass can be turned into a lot of energy (used in nuclear power and the sun).\n\n---\n\n### π **General Relativity (1915)**\n\nThis part is about **gravity** and how it affects **space and time**.\n\n**Key ideas:**\n\n1. **Gravity is not a \"pull\"** β it's the **bending of space and time** (called **spacetime**) caused by mass and energy.\n - Think of a heavy ball on a rubber sheet β it curves the sheet. Other objects follow the curve.\n2. **Time runs slower near massive objects** β the stronger the gravity, the slower time moves.\n3. **Light bends** near massive objects (this has been observed during solar eclipses).\n\n---\n\n### π§ In Simple Terms:\n\n- **Special Relativity** says: \n *βIf you're moving really fast, time slows down for you, and the world looks a little different.β*\n\n- **General Relativity** says: \n *βMass tells space how to curve, and curved space tells things how to move β thatβs gravity.β*\n\n---\n\n### Example:\n\nImagine you're in a spaceship zooming near the speed of light. From your point of view, everything seems normal. But from Earth, time on your spaceship would appear to be moving **slower**. If you traveled for a few years and came back, more time might have passed on Earth.\n\n---\n\n### Why It Matters:\n\n- GPS satellites need to account for relativity to work correctly β time runs slightly faster in space than on Earth.\n- It helps us understand black holes, the Big Bang, and how the universe expands.\n\n---\n\nWould you like a fun analogy or a visual example to help understand it better?",
"role": "assistant"
}
}
],
"created": 1769392652,
"id": "4b773af8a5e74b87ad3309bfd0ddc165",
"model": "qwen/qwen3-32b",
"object": "chat.completion",
"usage": {
"completion_tokens": 579,
"prompt_tokens": 24,
"total_tokens": 603
}
}Error Responses
401 Unauthorized
Invalid or missing API key.
422 Unprocessable Entity
Invalid request parameters.
Notes
- The
modelparameter must be a valid model ID available in your Routernesia account