Documentation
Welcome to AffordableAI API documentation. Our API is fully compatible with OpenAI's API format, making migration seamless.
Quick Start
Getting started with AffordableAI is easy. Follow these steps:
- Sign up for an account and get your API key
- Choose your preferred pricing plan
- Start making API calls
Authentication
All API requests require an API key. Include your API key in the request header:
Authorization: Bearer YOUR_API_KEY
Chat Completions API
Our Chat Completions API is compatible with OpenAI's format:
POST /v1/chat/completions
Content-Type: application/json
{
"model": "gpt-3.5-turbo",
"messages": [
{"role": "user", "content": "Hello!"}
]
}
Available Models
| Model |
Context Length |
Use Case |
| DeepSeek |
32K |
Economy, Personal Use |
| Qwen |
32K |
Economy, Low Load Scripts |
| GLM-4 |
128K |
Standard, ChatBot Alternative |
| GPT-3.5-turbo |
16K |
Standard, General Purpose |
| Kimi |
128K |
Premium, Long Text Analysis |
| GPT-4 |
8K |
Premium, High Quality |
Pricing by Model
| Tier |
Price (per 1M tokens) |
Models |
| Economy |
$4.99 |
DeepSeek, Qwen |
| Standard |
$7.99 |
GLM-4, GPT-3.5 |
| Premium |
$12.99 |
Kimi, GPT-4 |
Python Example
Install our SDK or use requests directly:
pip install openai
import openai
openai.api_key = "YOUR_AFFORDABLEAI_API_KEY"
openai.api_base = "https://affordableapi.com/v1"
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(response.choices[0].message.content)
Node.js Example
npm install openai
const { Configuration, OpenAIApi } = require('openai');
const configuration = new Configuration({
apiKey: process.env.AFFORDABLEAI_API_KEY,
basePath: 'https://affordableapi.com/v1',
});
const openai = new OpenAIApi(configuration);
async function main() {
const response = await openai.createChatCompletion({
model: 'gpt-3.5-turbo',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(response.data.choices[0].message.content);
}
main();
Need Help?
Contact our support team at [email protected] or join our Discord community.