Getting Started
Authentication
All requests to the AI API must be authenticated using an API key. Our API uses Bearer token authentication, which is compatible with the OpenAI SDK and standard HTTP authorization headers.
API Key
During the beta period, you can use the shared beta API key:
UNLIMITED-BETA
Important Notes:
- No signup or registration required during beta
- Production API keys will be individual and unique
- Keep your API keys secure and never expose them in client-side code
Authentication Methods
Using OpenAI SDK
The easiest way to authenticate is using the official OpenAI SDK:
import OpenAI from "openai";
const openai = new OpenAI({
baseURL: "https://api.akbxr.com/v1",
apiKey: "YOUR_API_KEY",
});
const completion = await openai.chat.completions.create({
messages: [{ role: "user", content: "Hello, AI!" }],
model: "auto",
stream: false
});
console.log(completion.choices[0].message.content);
import openai
client = openai.OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.akbxr.com/v1"
)
response = client.chat.completions.create(
model="auto",
messages=[
{"role": "user", "content": "Hello World!"}
],
stream=False
)
print(response.choices[0].message.content)
Using HTTP Headers
For direct HTTP requests, include the API key in the Authorization header:
curl -X POST https://api.akbxr.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "auto",
"messages": [
{
"role": "user",
"content": "Hello, AI!"
}
]
}'
Error Responses
If authentication fails, you'll receive an error response:
{
"error": {
"message": "Invalid API key provided",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}
Common authentication errors:
Error Code | Description | Solution |
---|---|---|
invalid_api_key | API key is missing or invalid | Check your API key |
unauthorized | Request lacks authentication | Include Authorization header |
forbidden | API key doesn't have required permissions | Contact support |
Security Best Practices
✅ Do:
- Store API keys in environment variables
- Use HTTPS for all requests
- Rotate API keys regularly (in production)
- Monitor API key usage
❌ Don't:
- Hard-code API keys in your source code
- Commit API keys to version control
- Share API keys publicly
- Use API keys in client-side JavaScript
Next Steps
Now that you understand authentication, you can:
- Install the SDK for your preferred language
- Make your first API call