first commit

This commit is contained in:
Beyhan Ogur
2026-05-11 15:08:50 +03:00
commit a408821410
47 changed files with 4670 additions and 0 deletions
+189
View File
@@ -0,0 +1,189 @@
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "optoant",
"email": "admin@optoant.local"
},
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/anthropic/{path}": {
"post": {
"description": "Converts Anthropic Messages API requests to OpenAI format, forwards to OPENAI_BACKEND, and converts the response back to Anthropic format.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"anthropic"
],
"summary": "Anthropic-compatible proxy",
"parameters": [
{
"type": "string",
"description": "Anthropic API path (e.g. v1/messages)",
"name": "path",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"502": {
"description": "Bad Gateway",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/health": {
"get": {
"description": "Returns service health status, database connectivity, and active configuration.",
"produces": [
"application/json"
],
"tags": [
"health"
],
"summary": "Health check",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.HealthResponse"
}
}
}
}
},
"/v1/{path}": {
"post": {
"description": "Forwards any /v1/* request to the configured OpenAI-compatible backend (e.g. DeepSeek).",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"openai"
],
"summary": "OpenAI-compatible proxy",
"parameters": [
{
"type": "string",
"description": "OpenAI API path (e.g. chat/completions)",
"name": "path",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"502": {
"description": "Bad Gateway",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
},
"definitions": {
"handlers.HealthResponse": {
"type": "object",
"properties": {
"config": {
"type": "object",
"properties": {
"openai_backend": {
"type": "string"
},
"port": {
"type": "string"
}
}
},
"database": {
"type": "string"
},
"status": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "localhost:8000",
BasePath: "/",
Schemes: []string{},
Title: "LLM Gateway API",
Description: "OpenAI-compatible and Anthropic-compatible LLM proxy/gateway with Bifrost mapping.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}