Documentation

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.

Quick Start

  1. Review access: Sign in and check the current pricing page for available account options
  2. Get API credentials: An API key is available in the dashboard after eligible paid access is successfully provisioned
  3. Use the API: Send requests to POST /api/ai/generate with your API key
  4. Monitor credits: Track your usage in the dashboard

API Endpoint

POST https://simplifyconvert.com/api/ai/generate

Authentication

Include your API key in the Authorization header using Bearer token:

Authorization: Bearer sca_XXXXXXXXXXXXXXXX

Request

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"
}
prompt (required, string):

The code request or question (max 50,000 characters)

machineId (required, string):

Unique device identifier. Used to lock the API key to one device.

projectFingerprint (optional, string):

Project identifier for memory tracking (future feature)

taskType (optional, string):

Type of task: 'generate', 'explain', 'fix', 'debug', 'chat'. Default: 'chat'

Response

{
  "success": true,
  "response": "Here's a React form with email and password fields...",
  "creditsCharged": 1,
  "creditsRemaining": 99,
  "model": "Qwen 2.5 Coder"
}

Error Responses

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

Credit System

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.

Code Examples

JavaScript

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");

Python

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")

Device Authorization

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.

To use on a different device:

  1. Go to your dashboard
  2. Find your API key
  3. Click "Reset Device Lock"
  4. Make a request from your new device (max 3 times per month)

Best Practices

✅ Do's

  • Store API keys securely (environment variables, secret managers)
  • Use descriptive prompts for better results
  • Monitor your credit usage regularly
  • Regenerate keys if compromised

❌ Don'ts

  • Don't expose API keys in client-side code
  • Don't commit keys to version control
  • Don't share keys with others
  • Don't use the same key across multiple projects

Need Help?

Can't find what you're looking for? Contact our support team: