API Reference

SkyAIApp REST API v1.0

Complete API documentation covering authentication, model routing, agent runtime, and enterprise features.

Base URL

Production
https://api.skyaiapp.com/v1

Authentication

All API requests require authentication via API Key in the request header.

Request Header

Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Security 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

POST/v1/route

Intelligently route requests to the optimal model based on goal and strategy.

Request Parameters

ParameterTypeRequiredDescription
messagesarrayArray of messages (OpenAI format)
goalstringOptimization goal: cost | quality | stability
strategystring-Strategy: balanced | cost-optimized | quality-first
streamboolean-Enable streaming response
max_tokensinteger-Maximum tokens to generate
temperaturenumber-Sampling temperature (0-2)
cacheboolean-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
  }
}
GET/v1/models

List 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

POST/v1/agents/run

Execute 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_search

Web search

read_url

Read URL content

write_file

Write file

code_exec

Execute code

calculator

Calculator

image_gen

Image generation

Analytics & Monitoring

GET/v1/analytics/usage

Get 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

CodeStatusDescription
400Bad RequestInvalid request parameters
401UnauthorizedInvalid or missing API key
429Rate LimitedToo many requests
500Server ErrorInternal server error
503Service UnavailableService 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

API Reference | SkyAIApp — SkyAIApp