← Back to Dashboard

📚 API Documentation

OpenAI-compatible API with automatic load balancing and health monitoring

🔐 Authentication

All API requests (except /health) require authentication using an API key. Include your API key in the Authorization header:

Authorization: Bearer your-api-key-here

🌐 Base URL

https://vibeapi.vip

📡 API Endpoints

Health Check

GET

Check the health status of all backend servers

Endpoint: /health
Request Example
curl https://vibeapi.vip/health
Response Example
{
  "servers": [
    {
      "url": "https://backend1.example.com",
      "healthy": true,
      "lastCheck": 1777874496223,
      "responseTime": 1833,
      "consecutiveFailures": 0
    },
    {
      "url": "https://backend2.example.com",
      "healthy": true,
      "lastCheck": 1777874496222,
      "responseTime": 1831,
      "consecutiveFailures": 0
    }
  ],
  "totalServers": 2,
  "healthyServers": 2,
  "lastUpdate": 1777874496223
}

List Models

GET🔒 Auth Required

Get a list of available AI models

Endpoint: /v1/models
Request Example
curl https://vibeapi.vip/v1/models \
  -H "Authorization: Bearer your-api-key-here" \
  -H "Content-Type: application/json"
Response Example
{
  "object": "list",
  "data": [
    {
      "id": "claude-sonnet-4.5",
      "object": "model",
      "created": 1777874512,
      "owned_by": "anthropic",
      "description": "Claude model via Kiro API"
    },
    {
      "id": "claude-haiku-4.5",
      "object": "model",
      "created": 1777874512,
      "owned_by": "anthropic",
      "description": "Claude model via Kiro API"
    }
  ]
}

Chat Completions

POST🔒 Auth Required

Create a chat completion with AI models

Endpoint: /v1/chat/completions
Request Example
curl -X POST https://vibeapi.vip/v1/chat/completions \
  -H "Authorization: Bearer your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4.5",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ],
    "max_tokens": 100
  }'
Response Example
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1777874512,
  "model": "claude-sonnet-4.5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 20,
    "total_tokens": 30
  }
}

Streaming Chat Completions

POST🔒 Auth Required

⚠️ Currently not supported through load balancer. Use backend URLs directly for streaming.

Endpoint: /v1/chat/completions
Request Example
# Streaming through load balancer is not currently supported
# Use backend URL directly for streaming:
curl -N -X POST https://kiro-gateway-production-07e4.up.railway.app/v1/chat/completions \
  -H "Authorization: Bearer your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4.5",
    "messages": [
      {"role": "user", "content": "Tell me a story"}
    ],
    "stream": true,
    "max_tokens": 200
  }'
Response Example
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1777874512,"model":"claude-sonnet-4.5","choices":[{"index":0,"delta":{"role":"assistant","content":"Once"},"finish_reason":null}]}

data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1777874512,"model":"claude-sonnet-4.5","choices":[{"index":0,"delta":{"content":" upon"},"finish_reason":null}]}

data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1777874512,"model":"claude-sonnet-4.5","choices":[{"index":0,"delta":{"content":" a"},"finish_reason":null}]}

data: [DONE]

✨ Features

  • 🔄 Load Balancing: Automatic round-robin distribution across healthy backends
  • 🏥 Health Monitoring: Continuous health checks every 30 seconds
  • 🚀 Auto Failover: Unhealthy servers automatically excluded from rotation
  • 📊 Performance Tracking: Real-time response time monitoring
  • 🔒 Secure: API key authentication and HTTPS encryption
  • 🌐 OpenAI Compatible: Drop-in replacement for OpenAI API

⚠️ Current Limitations

Streaming Not Supported Through Load Balancer

Due to Vercel Serverless Functions limitations, streaming responses (stream: true) are not currently supported through the load balancer.

Workaround: For streaming responses, use the backend URLs directly:

  • Backend 1: https://kiro-gateway-production-07e4.up.railway.app/v1
  • Backend 2: https://kiro-gateway-kiroaccount-pool-a.up.railway.app/v1

Note: Using backend URLs directly bypasses load balancing and automatic failover features.

💻 SDK Examples

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    api_key="your-api-key-here",
    base_url="https://vibeapi.vip/v1"
)

response = client.chat.completions.create(
    model="claude-sonnet-4.5",
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)

print(response.choices[0].message.content)

Node.js (OpenAI SDK)

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'your-api-key-here',
  baseURL: 'https://vibeapi.vip/v1',
});

const response = await client.chat.completions.create({
  model: 'claude-sonnet-4.5',
  messages: [
    { role: 'user', content: 'Hello!' }
  ],
});

console.log(response.choices[0].message.content);

⚠️ Error Codes

Status CodeErrorDescription
401UnauthorizedInvalid or missing API key
503Service UnavailableNo healthy backend servers available
500Internal Server ErrorFailed to forward request to backend