AK AI CORE API Documentation
OpenAI-compatible API for 140+ AI models. One endpoint, one wallet, instant access to GPT-4o, Claude 3.5, Gemini, and more. Pay-as-you-go with bKash/Nagad.
AK AI CORE API
Welcome to the AK AI CORE API documentation. Our API is OpenAI-compatible, letting you access 140+ AI models through a single endpoint with pay-as-you-go billing via bKash/Nagad.
AK AI CORE provides a unified gateway to the world's best AI models. Instead of managing multiple API keys from OpenAI, Anthropic, Google, and others, you get one endpoint, one wallet, and instant access to GPT-4o, Claude 3.5, Gemini, Llama, and more.
Base URL
https://akaicore.space/v1All API requests should be made to this base URL. The API follows standard REST conventions and returns JSON responses.
Quick Example
1curl -X POST https://akaicore.space/v1/chat/completions \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "openai/gpt-4o-mini",
6 "messages": [
7 {"role": "user", "content": "Hello from AK AI CORE"}
8 ]
9 }'Authentication
AK AI CORE uses API key authentication via the Authorization header, fully compatible with the OpenAI SDK. Generate your API key from the dashboard and pass it in every request.
All API requests require an API key passed in the Authorization header as a Bearer token. You can generate API keys from your AK AI CORE dashboard under Settings > API Keys.
API Key Format
Authorization: Bearer sk-or-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcURL Example
curl https://akaicore.space/v1/models \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Python (OpenAI SDK)
1from openai import OpenAI
2
3client = OpenAI(
4 api_key="YOUR_API_KEY", # Your AK AI CORE API key
5 base_url="https://akaicore.space/v1"
6)
7
8# Now use client exactly like OpenAI
9response = client.chat.completions.create(
10 model="openai/gpt-4o-mini",
11 messages=[{"role": "user", "content": "Hello"}]
12)Node.js (OpenAI SDK)
1import OpenAI from "openai";
2
3const client = new OpenAI({
4 apiKey: "YOUR_API_KEY", // Your AK AI CORE API key
5 baseUrl: "https://akaicore.space/v1"
6});
7
8// Now use client exactly like OpenAI
9const response = await client.chat.completions.create({
10 model: "openai/gpt-4o-mini",
11 messages: [{ role: "user", content: "Hello" }]
12});Security Notes
Chat Completions
Send messages to any AI model and receive a completion. Fully compatible with the OpenAI Chat Completions API — just change the base_url.
https://akaicore.space/v1/chat/completionscURL
1curl -X POST https://akaicore.space/v1/chat/completions \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "openai/gpt-4o-mini",
6 "messages": [
7 {"role": "system", "content": "You are a helpful assistant."},
8 {"role": "user", "content": "What is the capital of Bangladesh?"}
9 ],
10 "temperature": 0.7,
11 "max_tokens": 512
12 }'Python (OpenAI SDK)
1from openai import OpenAI
2
3client = OpenAI(
4 api_key="YOUR_API_KEY",
5 base_url="https://akaicore.space/v1"
6)
7
8response = client.chat.completions.create(
9 model="openai/gpt-4o-mini",
10 messages=[
11 {"role": "system", "content": "You are a helpful assistant."},
12 {"role": "user", "content": "What is the capital of Bangladesh?"}
13 ],
14 temperature=0.7,
15 max_tokens=512
16)
17
18print(response.choices[0].message.content)Node.js (OpenAI SDK)
1import OpenAI from "openai";
2
3const client = new OpenAI({
4 apiKey: "YOUR_API_KEY",
5 baseUrl: "https://akaicore.space/v1"
6});
7
8const response = await client.chat.completions.create({
9 model: "openai/gpt-4o-mini",
10 messages: [
11 { role: "system", content: "You are a helpful assistant." },
12 { role: "user", content: "What is the capital of Bangladesh?" }
13 ],
14 temperature: 0.7,
15 max_tokens: 512
16});
17
18console.log(response.choices[0].message.content);Request Body
1{
2 "model": "openai/gpt-4o-mini",
3 "messages": [
4 { "role": "system", "content": "You are a helpful assistant." },
5 { "role": "user", "content": "Hello!" }
6 ],
7 "temperature": 0.7,
8 "max_tokens": 512,
9 "stream": false,
10 "top_p": 1.0,
11 "frequency_penalty": 0.0,
12 "presence_penalty": 0.0
13}Response Body
1{
2 "id": "chatcmpl-abc123",
3 "object": "chat.completion",
4 "created": 1718323200,
5 "model": "openai/gpt-4o-mini",
6 "choices": [
7 {
8 "index": 0,
9 "message": {
10 "role": "assistant",
11 "content": "The capital of Bangladesh is Dhaka."
12 },
13 "finish_reason": "stop"
14 }
15 ],
16 "usage": {
17 "prompt_tokens": 24,
18 "completion_tokens": 10,
19 "total_tokens": 34
20 }
21}Streaming (SSE)
Set "stream": true to receive tokens in real-time via Server-Sent Events. Works identically to OpenAI's streaming API.
1curl -X POST https://akaicore.space/v1/chat/completions \
2 -H "Authorization: Bearer YOUR_API_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "openai/gpt-4o-mini",
6 "messages": [{"role": "user", "content": "Hello"}],
7 "stream": true
8 }'Request Parameters
Models
List all available models on AK AI CORE. Returns model IDs, pricing, and capabilities in OpenAI-compatible format.
https://akaicore.space/v1/modelsReturns a list of all active models you can use. Model IDs follow the provider/model-name format (e.g., openai/gpt-4o-mini).
cURL
curl https://akaicore.space/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"Python
1from openai import OpenAI
2
3client = OpenAI(
4 api_key="YOUR_API_KEY",
5 base_url="https://akaicore.space/v1"
6)
7
8models = client.models.list()
9for model in models:
10 print(model.id)Node.js
1import OpenAI from "openai";
2
3const client = new OpenAI({
4 apiKey: "YOUR_API_KEY",
5 baseUrl: "https://akaicore.space/v1"
6});
7
8const models = await client.models.list();
9console.log(models.data.map(m => m.id));Response
1{
2 "object": "list",
3 "data": [
4 {
5 "id": "openai/gpt-4o-mini",
6 "object": "model",
7 "created": 1715644800,
8 "owned_by": "openai"
9 },
10 {
11 "id": "anthropic/claude-3-5-sonnet",
12 "object": "model",
13 "created": 1718323200,
14 "owned_by": "anthropic"
15 }
16 ]
17}Wallet & Credits
AK AI CORE uses a simple pay-as-you-go credit system. Top up via bKash, Nagad, or UddoktaPay — then use any model instantly. No subscriptions, no hidden fees.
All API usage is billed through credits. $1 USD credit = $1 USD of usage. Credits are deducted in real-time based on actual token consumption and model pricing.
How Pricing Works
Top Up Methods
Checking Balance
View your current balance and transaction history in the AK AI CORE dashboard under Wallet.
1{
2 "balance": 12.45,
3 "transactions": [
4 {
5 "id": "tx_abc123",
6 "amount": -0.001520,
7 "type": "USAGE",
8 "description": "Chat: Claude 3.5 Sonnet",
9 "status": "success",
10 "createdAt": "2025-01-15T10:30:00Z"
11 },
12 {
13 "id": "tx_xyz789",
14 "amount": 10.00,
15 "type": "TOPUP",
16 "description": "Top-up via bKash",
17 "status": "success",
18 "createdAt": "2025-01-14T08:00:00Z"
19 }
20 ]
21}Low Balance Alert
When your balance drops below $0.50, API requests will return 402 Payment Required. Top up anytime from the dashboard.
{
"error": "Insufficient credits. Please top up your account."
}Error Codes
All API errors follow a consistent JSON format with an error field. HTTP status codes indicate the type of failure.
{
"error": "Human-readable error message"
}HTTP Status Codes
| Code | Meaning | Common Cause |
|---|---|---|
| 200 | OK | Request succeeded. |
| 201 | Created | Resource created (API key, account, etc). |
| 400 | Bad Request | Missing required fields, invalid payload, or validation failure. |
| 401 | Unauthorized | Invalid or expired API key, or missing session cookie. |
| 402 | Payment Required | Insufficient credits to process the request. |
| 403 | Forbidden | IP not in allowlist, admin-only endpoint, or user mismatch. |
| 404 | Not Found | Model, conversation, user, or resource does not exist. |
| 409 | Conflict | Email already registered or duplicate resource. |
| 429 | Too Many Requests | Rate limit exceeded. Implement backoff and retry. |
| 500 | Internal Server Error | Unexpected server failure. Contact support if persistent. |
| 503 | Service Unavailable | No active providers available to route the request. |
Error Handling Example
1const response = await fetch('https://akaicore.space/v1/chat/completions', {
2 method: 'POST',
3 headers: {
4 'Content-Type': 'application/json',
5 'Authorization': 'Bearer YOUR_API_KEY'
6 },
7 body: JSON.stringify(payload),
8});
9
10if (!response.ok) {
11 const { error } = await response.json();
12
13 switch (response.status) {
14 case 401:
15 console.error('Unauthorized:', error);
16 break;
17 case 402:
18 console.log('Insufficient credits:', error);
19 break;
20 case 429:
21 console.log('Rate limited. Retrying after backoff...');
22 await new Promise(r => setTimeout(r, 2000));
23 break;
24 case 404:
25 console.log('Model not found:', error);
26 break;
27 case 500:
28 console.error('Server error:', error);
29 break;
30 default:
31 console.error('API error:', response.status, error);
32 }
33}