Learn how to call SimplifyConvert's server-side AI API. An internet connection, active API credentials, and sufficient credits are required.
This page documents the implemented API contract. Runtime access still depends on account status and current server/provider availability.
Include your API key in the Authorization header using Bearer token:
POST /api/ai/generate
Content-Type: application/json
Authorization: Bearer sca_XXXXXXXXXXXXXXXX
{
"prompt": "Generate a React form with email and password fields",
"machineId": "device-uuid-here",
"projectFingerprint": "optional-project-id",
"taskType": "generate"
}The code request or question (max 50,000 characters)
Unique device identifier. Used to lock the API key to one device.
Project identifier for memory tracking (future feature)
Type of task: 'generate', 'explain', 'fix', 'debug', 'chat'. Default: 'chat'
{
"success": true,
"response": "Here's a React form with email and password fields...",
"creditsCharged": 1,
"creditsRemaining": 99,
"model": "Qwen 2.5 Coder"
}401 - Missing or invalid API key
đĄ Include valid API key in Authorization header
402 - Insufficient credits
đĄ Wait for monthly reset or purchase more credits
403 - Device not authorized
đĄ Use the same machineId or reset device lock in dashboard
429 - Rate limit exceeded
đĄ Wait a minute before making another request (30 req/min limit)
500 - Server error
đĄ Try again later or contact support
Credits are deducted based on the size of your request:
Tier 1: Small Requests
Up to 2,000 characters = 1 credit
Tier 2: Medium Requests
2,001 - 10,000 characters = 3 credits
Tier 3: Large Requests
10,001+ characters = 5 credits
âšī¸ Credits only deduct after successful responses. If the AI generation fails, you are not charged.
const apiKey = "sca_XXXXXXXXXXXXXXXX";
const machineId = "device-uuid-here";
async function generateCode(prompt) {
const response = await fetch(
"https://simplifyconvert.com/api/ai/generate",
{
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt,
machineId,
taskType: "generate",
}),
}
);
if (!response.ok) {
const error = await response.json();
console.error("Error:", error);
return;
}
const data = await response.json();
console.log("AI Response:", data.response);
console.log("Credits Remaining:", data.creditsRemaining);
}
generateCode("Create a React hook for fetching data");import requests
import uuid
api_key = "sca_XXXXXXXXXXXXXXXX"
machine_id = str(uuid.uuid4())
def generate_code(prompt):
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
}
body = {
"prompt": prompt,
"machineId": machine_id,
"taskType": "generate",
}
response = requests.post(
"https://simplifyconvert.com/api/ai/generate",
headers=headers,
json=body,
)
if response.status_code != 200:
print("Error:", response.json())
return
data = response.json()
print("AI Response:", data["response"])
print("Credits Remaining:", data["creditsRemaining"])
generate_code("Create a Flask API endpoint for user login")Your API key is locked to a single device for security. The first request you make from a new device will set the device lock.
â Do's
â Don'ts
Can't find what you're looking for? Contact our support team: