{
  "openapi": "3.1.0",
  "info": {
    "title": "MiniMax-M2.5 전체 API 레퍼런스",
    "description": "MiniMax-M2.5 채팅 인터페이스의 전체 API 레퍼런스",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://direct.evolink.ai",
      "description": "프로덕션 (권장)"
    },
    {
      "url": "https://api.evolink.ai",
      "description": "대체 URL"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "summary": "MiniMax-M2.5 채팅 인터페이스",
        "description": "- OpenAI SDK 형식으로 MiniMax-M2.5 모델 호출\n- 동기 처리 모드, 실시간 응답\n- **텍스트 대화**: 단일 또는 다중 턴 컨텍스트 대화\n- **시스템 프롬프트**: AI 역할 및 동작 사용자 정의",
        "operationId": "createChatCompletion",
        "tags": [
          "채팅 완성"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              },
              "examples": {
                "simple_text": {
                  "summary": "단일 턴 텍스트 대화",
                  "value": {
                    "model": "MiniMax-M2.5",
                    "messages": [
                      {
                        "role": "user",
                        "content": "자기소개를 해주세요"
                      }
                    ]
                  }
                },
                "multi_turn": {
                  "summary": "다중 턴 대화 (컨텍스트 이해)",
                  "value": {
                    "model": "MiniMax-M2.5",
                    "messages": [
                      {
                        "role": "user",
                        "content": "Python이 무엇인가요?"
                      },
                      {
                        "role": "assistant",
                        "content": "Python은 고급 프로그래밍 언어입니다..."
                      },
                      {
                        "role": "user",
                        "content": "장점은 무엇인가요?"
                      }
                    ]
                  }
                },
                "system_prompt": {
                  "summary": "시스템 프롬프트 사용",
                  "value": {
                    "model": "MiniMax-M2.5",
                    "messages": [
                      {
                        "role": "system",
                        "content": "당신은 전문 Python 프로그래밍 어시스턴트입니다. 질문에 간결하게 답변하세요."
                      },
                      {
                        "role": "user",
                        "content": "파일을 어떻게 읽나요?"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "채팅 완성 성공",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                }
              }
            }
          },
          "400": {
            "description": "잘못된 요청 매개변수",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": 400,
                    "message": "Invalid request parameters",
                    "type": "invalid_request_error"
                  }
                }
              }
            }
          },
          "401": {
            "description": "인증되지 않음, 유효하지 않거나 만료된 토큰",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": 401,
                    "message": "Invalid or expired token",
                    "type": "authentication_error"
                  }
                }
              }
            }
          },
          "402": {
            "description": "크레딧 부족, 충전 필요",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": 402,
                    "message": "Insufficient quota",
                    "type": "insufficient_quota_error",
                    "fallback_suggestion": "https://evolink.ai/dashboard/credits"
                  }
                }
              }
            }
          },
          "403": {
            "description": "접근 거부",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": 403,
                    "message": "Access denied for this model",
                    "type": "permission_error",
                    "param": "model"
                  }
                }
              }
            }
          },
          "404": {
            "description": "리소스를 찾을 수 없음",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": 404,
                    "message": "Specified model not found",
                    "type": "not_found_error",
                    "param": "model",
                    "fallback_suggestion": "MiniMax-M2.5"
                  }
                }
              }
            }
          },
          "429": {
            "description": "요청 속도 제한 초과",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": 429,
                    "message": "Rate limit exceeded",
                    "type": "rate_limit_error",
                    "fallback_suggestion": "retry after 60 seconds"
                  }
                }
              }
            }
          },
          "500": {
            "description": "내부 서버 오류",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": 500,
                    "message": "Internal server error",
                    "type": "internal_server_error",
                    "fallback_suggestion": "try again later"
                  }
                }
              }
            }
          },
          "502": {
            "description": "업스트림 서비스 오류",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": 502,
                    "message": "Upstream AI service unavailable",
                    "type": "upstream_error",
                    "fallback_suggestion": "try different model"
                  }
                }
              }
            }
          },
          "503": {
            "description": "서비스 일시적으로 사용 불가",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": 503,
                    "message": "Service temporarily unavailable",
                    "type": "service_unavailable_error",
                    "fallback_suggestion": "retry after 30 seconds"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ChatCompletionRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "채팅 모델 이름",
            "enum": [
              "MiniMax-M2.5"
            ],
            "example": "MiniMax-M2.5"
          },
          "messages": {
            "type": "array",
            "description": "대화 메시지 목록, 다중 턴 대화 지원",
            "items": {
              "$ref": "#/components/schemas/Message"
            },
            "minItems": 1
          },
          "max_tokens": {
            "type": "integer",
            "description": "생성 콘텐츠의 최대 토큰 수, 상한은 2048\n\n**참고**:\n- 상한을 초과하는 콘텐츠는 잘립니다\n- `length` 이유로 생성이 중단된 경우 이 값을 높여보세요",
            "minimum": 1,
            "maximum": 2048,
            "example": 2048
          },
          "stream": {
            "type": "boolean",
            "description": "스트리밍 모드로 응답을 반환할지 여부\n\n- `true`: 스트리밍 응답, 실시간으로 청크 단위로 콘텐츠 반환\n- `false`: 완전한 응답을 기다린 후 반환",
            "example": false
          },
          "temperature": {
            "type": "number",
            "description": "샘플링 온도, 출력의 무작위성 제어\n\n**참고**:\n- 낮은 값(예: 0.1): 더 확정적이고 집중된 출력\n- 높은 값(예: 0.9): 더 무작위적이고 창의적인 출력\n- 범위: (0, 1], 0 제외",
            "exclusiveMinimum": 0,
            "maximum": 1,
            "example": 0.7
          },
          "top_p": {
            "type": "number",
            "description": "Nucleus Sampling 매개변수\n\n**참고**:\n- 누적 확률에서 토큰 샘플링 제어\n- 예: 0.9는 누적 확률 90%에 도달하는 토큰에서 선택을 의미\n- 범위: (0, 1], 0 제외\n\n**권장**: temperature와 top_p를 동시에 조정하지 마세요",
            "exclusiveMinimum": 0,
            "maximum": 1,
            "example": 0.9
          },
          "enable_search": {
            "type": "boolean",
            "description": "웹 검색 활성화 여부\n\n- `true`: 웹 검색 활성화, 모델이 필요에 따라 인터넷에서 최신 정보를 검색합니다\n- `false`: 웹 검색 비활성화",
            "example": true
          },
          "search_options": {
            "type": "object",
            "description": "웹 검색 옵션, `enable_search: true` 필요",
            "properties": {
              "search_strategy": {
                "type": "string",
                "description": "검색 전략\n\n- `turbo`: 빠른 검색, 더 빠른 속도\n- `max`: 심층 검색, 더 포괄적인 결과",
                "enum": [
                  "turbo",
                  "max"
                ],
                "example": "max"
              }
            }
          }
        }
      },
      "Message": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "properties": {
          "role": {
            "type": "string",
            "description": "메시지 역할\n\n- `user`: 사용자 메시지\n- `assistant`: AI 어시스턴트 메시지 (다중 턴 대화용)\n- `system`: 시스템 프롬프트 (AI 역할 및 동작 정의)",
            "enum": [
              "user",
              "assistant",
              "system"
            ],
            "example": "user"
          },
          "content": {
            "type": "string",
            "description": "메시지 내용",
            "example": "자기소개를 해주세요"
          }
        }
      },
      "ChatCompletionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "채팅 완성의 고유 식별자",
            "example": "cmpl-04ea926191a14749b7f2c7a48a68abc6"
          },
          "model": {
            "type": "string",
            "description": "실제 사용된 모델 이름",
            "example": "MiniMax-M2.5"
          },
          "object": {
            "type": "string",
            "enum": [
              "chat.completion"
            ],
            "description": "응답 유형",
            "example": "chat.completion"
          },
          "created": {
            "type": "integer",
            "description": "생성 타임스탬프",
            "example": 1698999496
          },
          "choices": {
            "type": "array",
            "description": "채팅 완성 선택 목록",
            "items": {
              "$ref": "#/components/schemas/Choice"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "Choice": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "description": "선택 인덱스",
            "example": 0
          },
          "message": {
            "$ref": "#/components/schemas/AssistantMessage"
          },
          "finish_reason": {
            "type": "string",
            "description": "완료 이유\n\n- `stop`: 정상 완료\n- `length`: 최대 토큰 제한 도달\n- `content_filter`: 콘텐츠 필터링됨",
            "enum": [
              "stop",
              "length",
              "content_filter"
            ],
            "example": "stop"
          }
        }
      },
      "AssistantMessage": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "description": "메시지 발신자의 역할",
            "enum": [
              "assistant"
            ],
            "example": "assistant"
          },
          "content": {
            "type": "string",
            "description": "AI 응답 메시지 내용",
            "example": "안녕하세요! 무엇을 도와드릴까요?"
          }
        }
      },
      "Usage": {
        "type": "object",
        "description": "토큰 사용 통계",
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "description": "입력 토큰 수",
            "example": 8
          },
          "completion_tokens": {
            "type": "integer",
            "description": "출력 토큰 수",
            "example": 292
          },
          "total_tokens": {
            "type": "integer",
            "description": "총 토큰 수",
            "example": 300
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "integer",
                "description": "HTTP 상태 오류 코드"
              },
              "message": {
                "type": "string",
                "description": "오류 설명"
              },
              "type": {
                "type": "string",
                "description": "오류 유형"
              },
              "param": {
                "type": "string",
                "description": "관련 매개변수 이름"
              },
              "fallback_suggestion": {
                "type": "string",
                "description": "오류 시 제안"
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "##모든 API는 Bearer Token 인증이 필요합니다##\n\n**API 키 받기:**\n\n[API 키 관리 페이지](https://evolink.ai/dashboard/keys)를 방문하여 API 키를 받으세요\n\n**요청 헤더에 추가:**\n```\nAuthorization: Bearer YOUR_API_KEY\n```"
      }
    }
  },
  "tags": [
    {
      "name": "채팅 완성",
      "description": "AI 채팅 완성 관련 엔드포인트"
    }
  ]
}
