Making Requests
Getting Started with relaxAI API Requests
You must first generate an API key before you can begin sending calls to the RelaxAI API. Here is the process:
- Access the RelaxAI settings by logging in.
- Navigate to the “API Keys” tab and scroll down to the “Create new API Key” section.
- Select “Create New API Key” and name your API key.
- Click “Create” api key to generate the API key.
- Every API key has options to deactivate or delete it. You can also regenerate the key if needed.
- Copy the API key and store it securely, as it will not be displayed again.
- Use this API key in the
Authorizationheader of your requests to authenticate with the RelaxAI API. The header should be in the format:
Authorization: Bearer your-api-key-hereReplace your-api-key-here with your actual API key.
Base URL
To ensure all API requests are sent to RelaxAI, the following base URL should always be used.
https://api.relax.ai/v1Your 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
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." } } ]}...