Skip to content

Making Requests

Base URL

To ensure all API requests are sent to relaxAI, the following base URL should always be used.

https://api.relax.ai/v1

Your First API Call

The following example demonstrates how to make your first API request using the curl command. Replace $RELAX_API_KEY with your unique API key obtained from the relaxAI console.

API request
Terminal window
curl https://api.relax.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RELAX_API_KEY" \
-d '{
"model": "Llama-4-Maverick-17B-128E",
"messages": [{"role": "user", "content": "What is the capital of the UK?"}],
"temperature": 0.7
}'

In this example, the request queries the Llama-4-Maverick-17B-128E model to answer the question, “What is the capital of the UK?”. A successful response will resemble the following.

API response
{
"id": "chatcmpl-2bf56b941fb54c4b92f58c4e82d7ffef",
"object": "chat.completion",
"created": 1744034253,
"model": "Llama-4-Maverick-17B-128E",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of the United Kingdom is London."
}
}
]
}
...