MarketSupport← Back to app

Common API Quickstart

Basic utility APIs for account management and generated content.

Welcome to the Common API

The Common API provides fundamental utility services for managing your 97AI.PRO account and handling generated content. These APIs help you monitor credit usage and efficiently access generated files.

Check Account Credits

View your current credit balance and monitor usage

Download Generated Files

Fetch result files directly from the task result URLs

Authentication

All API requests require authentication using a Bearer token. Obtain your API key from the API Key Management page and keep it secure.

API Base URL

https://97ai.97claude.com

Authorization Header

Authorization: Bearer YOUR_API_KEY

Quick Start Guide

Two basic operations: check your credit balance, then download the result files of a finished task.

Step 1: Check Credit Balance

cURL
curl -X GET "https://97ai.97claude.com/api/credits" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response Example

JSON
{
  "credits": 1950
}

Step 2: Download Generated Files

When a task finishes, GET /api/generate/{taskId} returns resultUrls — direct, downloadable URLs for the generated media:

cURL
curl -X GET "https://97ai.97claude.com/api/generate/task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
# → { "state": "success", "resultUrls": ["https://…/out.jpg"], … }

curl -o out.jpg "https://…/out.jpg"
Media files are retained for 14 days.
Download and store important results on your side in time.

API Overview

Check Account Credits — GET /api/credits

  • Get real-time credit balance
  • No parameters required; immediate response
  • Essential for usage monitoring and credit-threshold alerts

Task Results — GET /api/generate/{taskId}

  • resultUrls covers all generated file types (images, videos, audio, etc.)
  • URLs are directly downloadable — no extra exchange step required
  • Files are retained for 14 days, then automatically deleted

Practical Examples

An automated credit-monitoring client:

JavaScript
class Ai97Client {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseUrl = 'https://97ai.97claude.com';
  }
  async getCredits() {
    const res = await fetch(this.baseUrl + '/api/credits', {
      headers: { 'Authorization': 'Bearer ' + this.apiKey }
    });
    if (!res.ok) throw new Error('Failed to get credits: ' + res.statusText);
    return (await res.json()).credits;
  }
  async getResultUrls(taskId) {
    const res = await fetch(this.baseUrl + '/api/generate/' + taskId, {
      headers: { 'Authorization': 'Bearer ' + this.apiKey }
    });
    const j = await res.json();
    return j.state === 'success' ? j.resultUrls : null;
  }
  async checkCreditsAndWarn(threshold = 10) {
    const credits = await this.getCredits();
    if (credits < threshold) { console.warn('Low credits: ' + credits); return false; }
    return true;
  }
}

Error Handling

Common errors: 401 Unauthorized (missing/invalid key), 402 Insufficient Credits, 403 Forbidden (key not permitted for the model), 404 Not Found (unknown taskId), 500 Server Error.

Important Notes

File Retention
Generated media is retained for 14 days — download immediately and store important results on your side.
Credit Balance
Service access is restricted when credits are exhausted. Monitor your balance, set low-credit warnings, and plan top-ups in advance.

Support

Email: [email protected] · Documentation: https://97ai.97claude.com/docs · API Status: check each model page for real-time health.