How to send a request to the API?
To interact with our API, follow these steps:
- Obtain an API Key
Log in to your account and retrieve your API key from the dashboard.
Set Up Your Environment
- Ensure you have the required libraries installed. For Python, you can install
requests
if it is not already available:
pip install requests
- Send a Request
- Use an HTTP
GET
orPOST
request to the appropriate API endpoint. Include your API key in the request headers for authentication.
Process the Response
- The API returns a JSON response, which you can parse and use in your application.
- Use an HTTP
Example Request in Python
import requests response = requests.post( "https://api.aimlapi.com/v1/chat/completions", headers={"Content-Type":"application/json", "Authorization": "Bearer 'YOUR_API_KEY'"}, json={"model":"o1","messages":[{"role":"user","content":"Who are you"}]} ) data = response.json() print(data)
For more details on available endpoints, parameters, and response formats, refer to our API Documentation. If you need further assistance, contact our support team.