Text2Img

Text2Img · GPT Actions

Text2Img api

  • POST /api/codeConvert code to image

    This endpoint converts code to image

  • POST /api/diagramConvert mermaid to image

    This endpoint converts mermaid text to a image

  • POST /api/htmlpreview HTML code with built-in Tailwind CSS

    This endpoint preview HTML code with built-in Tailwind CSS

  • POST /api/mind-mapConvert Markdown to Mind Map

    This endpoint converts markdown text to a mind map

  • POST /api/mobileConvert Markdown to Mobile size image

    This endpoint converts markdown text to a mobile size image

  • POST /api/slideConvert Markdown to Slides

    This endpoint converts markdown text to slides

原始 API 定义
{
  "openapi": "3.1.0",
  "info": {
    "title": "Text2Img api",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://www.text2img.xyz/"
    }
  ],
  "paths": {
    "/api/code": {
      "post": {
        "summary": "Convert code to image",
        "description": "This endpoint converts code to image",
        "operationId": "convertCodeToImage",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "description": "code to be converted",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertCodeToImageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertCodeToImageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized - Authentication credentials were missing or incorrect."
          },
          "429": {
            "description": "Too many requests - Rate limit exceeded."
          },
          "500": {
            "description": "Server error"
          }
        }
      }
    },
    "/api/diagram": {
      "post": {
        "summary": "Convert mermaid to image",
        "description": "This endpoint converts mermaid text to a image",
        "operationId": "convertMermaidToImage",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "description": "mermaid text to be converted",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertMermaidToImageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertMermaidToImageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized - Authentication credentials were missing or incorrect."
          },
          "429": {
            "description": "Too many requests - Rate limit exceeded."
          },
          "500": {
            "description": "Server error"
          }
        }
      }
    },
    "/api/html": {
      "post": {
        "summary": "preview HTML code with built-in Tailwind CSS",
        "description": "This endpoint preview HTML code with built-in Tailwind CSS",
        "operationId": "previewHTML",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "description": "code to be converted",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewHTMLRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreviewHTMLResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized - Authentication credentials were missing or incorrect."
          },
          "429": {
            "description": "Too many requests - Rate limit exceeded."
          },
          "500": {
            "description": "Server error"
          }
        }
      }
    },
    "/api/mind-map": {
      "post": {
        "summary": "Convert Markdown to Mind Map",
        "description": "This endpoint converts markdown text to a mind map",
        "operationId": "convertMarkdownToMindMap",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "description": "Markdown content to be converted",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertMarkdownToMindMapRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertMarkdownToMindMapResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized - Authentication credentials were missing or incorrect."
          },
          "429": {
            "description": "Too many requests - Rate limit exceeded."
          },
          "500": {
            "description": "Server error"
          }
        }
      }
    },
    "/api/mobile": {
      "post": {
        "summary": "Convert Markdown to Mobile size image",
        "description": "This endpoint converts markdown text to a mobile size image",
        "operationId": "convertMarkdownToMobileImage",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "description": "Markdown content to be converted",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertMarkdownToMobileImageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertMarkdownToMobileImageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized - Authentication credentials were missing or incorrect."
          },
          "429": {
            "description": "Too many requests - Rate limit exceeded."
          },
          "500": {
            "description": "Server error"
          }
        }
      }
    },
    "/api/slide": {
      "post": {
        "summary": "Convert Markdown to Slides",
        "description": "This endpoint converts markdown text to slides",
        "operationId": "convertMarkdownToSlides",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "description": "Markdown content to be converted",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertMarkdownToSlidesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertMarkdownToSlidesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized - Authentication credentials were missing or incorrect."
          },
          "429": {
            "description": "Too many requests - Rate limit exceeded."
          },
          "500": {
            "description": "Server error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "schemas": {
      "ConvertCodeToImageRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "description": "the code to be converted"
          },
          "language": {
            "type": "string",
            "description": "the language of the code"
          }
        },
        "required": [
          "content"
        ]
      },
      "ConvertCodeToImageResponse": {
        "type": "object",
        "properties": {
          "link": {
            "type": "string",
            "format": "uri",
            "description": "URL link to the generated image of the code"
          }
        }
      },
      "ConvertMermaidToImageRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "description": "mermaid text content"
          }
        },
        "required": [
          "content"
        ]
      },
      "ConvertMermaidToImageResponse": {
        "type": "object",
        "properties": {
          "link": {
            "type": "string",
            "format": "uri",
            "description": "URL link to the generated image"
          }
        }
      },
      "PreviewHTMLRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "object",
            "properties": {
              "html": {
                "type": "string",
                "description": "the HTML code to be preview"
              },
              "css": {
                "type": "string",
                "description": "the CSS code to be preview"
              },
              "js": {
                "type": "string",
                "description": "the JavaScript code to be run"
              }
            }
          }
        },
        "required": [
          "content"
        ]
      },
      "PreviewHTMLResponse": {
        "type": "object",
        "properties": {
          "link": {
            "type": "string",
            "format": "uri",
            "description": "URL link to the preview the HTML code"
          }
        }
      },
      "ConvertMarkdownToMindMapRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "description": "Markdown text content"
          }
        },
        "required": [
          "content"
        ]
      },
      "ConvertMarkdownToMindMapResponse": {
        "type": "object",
        "properties": {
          "link": {
            "type": "string",
            "format": "uri",
            "description": "URL link to the generated image"
          }
        }
      },
      "ConvertMarkdownToMobileImageRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "description": "Markdown text content"
          }
        },
        "required": [
          "content"
        ]
      },
      "ConvertMarkdownToMobileImageResponse": {
        "type": "object",
        "properties": {
          "link": {
            "type": "string",
            "format": "uri",
            "description": "URL link to the generated image"
          }
        }
      },
      "ConvertMarkdownToSlidesRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "description": "Markdown text content"
          }
        },
        "required": [
          "content"
        ]
      },
      "ConvertMarkdownToSlidesResponse": {
        "type": "object",
        "properties": {
          "link": {
            "type": "string",
            "format": "uri",
            "description": "URL link to the generated slides"
          }
        }
      }
    }
  },
  "tags": []
}