DocsGetting Started
Getting Started
Get up and running with FractalAI in under 5 minutes
1
Install the SDK2
Get API Key3
Make Your First CallStep 1: Install the SDK
Choose your preferred programming language
Terminal
$ pip install fractalaiRequires Python 3.9 or higher. For async support, the SDK uses aiohttp.
Step 2: Get Your API Key
Create an account and generate API credentials
- 1
Sign up at fractalai.io
Create a free account to get started
- 2
Navigate to Dashboard > API Keys
Find the API Keys section in your dashboard
- 3
Click "Create New Key"
Your key will start with
frac_
Important: Keep your API key secure. Never expose it in client-side code or public repositories.
Step 3: Make Your First Call
Send a request to the FractalAI API
main.py
import os
from fractalai import FractalAI
# Initialize the client
client = FractalAI(
api_key=os.environ.get("FRACTAL_API_KEY")
)
# Create a chat completion
response = client.chat.completions.create(
model="fractal-hyperbolic-v1",
messages=[
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the golden ratio?"
}
]
)
# Print the response
print(response.choices[0].message.content)
# Access fractal metrics
print(f"Quality Score: {response.fractal_metrics.quality_score}")
print(f"Hausdorff Dimension: {response.fractal_metrics.hausdorff_dimension}")Expected Output
The golden ratio, often denoted by the Greek letter phi, is approximately 1.618033988749895...
Quality Score: 0.92
Hausdorff Dimension: 1.6180