{
  "openapi": "3.1.0",
  "info": {
    "title": "GPT-5.1 전체 API 레퍼런스",
    "description": "GPT-5.1 채팅 인터페이스의 전체 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": "GPT-5.1 채팅 인터페이스",
        "description": "- OpenAI SDK 형식을 사용하여 GPT-5.1 시리즈 모델 호출\n- 동기 처리 모드, 실시간 응답\n- **사용 가능한 모델**: gpt-5.1 (기본), gpt-5.1-chat (대화 최적화), gpt-5.1-thinking (추론 출력 포함)\n- **텍스트 대화**: 단일 턴 또는 다중 턴 컨텍스트 대화\n- **시스템 프롬프트**: AI 역할 및 동작 사용자 정의\n- **멀티모달 입력**: 텍스트 + 이미지 혼합 입력 지원\n- **도구 호출**: Function Calling 지원\n- **추론 출력**: gpt-5.1-thinking은 사고 과정을 보여주는 reasoning_content 필드를 반환합니다",
        "operationId": "createChatCompletion",
        "tags": [
          "채팅 완성"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              },
              "examples": {
                "simple_text": {
                  "summary": "단일 턴 텍스트 대화",
                  "value": {
                    "model": "gpt-5.1",
                    "messages": [
                      {
                        "role": "user",
                        "content": "Please introduce yourself"
                      }
                    ],
                    "temperature": 1
                  }
                },
                "multi_turn": {
                  "summary": "다중 턴 대화 (컨텍스트 이해)",
                  "value": {
                    "model": "gpt-5.1",
                    "messages": [
                      {
                        "role": "user",
                        "content": "What is Python?"
                      },
                      {
                        "role": "assistant",
                        "content": "Python is a high-level programming language..."
                      },
                      {
                        "role": "user",
                        "content": "What are its advantages?"
                      }
                    ],
                    "temperature": 1
                  }
                },
                "system_prompt": {
                  "summary": "시스템 프롬프트 사용",
                  "value": {
                    "model": "gpt-5.1",
                    "messages": [
                      {
                        "role": "system",
                        "content": "You are a helpful AI assistant. You provide safe, helpful, and accurate answers."
                      },
                      {
                        "role": "user",
                        "content": "What is 1+1?"
                      }
                    ],
                    "temperature": 1
                  }
                },
                "vision": {
                  "summary": "멀티모달 입력 (텍스트 + 이미지)",
                  "value": {
                    "model": "gpt-5.1",
                    "messages": [
                      {
                        "role": "user",
                        "content": [
                          {
                            "type": "text",
                            "text": "Please describe the scene and main elements in this image in detail."
                          },
                          {
                            "type": "image_url",
                            "image_url": {
                              "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
                            }
                          }
                        ]
                      }
                    ],
                    "temperature": 1
                  }
                },
                "tool_use": {
                  "summary": "도구 호출 (Function Calling)",
                  "value": {
                    "model": "gpt-5.1",
                    "messages": [
                      {
                        "role": "user",
                        "content": "What's the weather like in San Francisco?"
                      }
                    ],
                    "tools": [
                      {
                        "type": "function",
                        "function": {
                          "name": "get_weather",
                          "description": "주어진 위치의 현재 날씨를 가져옵니다",
                          "parameters": {
                            "type": "object",
                            "properties": {
                              "location": {
                                "type": "string",
                                "description": "도시 및 주, 예: San Francisco, CA"
                              }
                            },
                            "required": [
                              "location"
                            ]
                          }
                        }
                      }
                    ],
                    "temperature": 1
                  }
                }
              }
            }
          }
        },
        "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": "잘못된 요청 매개변수",
                    "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": "할당량 부족",
                    "type": "insufficient_quota_error",
                    "fallback_suggestion": "https://evolink.ai/dashboard/billing"
                  }
                }
              }
            }
          },
          "429": {
            "description": "랜덤 시드, 범위 `[0, 2147483647]`, 동일한 시드 값을 사용하면 생성 결과를 일관되게 유지할 수 있습니다",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "code": 429,
                    "message": "랜덤 시드, 범위 `[0, 2147483647]`, 동일한 시드 값을 사용하면 생성 결과를 일관되게 유지할 수 있습니다",
                    "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": "내부 서버 오류",
                    "type": "internal_server_error",
                    "fallback_suggestion": "try again later"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ChatCompletionRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "채팅 완료를 위한 모델 이름\n\n- **gpt-5.1**: 일반 작업용 기본 모델\n- **gpt-5.1-chat**: 대화 작업에 최적화\n- **gpt-5.1-thinking**: 사고 과정 출력이 포함된 추론 기능 (reasoning_content 반환)",
            "enum": [
              "gpt-5.1",
              "gpt-5.1-chat",
              "gpt-5.1-thinking"
            ],
            "example": "gpt-5.1"
          },
          "messages": {
            "type": "array",
            "description": "대화를 위한 메시지 목록, 다중 턴 대화 및 멀티모달 입력 지원",
            "items": {
              "$ref": "#/components/schemas/Message"
            },
            "minItems": 1
          },
          "stream": {
            "type": "boolean",
            "description": "응답을 스트리밍할지 여부\n\n- `true`: 스트림 응답, 실시간으로 청크 단위로 내용 반환\n- `false`: 완전한 응답을 기다린 후 한 번에 반환",
            "default": false,
            "example": false
          },
          "max_tokens": {
            "type": "integer",
            "description": "응답에서 생성할 최대 토큰 수",
            "minimum": 1,
            "example": 2000
          },
          "temperature": {
            "type": "number",
            "description": "샘플링 온도, 출력의 무작위성을 제어합니다\n\n- 낮은 값 (예: 0.2): 더 결정적이고 집중된 출력\n- 높은 값 (예: 1.5): 더 무작위적이고 창의적인 출력",
            "minimum": 0,
            "maximum": 2,
            "default": 1,
            "example": 1
          },
          "top_p": {
            "type": "number",
            "description": "Nucleus sampling 매개변수\n\n- 누적 확률을 기반으로 토큰에서 샘플링을 제어합니다\n- 예를 들어, 0.9는 누적 확률 상위 90%의 토큰에서 샘플링하는 것을 의미합니다",
            "minimum": 0,
            "maximum": 1,
            "default": 1,
            "example": 0.9
          },
          "frequency_penalty": {
            "type": "number",
            "description": "빈도 페널티, -2.0에서 2.0 사이의 숫자\n\n- 양수 값은 텍스트에서의 빈도에 따라 새 토큰에 페널티를 부여합니다",
            "minimum": -2,
            "maximum": 2,
            "default": 0,
            "example": 0
          },
          "presence_penalty": {
            "type": "number",
            "description": "존재 페널티, -2.0에서 2.0 사이의 숫자\n\n- 양수 값은 텍스트에 나타나는지 여부에 따라 새 토큰에 페널티를 부여합니다",
            "minimum": -2,
            "maximum": 2,
            "default": 0,
            "example": 0
          },
          "stop": {
            "oneOf": [
              {
                "type": "string",
                "description": "단일 중지 단어"
              },
              {
                "type": "array",
                "description": "중지 단어 목록, 최대 4개",
                "items": {
                  "type": "string"
                },
                "maxItems": 4
              }
            ],
            "description": "중지 시퀀스, 이 시퀀스가 일치하면 생성이 중지됩니다"
          },
          "tools": {
            "type": "array",
            "description": "Function Calling을 위한 도구 목록",
            "items": {
              "$ref": "#/components/schemas/Tool"
            }
          }
        }
      },
      "Message": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "properties": {
          "role": {
            "type": "string",
            "description": "메시지 역할\n\n- `user`: 사용자 메시지\n- `assistant`: AI 어시스턴트 메시지\n- `system`: 시스템 프롬프트",
            "enum": [
              "user",
              "assistant",
              "system"
            ],
            "example": "user"
          },
          "content": {
            "oneOf": [
              {
                "type": "string",
                "description": "일반 텍스트 메시지 내용",
                "example": "Please introduce yourself"
              },
              {
                "type": "array",
                "description": "멀티모달 메시지 내용, 텍스트와 이미지 혼합 입력 지원",
                "items": {
                  "$ref": "#/components/schemas/ContentPart"
                }
              }
            ],
            "description": "메시지 내용"
          }
        }
      },
      "ContentPart": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/TextContent"
          },
          {
            "$ref": "#/components/schemas/ImageContent"
          }
        ]
      },
      "TextContent": {
        "title": "텍스트 내용",
        "type": "object",
        "required": [
          "type",
          "text"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text"
            ],
            "description": "콘텐츠 유형"
          },
          "text": {
            "type": "string",
            "description": "텍스트 내용",
            "example": "Please describe this image in detail"
          }
        }
      },
      "ImageContent": {
        "title": "이미지 콘텐츠",
        "type": "object",
        "required": [
          "type",
          "image_url"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "image_url"
            ],
            "description": "콘텐츠 유형"
          },
          "image_url": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string",
                "format": "uri",
                "description": "이미지 URL 또는 Base64 인코딩\n\n**형식**:\n- URL 형식: `https://example.com/image.png`\n- Base64 형식: `data:image/<format>;base64,<Base64 인코딩>`",
                "example": "data:image/png;base64,iVBORw0KGgo..."
              }
            }
          }
        }
      },
      "Tool": {
        "type": "object",
        "required": [
          "type",
          "function"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "function"
            ],
            "description": "도구 유형"
          },
          "function": {
            "type": "object",
            "required": [
              "name",
              "description",
              "parameters"
            ],
            "properties": {
              "name": {
                "type": "string",
                "description": "함수 이름",
                "example": "get_weather"
              },
              "description": {
                "type": "string",
                "description": "함수 설명",
                "example": "주어진 위치의 현재 날씨를 가져옵니다"
              },
              "parameters": {
                "type": "object",
                "description": "함수 매개변수 정의"
              }
            }
          }
        }
      },
      "ChatCompletionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "채팅 완성의 고유 식별자",
            "example": "chatcmpl-abc123"
          },
          "model": {
            "type": "string",
            "description": "완료에 사용된 모델",
            "example": "gpt-5.1"
          },
          "object": {
            "type": "string",
            "enum": [
              "chat.completion"
            ],
            "description": "응답 유형",
            "example": "chat.completion"
          },
          "created": {
            "type": "integer",
            "description": "완료가 생성된 Unix 타임스탬프",
            "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": "완료가 종료된 이유",
            "enum": [
              "stop",
              "length",
              "tool_calls",
              "content_filter"
            ],
            "example": "stop"
          }
        }
      },
      "AssistantMessage": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "description": "메시지 발신자의 역할",
            "enum": [
              "assistant"
            ],
            "example": "assistant"
          },
          "content": {
            "type": "string",
            "description": "AI의 응답 내용",
            "example": "Hi there! How can I help you?"
          },
          "reasoning_content": {
            "type": "string",
            "description": "추론 과정 내용 (gpt-5.1-thinking 모델에서만 반환)\n\n**참고**:\n- 모델의 사고 및 추론 과정을 보여줍니다\n- 모델이 최종 답변에 도달하는 방법을 이해하는 데 도움이 됩니다",
            "example": "Let me think about this step by step..."
          }
        }
      },
      "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": "오류 유형"
              },
              "fallback_suggestion": {
                "type": "string",
                "description": "오류 처리를 위한 제안"
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "모든 API는 Bearer Token 인증이 필요합니다\n\n**API Key 받기:**\n\n[API Key 관리 페이지](https://evolink.ai/dashboard/keys)를 방문하여 API Key를 받으세요\n\n**요청 헤더에 추가:**\n```\nAuthorization: Bearer YOUR_API_KEY\n```"
      }
    }
  },
  "tags": [
    {
      "name": "채팅 완성",
      "description": "AI 채팅 완료 관련 엔드포인트"
    }
  ]
}