API v1.0 - Production Ready

API Reference
For Developers

Integrate powerful AI capabilities into your applications using LyDian API. RESTful Get started right away with APIs, SDKs, and comprehensive documentation.

99.9%
Uptime SLA
<100ms
Average Response
23+
AI Modeli

Your API Key

Use this key as a Bearer token in the Authorization header for all API requests.

sk-lydian-••••••••••••••••
Start

Quick Start

To start using LyDian API, you first need an API key. You can create your API key from the Dashboard and start using it immediately.

API Key Security
Never share your API key in public repositories. Environment variables store securely and only use in trusted applications.
Security

Authentication

All API requests require an API key in the Authorization header. Send your API key as a Bearer token.

HTTP Header

HTTP
Authorization: Bearer YOUR_API_KEY
Endpoint

Base URL

Base URL for all API endpoints. Always use HTTPS in production environment.

URL
https://api.lydian.ai/v1
Chat

Chat Completion

Main endpoint for chatting with LyDian AI models. Streaming ve non-streaming modes. Use streaming for real-time responses.

POST

/chat/completions

Ask questions to AI models with the chat completion endpoint, write code, create content, and more.

Request Parameters

Parameter Type Description
modelRequired string Model ID (e.g.: "lydian-turbo", "lydian-pro")
messagesRequired array Array of chat messages (role, content)
temperatureOptional number 0 to 2 (default: 0.7) - Creativity level
max_tokensOptional integer Maximum number of tokens (default: 2000)
streamOptional boolean Streaming mode (default: false)

Example Request

JavaScript
const response = await fetch('https://api.lydian.ai/v1/chat/completions', { method: 'POST', headers: { 'Authorization': 'Bearer sk-lydian-...', 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'lydian-turbo', messages: [ { role: 'user', content: 'Merhaba! AI ile neler yapabilirim?' } ], temperature: 0.7, max_tokens: 2000 }) }); const data = await response.json(); console.log(data.choices[0].message.content);
Python
import requests url = "https://api.lydian.ai/v1/chat/completions" headers = { "Authorization": "Bearer sk-lydian-...", "Content-Type": "application/json" } data = { "model": "lydian-turbo", "messages": [ {"role": "user", "content": "Merhaba! AI ile neler yapabilirim?"} ], "temperature": 0.7, "max_tokens": 2000 } response = requests.post(url, json=data, headers=headers) print(response.json()["choices"][0]["message"]["content"])
cURL
curl https://api.lydian.ai/v1/chat/completions \ -H "Authorization: Bearer sk-lydian-..." \ -H "Content-Type: application/json" \ -d '{ "model": "lydian-turbo", "messages": [ {"role": "user", "content": "Merhaba! AI ile neler yapabilirim?"} ], "temperature": 0.7, "max_tokens": 2000 }'

Example Response

JSON
{ "id": "chatcmpl-abc123", "object": "chat.completion", "created": 1677858242, "model": "lydian-turbo", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! You can do many things with AI..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 145, "total_tokens": 157 } }
Images

Image Generation

Generate high-quality images from text descriptions. LyDian Image Engine ve and other image generation models.

POST

/images/generate

Generate professional-quality images from text descriptions with the image generation endpoint. Different size and quality options available.

Request Parameters

Parameter Type Description
promptRequired string Image description (max 1000 characters)
sizeOptional string "1024x1024", "1792x1024", "1024x1792" (default: "1024x1024")
nOptional integer Number of images to generate: 1-4 (default: 1)
qualityOptional string "standard" or "hd" (default: "standard")

Example Request

cURL
curl https://api.lydian.ai/v1/images/generate \ -H "Authorization: Bearer sk-lydian-..." \ -H "Content-Type: application/json" \ -d '{ "prompt": "Futuristic city with flying cars at sunset", "size": "1024x1024", "n": 1, "quality": "hd" }'
Models

Available Models

All AI models available on the LyDian platform. Each model comes with different capabilities and pricing.

GET

/models

Lists all available AI models. Her modelin yetenekleri, context window size and pricing information.

Popular Models

lydian-turbo
Ultra-fast responses with LyDian AI Engine. Ideal for real-time applications.
500+ tok/s
128K ctx
lydian-pro
Most capable model with advanced reasoning and analysis.
Advanced
200K ctx
lydian-vision
Multimodal vision model for image analysis and understanding.
Vision
128K ctx
lydian-code
Specialized for code generation and software development.
Code
128K ctx
Errors

Error Codes

API uses standard HTTP status codes. All error responses contain detailed error information in JSON format.

Status Codes

Code Status Description
200 OK Request successful
400 Bad Request Request invalid or contains missing parameters
401 Unauthorized API key invalid or missing
403 Forbidden API key valid but unauthorized
404 Not Found Requested resource not found
429 Rate Limit Exceeded Too many requests sent
500 Internal Server Error Server error
503 Service Unavailable Service temporarily unavailable

Error Response Format

JSON
{ "error": { "message": "Invalid API key provided", "type": "invalid_request_error", "code": "invalid_api_key" } }
Limits

Rate Limits

API rate limits are applied on a minute and hourly basis. When limits are exceeded, a 429 status code is returned. Each response contains headers with your rate limit information.

Default Limits

Plan Requests/Min Requests/Hour Tokens/Min
Free 3 100 50,000
Pro 60 3,000 500,000
Enterprise Custom Custom Custom
Rate Limit Headers
Each response contains headers with your rate limit information: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset