Unlimited Abilities

Unlimited Abilities · GPT 작업

Generate Content API

API for generating content using the generativelanguage.googleapis.com service

  • POST /generateContentGenerate content
원본 API 스키마
{
  "openapi": "3.0.0",
  "info": {
    "title": "Generate Content API",
    "version": "1.0.0",
    "description": "API for generating content using the generativelanguage.googleapis.com service"
  },
  "servers": [
    {
      "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.0-pro:generateContent"
    }
  ],
  "paths": {
    "/generateContent": {
      "post": {
        "summary": "Generate content",
        "operationId": "generateContent",
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "YOUR_API_KEY"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contents": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "parts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "text": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "generationConfig": {
                    "type": "object",
                    "properties": {
                      "temperature": {
                        "type": "number"
                      },
                      "topK": {
                        "type": "integer"
                      },
                      "topP": {
                        "type": "integer"
                      },
                      "maxOutputTokens": {
                        "type": "integer"
                      },
                      "stopSequences": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "safetySettings": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "category": {
                          "type": "string"
                        },
                        "threshold": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "contents": [
                    {
                      "parts": [
                        {
                          "text": "input: what is he best a.i. in the world"
                        },
                        {
                          "text": "output: "
                        }
                      ]
                    }
                  ],
                  "generationConfig": {
                    "temperature": 0.9,
                    "topK": 1,
                    "topP": 1,
                    "maxOutputTokens": 2048,
                    "stopSequences": []
                  },
                  "safetySettings": [
                    {
                      "category": "HARM_CATEGORY_HARASSMENT",
                      "threshold": "BLOCK_MEDIUM_AND_ABOVE"
                    },
                    {
                      "category": "HARM_CATEGORY_HATE_SPEECH",
                      "threshold": "BLOCK_MEDIUM_AND_ABOVE"
                    },
                    {
                      "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
                      "threshold": "BLOCK_MEDIUM_AND_ABOVE"
                    },
                    {
                      "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
                      "threshold": "BLOCK_MEDIUM_AND_ABOVE"
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Content generated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "generatedText": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request"
          },
          "500": {
            "description": "Server error"
          }
        }
      }
    }
  }
}