API Reference
SkyAIApp REST API v1.0
Complete API documentation covering authentication, model routing, agent runtime, and enterprise features.
Base URL
Productionhttps://api.skyaiapp.com/v1Authentication
All API requests require authentication via API Key in the request header.
Request Header
Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxSecurity Note
Never expose your API key in client-side code. Use a backend proxy for requests.
Example Request
curl -X POST https://api.skyaiapp.com/v1/route \
-H "Authorization: Bearer sk_live_xxxx" \
-H "Content-Type: application/json" \
-d '{"goal": "cost", "messages": [{"role": "user", "content": "Hello"}]}'Model Routing
/v1/routeIntelligently route requests to the optimal model based on goal and strategy.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| messages | array | Array of messages (OpenAI format) | |
| goal | string | Optimization goal: cost | quality | stability | |
| strategy | string | - | Strategy: balanced | cost-optimized | quality-first |
| stream | boolean | - | Enable streaming response |
| max_tokens | integer | - | Maximum tokens to generate |
| temperature | number | - | Sampling temperature (0-2) |
| cache | boolean | - | Enable semantic caching |
Request Example
{
"goal": "cost",
"strategy": "balanced",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."}
],
"max_tokens": 500,
"temperature": 0.7,
"cache": true
}Response Example
{
"id": "route_abc123",
"object": "route.completion",
"created": 1734220800,
"model": "gpt-5.2-instant",
"provider": "openai",
"usage": {
"prompt_tokens": 42,
"completion_tokens": 156,
"total_tokens": 198
},
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Quantum computing is a type of computation..."
},
"finish_reason": "stop"
}
],
"routing": {
"selected_model": "gpt-5.2-instant",
"fallback_model": "claude-sonnet-4.5",
"cache_hit": false,
"latency_ms": 847,
"cost_usd": 0.00156
}
}/v1/modelsList all available models with status and pricing information.
{
"models": [
{
"id": "gpt-5.2-thinking",
"provider": "openai",
"status": "available",
"pricing": {"input": 0.01, "output": 0.03},
"context_window": 128000,
"capabilities": ["chat", "vision", "function_calling", "reasoning"]
},
{
"id": "claude-opus-4.5",
"provider": "anthropic",
"status": "available",
"pricing": {"input": 0.015, "output": 0.075},
"context_window": 200000,
"capabilities": ["chat", "vision", "computer_use", "extended_thinking"]
},
{
"id": "gemini-3-pro",
"provider": "google",
"status": "preview",
"pricing": {"input": 0.00125, "output": 0.005},
"context_window": 1000000,
"capabilities": ["chat", "vision", "audio", "video"]
}
]
}Agent Runtime
/v1/agents/runExecute a multi-step agent task with tool calling, retries, and sandboxed execution.
Request Example
{
"task": "Research the latest AI news and create a summary report",
"tools": ["web_search", "read_url", "write_file"],
"max_steps": 15,
"timeout_seconds": 300,
"sandbox": true,
"callbacks": {
"on_step": "https://your-webhook.com/agent-step",
"on_complete": "https://your-webhook.com/agent-complete"
}
}Response Example
{
"id": "agent_run_xyz789",
"status": "completed",
"steps": [
{
"step": 1,
"action": "web_search",
"input": {"query": "latest AI news December 2024"},
"output": {"results": [...]},
"duration_ms": 1234
},
{
"step": 2,
"action": "read_url",
"input": {"url": "https://..."},
"output": {"content": "..."},
"duration_ms": 856
}
],
"result": {
"summary": "Here are the key AI developments...",
"sources": ["https://...", "https://..."]
},
"usage": {
"total_tokens": 4521,
"total_cost_usd": 0.0892,
"total_duration_ms": 45678
}
}Available Tools
web_searchWeb search
read_urlRead URL content
write_fileWrite file
code_execExecute code
calculatorCalculator
image_genImage generation
Analytics & Monitoring
/v1/analytics/usageGet API usage statistics with filtering by time, model, goal, etc.
// Query parameters
?start_date=2024-12-01
&end_date=2024-12-15
&group_by=model
&include_costs=true
// Response
{
"period": {"start": "2024-12-01", "end": "2024-12-15"},
"total_requests": 125847,
"total_tokens": 89234521,
"total_cost_usd": 1247.56,
"by_model": {
"gpt-5.2": {"requests": 45123, "tokens": 34521000, "cost": 521.34},
"claude-opus-4.5": {"requests": 32456, "tokens": 28900000, "cost": 412.78}
},
"cache_stats": {
"hit_rate": 0.342,
"savings_usd": 186.23
}
}Error Codes
| Code | Status | Description |
|---|---|---|
| 400 | Bad Request | Invalid request parameters |
| 401 | Unauthorized | Invalid or missing API key |
| 429 | Rate Limited | Too many requests |
| 500 | Server Error | Internal server error |
| 503 | Service Unavailable | Service temporarily unavailable |
Rate Limits
Free
60 req/min
10,000 tokens/min
Pro
500 req/min
100,000 tokens/min
Enterprise
Custom
Contact sales
Ready to get started?
Get your API key and integrate in minutes
Was this page helpful?
Let us know how we can improve