Developer Documentation

SunCore API Reference

OpenAI-compatible REST API. Chat, Image, Video, Music, Agents, Council, Knowledge, Face Swap — all in one platform.

1,000+ AI Models OpenAI Compatible Usage Tracking

Quick Start

1. Get your API Key

Go to API Marketplace and create a new key. Keys start with sk-sun-

2. Make your first request

bash
curl https://suncore.asia/api/v1/chat/completions \
  -H "Authorization: Bearer sk-sun-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "suncore-1",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Hello!"}
    ]
  }'

Endpoints

POST/api/v1/chat/completions

Chat Completions

Generate conversational responses. OpenAI-compatible format with 1,000+ specialized AI models.

Tier: Free+Cost: 1 credit/call
POST/api/v1/images/generations

Image Generation

Generate images from text prompts. Returns URL to generated image.

Tier: Starter+Cost: 5 credits/call
POST/api/v1/audio/transcriptions

Audio Transcription

Transcribe audio files to text. Supports multiple languages and formats.

Tier: Starter+Cost: 3 credits/call
GET/api/v1/models

List Models

List available AI models.

Tier: Free+Cost: 0 credit/call
POST/api/v1/videos/generate

Video Generation

Generate AI videos from text prompts. Returns job ID for async polling.

Tier: Pro+Cost: 15 credits/call
POST/api/v1/music/generate

Music Generation

AI music composition with genre, mood, and tempo control. Multi-track output.

Tier: Pro+Cost: 10 credits/call
POST/api/v1/agents/invoke

AI Agent Invocation

Invoke autonomous AI agents with 46+ capabilities (code, research, data viz, etc.).

Tier: Starter+Cost: 3 credits/call
POST/api/v1/council/consult

Star Origin Council

Multi-expert AI consultation. Routes to specialized departments for comprehensive answers.

Tier: Pro+Cost: 5 credits/call
POST/api/v1/knowledge/query

Knowledge Base Query

Search the SunCore knowledge base using semantic similarity (RAG).

Tier: Starter+Cost: 1 credit/call
POST/api/v1/face-swap

Face Swap

AI face swap using InsightFace + CodeFormer. Accepts base64 images, returns swapped result.

Tier: Pro+Cost: 8 credits/call
GET/api/v1/usage

Usage Statistics

Get your API usage statistics and remaining credits.

Tier: Free+Cost: 0 credit/call

Chat Completions

Request Body

ParameterTypeRequiredDescription
messagesarrayRequiredArray of message objects with role and content
modelstringOptionalModel ID (default: suncore-1)
temperaturenumberOptionalSampling temperature (0-2, default: 0.7)
max_tokensintegerOptionalMaximum tokens to generate (default: 4096)

Response

json
{
  "id": "chatcmpl-abc123def456",
  "object": "chat.completion",
  "created": 1714300000,
  "model": "suncore-1",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 20,
    "completion_tokens": 10,
    "total_tokens": 30
  }
}

Image Generation

Request

bash
curl https://suncore.asia/api/v1/images/generations \
  -H "Authorization: Bearer sk-sun-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A futuristic city at sunset, cyberpunk style"
  }'

Response

json
{
  "created": 1714300000,
  "data": [
    {
      "url": "https://suncore.asia/manus-storage/generated-image-abc123.png"
    }
  ]
}

Music Generation

Request

bash
curl https://suncore.asia/api/v1/music/generate \
  -H "Authorization: Bearer sk-sun-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Upbeat electronic dance track with synth leads",
    "genre": "EDM",
    "mood": "energetic",
    "tempo": 128
  }'

Response

json
{
  "data": {
    "content": "<!-- SUNCORE_MUSIC_DATA:... -->",
    "model": "suncore-music"
  },
  "usage": { "credits_used": 10, "balance_remaining": 490 }
}

AI Agent Invocation

Request

bash
curl https://suncore.asia/api/v1/agents/invoke \
  -H "Authorization: Bearer sk-sun-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Analyze this CSV data and create a summary report",
    "capability": "data_viz",
    "language": "en"
  }'

