API Reference

Comprehensive API documentation for the LyDian Enterprise AI platform. All endpoints, parameters and example usage.

base url
https://www.ailydian.com/api
All API requests start with this base URL. Use your own domain in production environment.
Quick Start
LyDian API uses RESTful architecture. All requests are in JSON format. Each request requires authentication with authorization header.

Authentication

All API requests require Bearer token authentication. Use your token in the authorization header.

curl -X GET https://www.ailydian.com/api/models \
  -H "Authorization: Bearer sk-lydian-xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json"
  • Never share your API key in public repositories
  • Store in environment variables
  • Do not use in client-side code
  • Periodically renew your keys
post /api/chat

Creates a chat with AI models. You can choose from 23 different models.

parametre tip zorunlu description
message string evet user message
model string no model to use (default: LyDian Engine)
stream boolean no streaming mode (default: false)
temperature number no 0-1 range, creativity level
const response = await fetch('https://www.ailydian.com/api/chat', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    message: 'yapay zeka nedir?',
    model: 'LyDian Engine',
    temperature: 0.7
  })
});

const data = await response.json();
// DEBUG: console.log(data.response);
{
  "success": true,
  "response": "yapay zeka, makinelerin insan benzeri...",
  "model": "LyDian Engine",
  "tokens": 156,
  "timestamp": "2024-01-15T10:30:00Z"
}
post /api/chat

Get responses with real-time streaming. Displayed instantly as each token arrives.

const response = await fetch('https://www.ailydian.com/api/chat', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    message: 'uzun bir makale yaz',
    stream: true
  })
});

const reader = response.body.getReader();
const decoder = new TextDecoder();

while (true) {
  const { done, value } = await reader.read();
  if (done) break;

  const chunk = decoder.decode(value);
  process.stdout.write(chunk); // write as each word arrives
}
get /api/models

Lists all available AI models. Shows features and limits of each model. dahil.

curl -X GET https://www.ailydian.com/api/models \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "models": [
    {
      "id": "LyDian Engine",
      "name": "LyDian Engine Omni",
      "provider": "lydian-labs",
      "capabilities": ["chat", "vision", "code"],
      "max_tokens": 128000
    },
    {
      "id": "enterprise-ai-3.5",
      "name": "Ultra Intelligence Model",
      "provider": "advanced-ai-platform",
      "capabilities": ["chat", "code", "analysis"],
      "max_tokens": 200000
    }
  ]
}
post /api/vision

Performs image analysis. Object detection, face recognition, OCR and content moderation.

parametre tip zorunlu description
image string evet base64 encoded image or URL
task string evet detect, ocr, moderate, describe
const response = await fetch('https://www.ailydian.com/api/vision', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    image: 'https://example.com/image.jpg',
    task: 'describe'
  })
});

const data = await response.json();
post /api/generate-image

Generates high-quality images from text description. Uses LyDian Image Engine model. ile.

parametre tip zorunlu description
prompt string evet image description
size string no 1024x1024, 1792x1024, 1024x1792
quality string no standard, hd
const response = await fetch('https://www.ailydian.com/api/generate-image', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    prompt: 'a minimalist mountain landscape at sunset',
    size: '1024x1024',
    quality: 'hd'
  })
});
post /api/translate

Text translation with 84 language support. Uses z.ai language package.

parametre tip zorunlu description
text string evet text to translate
from string no kaynak dil (auto detect)
to string evet hedef dil kodu
const response = await fetch('https://www.ailydian.com/api/translate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    text: 'hello world',
    to: 'tr'
  })
});

error codes

kod durum description
400 bad request invalid request format or parameters
401 unauthorized invalid or missing API key
403 forbidden you do not have permission to access this resource
429 rate limit too many requests, try again later
500 server error server error, contact support team

rate limiting

Your API requests are limited based on your plan type.

plan istek/dakika requests/day token limiti
free 10 100 10k tokens
starter 60 10,000 100k tokens
pro 300 100,000 1M tokens
enterprise unlimited unlimited unlimited