Welcome to the Aion Labs documentation! Aion Labs provides powerful AI models accessible through a robust RESTful API, allowing you to harness the capabilities of our specialized models in your own applications. For a quick setup, check out the Quick Start guide below. Alternatively, check out the API reference or explore the links in the left-hand sidebar for detailed documentation on each of our services:
Get started with your first API request to the Aion Labs API. Since it's compatible with OpenAI's API, you can use the OpenAI SDK to interact with the Aion Labs API seamlessly. Alternatively, you can interact directly with the API using any HTTP client.
Create an API key in the dashboard and export the key as an environment variable:
export OPENAI_API_KEY="your_api_key_here"
setx OPENAI_API_KEY "your_api_key_here"
Install the OpenAI SDK for TypeScript and JavaScript using npm or your preferred package manager:
npm install openai
Next, copy the code below into a file and execute it using the server-side environment of your choice:
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: 'https://api.aionlabs.ai/v1',
});
const completion = await openai.chat.completions.create({
model: 'aion-rp-small',
messages: [{ role: 'user', content: 'Write a joke about programming.' }]
});
console.log(completion.choices[0].message);
Create an API key in the dashboard and export the key as an environment variable:
export OPENAI_API_KEY="your_api_key_here"
setx OPENAI_API_KEY "your_api_key_here"
First install the OpenAI SDK for Python using pip or your preferred package manager:
pip install openai
Next, copy the code below into a file and execute it using the Python interpreter:
from openai import OpenAI
client = OpenAI(base_url="https://api.aionlabs.ai/v1")
completion = client.chat.completions.create(
model="aion-rp-small",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{
"role": "user",
"content": "Write a joke about programming."
}
]
)
print(completion.choices[0].message)
Create an API key in the dashboard.
On Unix-based systems, you can test out the Aion Labs RESTful API using curl:
curl "https://api.aionlabs.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {your_api_key_here}" \
-d '{
"model": "aion-rp-small",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Write a joke about programming."
}
]
}'