{
  "openapi": "3.1.0",
  "info": {
    "title": "DataGo AI Inference API",
    "description": "Unified AI Inference API for Claude, GPT, DeepSeek, Kimi, GLM, Qwen, and Gemini models. 100% compatible with OpenAI and Anthropic SDKs, priced in Indonesian Rupiah (IDR).",
    "version": "1.0.0",
    "contact": {
      "name": "DataGo Support",
      "url": "https://datago.id"
    }
  },
  "servers": [
    {
      "url": "https://api.datago.id/v1",
      "description": "Primary API Server"
    },
    {
      "url": "https://datago.id/v1",
      "description": "Fallback API Server"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyAuth": []
    }
  ],
  "paths": {
    "/chat/completions": {
      "post": {
        "summary": "Create chat completion (OpenAI-compatible)",
        "description": "Generate streaming or non-streaming responses from Claude, GPT, DeepSeek, Kimi, and other supported LLM models.",
        "operationId": "createChatCompletion",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["model", "messages"],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Model ID, e.g. claude-3-5-haiku-20241022, deepseek-v4-flash, gpt-5.6-luna",
                    "example": "deepseek/deepseek-v4-flash"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": ["role", "content"],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": ["system", "user", "assistant", "tool"]
                        },
                        "content": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  },
                  "temperature": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 2,
                    "default": 1
                  },
                  "max_tokens": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful chat completion response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "402": {
            "description": "Insufficient balance"
          }
        }
      }
    },
    "/messages": {
      "post": {
        "summary": "Create message (Anthropic-compatible)",
        "description": "Generate streaming or non-streaming responses using the Anthropic Messages format.",
        "operationId": "createAnthropicMessage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["model", "messages", "max_tokens"],
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "anthropic/haiku-5.5"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": ["role", "content"],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": ["user", "assistant"]
                        },
                        "content": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "max_tokens": {
                    "type": "integer",
                    "default": 4096
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful message response"
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "402": {
            "description": "Insufficient balance"
          }
        }
      }
    },
    "/models": {
      "get": {
        "summary": "List available models",
        "description": "Get a list of all active AI models and their pricing.",
        "operationId": "listModels",
        "responses": {
          "200": {
            "description": "List of models",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "example": "list"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key"
      },
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  }
}
