Integrate powerful AI capabilities into your applications with our simple REST API. Secure, scalable, and easy to use.
Get started with the AimiChat API in minutes. Generate an API key from your account settings and start making requests.
Generate and manage your API keys from your account settings. Each key uses your daily credit allotment and supports basic chat (talk mode) only.
All API requests require authentication using your API key. You can provide your API key in three ways:
Authorization: Bearer aimichat_your_api_key_here
X-API-Key: aimichat_your_api_key_here
?api_key=aimichat_your_api_key_here
API requests count against your monthly credit limit based on your subscription tier. All API keys from the same account share the same quota.
Rate limit information is included in response headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 75
X-RateLimit-Reset: 2024-01-19T00:00:00Z
https://aimichat.app/v1/chat/completions
Send a chat message and receive an AI response. Supports both streaming and non-streaming modes.
messagesrole and contentstreammax_tokenstemperaturecurl -X POST https://aimichat.app/v1/chat/completions \
-H "Authorization: Bearer aimichat_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "Hello, how are you?"}
],
"max_tokens": 500,
"temperature": 0.7
}'
{
"model": "aimichat-1",
"choices": [
{
"message": {
"role": "assistant",
"content": "Hello! I'm doing well, thank you for asking..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 45,
"total_tokens": 57
}
}
When stream: true, responses are sent as Server-Sent Events (SSE):
data: {"choices":[{"delta":{"content":"Hello"}}]}
data: {"choices":[{"delta":{"content":"!"}}]}
data: [DONE]
The API uses standard HTTP status codes to indicate success or failure.
{
"error": "Rate limit exceeded",
"message": "Daily credit limit reached",
"limit": 100,
"used": 100,
"resetAt": "2024-01-19T00:00:00Z"
}
Get started quickly with these code examples in popular programming languages.
import requests
api_key = "aimichat_your_api_key_here"
url = "https://aimichat.app/v1/chat/completions"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
data = {
"messages": [
{"role": "user", "content": "What is the capital of France?"}
],
"max_tokens": 100
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const fetch = require('node-fetch');
const apiKey = 'aimichat_your_api_key_here';
const url = 'https://aimichat.app/v1/chat/completions';
const data = {
messages: [
{ role: 'user', content: 'What is the capital of France?' }
],
max_tokens: 100
};
fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(res => res.json())
.then(data => console.log(data));
curl -X POST https://aimichat.app/v1/chat/completions \
-H "Authorization: Bearer aimichat_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "What is the capital of France?"}
],
"max_tokens": 100
}'
Never commit API keys to version control. Use environment variables to store them securely.
Implement proper error handling for rate limits and API errors to ensure reliability.
Track your API usage to avoid hitting daily limits and optimize your credit consumption.
Revoke and regenerate keys immediately if they are compromised or exposed.
Our team is here to help you integrate AimiChat into your applications.