Available Capabilities

code_gendata_vizweb_searchdeep_researchcreative_writingmath_sciencedoc_analysistranslationdiagramspreadsheetpdf_generationemail_automationbrowser_automationfinancial_analysisseo_optimizationproject_management

Star Origin Council

Request

bash
curl https://suncore.asia/api/v1/council/consult \
  -H "Authorization: Bearer sk-sun-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "question": "What is the best marketing strategy for a SaaS startup?",
    "language": "en"
  }'

Response

json
{
  "data": {
    "answer": "Based on analysis from our Marketing, Strategy, and Finance departments...",
    "departments": [
      { "id": "marketing", "name": "Marketing", "emoji": "📊" },
      { "id": "strategy", "name": "Strategy", "emoji": "🎯" }
    ],
    "model": "suncore-council"
  },
  "usage": { "credits_used": 5, "balance_remaining": 495 }
}

Knowledge Base

Request

bash
curl https://suncore.asia/api/v1/knowledge/query \
  -H "Authorization: Bearer sk-sun-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "How to set up SunCore API?",
    "limit": 5
  }'

Response

json
{
  "data": {
    "results": [
      {
        "question": "How do I get started with SunCore API?",
        "answer": "Visit the API Marketplace to create your API key...",
        "category": "getting-started",
        "relevance_score": 0.95
      }
    ],
    "total": 1
  },
  "usage": { "credits_used": 1, "balance_remaining": 499 }
}

Face Swap

Request

bash
curl https://suncore.asia/api/v1/face-swap \
  -H "Authorization: Bearer sk-sun-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source_image": "<base64_encoded_source_face>",
    "target_image": "<base64_encoded_target_image>",
    "face_restore": true
  }'

Response (sync)

json
{
  "data": {
    "image": "<base64_encoded_result>",
    "format": "JPEG",
    "execution_time_ms": 12500
  },
  "usage": { "credits_used": 8, "balance_remaining": 492 }
}

Response (async — poll for result)

json
{
  "data": {
    "job_id": "abc123-def456",
    "status": "processing",
    "poll_url": "/api/v1/face-swap/status/abc123-def456"
  }
}

Audio Transcription

Request

bash
curl https://suncore.asia/api/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-sun-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "audio_url": "https://example.com/audio.mp3",
    "language": "th"
  }'

Response

json
{
  "text": "สวัสดีครับ วันนี้อากาศดีมาก",
  "language": "th",
  "duration": 3.5,
  "segments": [
    {
      "start": 0.0,
      "end": 1.5,
      "text": "สวัสดีครับ"
    },
    {
      "start": 1.5,
      "end": 3.5,
      "text": "วันนี้อากาศดีมาก"
    }
  ]
}

Error Handling

StatusCodeDescription
401invalid_api_keyMissing, invalid, or revoked API key
402credits_exhaustedInsufficient credits — top up at /pricing
403tier_requiredEndpoint requires higher tier (Starter/Pro/Enterprise)
429rate_limit_exceededToo many requests per minute
429quota_exceededMonthly request quota exceeded
500server_errorInternal server error
json
{
  "error": {
    "message": "Invalid or revoked API key",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}

API Tiers

Free

$0/mo

Rate: 60/min

Quota: 1,000/mo

  • Chat API
  • Basic Models

Starter

$9.99/mo

Rate: 120/min

Quota: 10,000/mo

  • All APIs
  • All Models
  • Image Gen

Pro

$19.99/mo

Rate: 300/min

Quota: 100,000/mo

  • All APIs
  • Priority Queue
  • Webhooks

Enterprise

$49.99/mo

Rate: 1,000/min

Quota: Unlimited

  • Dedicated Queue
  • Custom Models
  • SLA

Ready to build?

Get your API key and start building in minutes.

© 2024-2026 SunCore™ by SunCore Labs LLC. All Rights Reserved.

Base URL: https://suncore.asia/api/v1

Search

Search conversations and navigate