Learn how to securely authenticate with the Freddy API using API keys and manage your authentication workflow.
Freddy uses API key authentication for all requests. Your API key identifies your account and provides access to your resources.
- Log in to Freddy
- Navigate to Settings → API Keys
- Click "Create New API Key"
- Name your key (e.g., "Production App", "Development")
- Copy the key immediately (it won't be shown again)
All Freddy API keys follow this format:
ak_1234567890abcdef1234567890abcdef12345678- Prefix:
ak_(identifies it as an API key) - Length: 42 characters total
- Characters: Alphanumeric (a-z, A-Z, 0-9)
Pass your API key in the X-API-Key header on every request.
from aitronos import Aitronos
client = Aitronos(api_key="ak_your_api_key_here")
result = client.responses.create_response(
organization_id="org_your_org_id",
model="gpt-4o",
inputs=[{"role": "user", "content": "Hello!"}],
)
print(result.response[0]["text"])Install: pip install aitronos-sdk
curl -X POST "https://api.aitronos.com/v1/model/response" \
-H "X-API-Key: ak_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "org_your_org_id",
"model": "gpt-4o",
"inputs": [{"role": "user", "content": "Hello!"}]
}'import os
import requests
api_key = os.environ["FREDDY_API_KEY"]
headers = {
"X-API-Key": api_key,
"Content-Type": "application/json",
}
response = requests.post(
"https://api.aitronos.com/v1/model/response",
headers=headers,
json={
"organization_id": "org_your_org_id",
"model": "gpt-4o",
"inputs": [{"role": "user", "content": "Hello!"}],
},
)
data = response.json()
print(data["response"][0]["text"])const apiKey = process.env.FREDDY_API_KEY;
const response = await fetch("https://api.aitronos.com/v1/model/response", {
method: "POST",
headers: {
"X-API-Key": apiKey,
"Content-Type": "application/json",
},
body: JSON.stringify({
organization_id: "org_your_org_id",
model: "gpt-4o",
inputs: [{ role: "user", content: "Hello!" }],
}),
});
const data = await response.json();
console.log(data.response[0].text);DO:
- Store API keys in environment variables
- Use secure key management systems
- Rotate keys regularly
- Use different keys for different environments
DON'T:
- Commit API keys to version control
- Share keys in chat or email
- Use production keys in development
- Hardcode keys in your application
Store your API key securely:
# .env file
FREDDY_API_KEY=ak_your_api_key_here# Python
import os
api_key = os.getenv("FREDDY_API_KEY")// Node.js
const apiKey = process.env.FREDDY_API_KEY;Regularly rotate your API keys:
- Create a new key in Freddy
- Update your applications to use the new key
- Test thoroughly in staging environment
- Deploy to production
- Delete the old key after confirming everything works
{
"success": false,
"error": {
"code": "INVALID_API_KEY",
"message": "The API key provided is invalid or has expired.",
"system_message": "API key validation failed",
"type": "client_error",
"status": 401,
"details": {},
"trace_id": "abc-123-def",
"timestamp": "2025-12-22T15:30:00Z"
}
}Causes:
- Missing
X-API-Keyheader - Invalid or expired API key
- Malformed API key
{
"success": false,
"error": {
"code": "INSUFFICIENT_PERMISSIONS",
"message": "You don't have permission to access this resource.",
"system_message": "Insufficient permissions for this operation",
"type": "client_error",
"status": 403,
"details": {},
"trace_id": "abc-123-def",
"timestamp": "2025-12-22T15:30:00Z"
}
}Causes:
- API key doesn't have required permissions
- Account limitations or restrictions
- Resource access denied
import os
import requests
def make_authenticated_request(endpoint):
api_key = os.environ["FREDDY_API_KEY"]
headers = {"X-API-Key": api_key}
response = requests.get(
f"https://api.aitronos.com/v1/{endpoint}",
headers=headers,
)
if response.status_code == 401:
print("Authentication failed. Check your API key.")
return None
elif response.status_code == 403:
print("Permission denied. Check your account permissions.")
return None
elif response.status_code == 200:
return response.json()
else:
print(f"Unexpected error: {response.status_code}")
return NoneAPI keys are subject to rate limits based on your plan:
- Standard: 100 requests/minute
- Premium: 1,000 requests/minute
- Enterprise: Custom limits
Rate limit headers are included in responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200Track your API usage in Freddy:
- Go to Settings → API Keys
- View Usage Statistics for each key
- Monitor Rate Limit Status
- Set up Usage Alerts
- Check the format — Should start with
ak_ - Verify in Hub — Ensure key exists and is active
- Check the header — Use
X-API-Keyas the header name - Test with cURL — Isolate the issue
- Quick Start — Basic setup guide
- API Reference — Detailed endpoint docs
- Hub — Manage your keys
- Support — Contact our team
- Quick Start — Make your first request
- Code Examples — Common patterns and use cases
- Error Handling — Handle errors gracefully