{
  "openapi": "3.1.0",
  "info": {
    "title": "Runware API - GLM-5.1",
    "summary": "Flagship agentic coding model with 200K context, deep thinking, and long-horizon task execution",
    "description": "GLM-5.1 is Z.ai’s flagship language model for agentic engineering, coding, reasoning, and tool-driven workflows. It supports a 200K token context window with up to 128K output tokens, deep thinking, function calling, structured output, and streaming tool calls, and is designed to stay effective over long multi-step sessions rather than only short-horizon tasks.",
    "version": "1.0.0",
    "x-model-id": "zai-glm-5-1",
    "x-air-id": "zai:glm@5.1",
    "x-status": "coming-soon",
    "x-creator": {
      "id": "zai",
      "name": "Z.ai",
      "logo": "https://assets.runware.ai/fa229a51-5cf8-4d1b-be22-a89f9645573c.png"
    },
    "x-capabilities": [
      "text-to-text"
    ],
    "x-released-at": "2026-04-07T00:00:00Z",
    "x-cover-image": "https://assets.runware.ai/014ae69a-a188-4879-abf4-d80d9d0ec68c.jpeg"
  },
  "servers": [
    {
      "url": "https://api.runware.ai/v1",
      "description": "Runware REST API"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Runware API Key (e.g., Bearer <your-key>)"
      }
    },
    "schemas": {
      "AuthenticationTask": {
        "title": "Authentication",
        "description": "Authenticates a connection using an API key. Can be sent as the first element of the request array as an alternative to using the Authorization header.",
        "type": "object",
        "x-response-schema": "https://schemas.runware.ai/responses/utilities/authentication.json",
        "properties": {
          "taskType": {
            "const": "authentication",
            "title": "Task Type",
            "description": "The type of task to perform."
          },
          "apiKey": {
            "title": "API Key",
            "description": "Your Runware API key.",
            "type": "string"
          },
          "connectionSessionUUID": {
            "title": "Connection Session UUID",
            "description": "Optional session UUID to resume a previous connection and receive any buffered results.",
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "taskType",
          "apiKey"
        ],
        "additionalProperties": false
      },
      "RequestBody": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "model": {
              "title": "Model",
              "description": "Identifier of the model to use for generation.",
              "type": "string",
              "const": "zai:glm@5.1"
            },
            "seed": {
              "title": "Seed",
              "description": "Random seed for reproducible generation. When not provided, a random seed is generated in the unsigned 32-bit range.",
              "type": "integer",
              "minimum": 0,
              "maximum": 9223372036854776000
            },
            "settings": {
              "title": "Settings",
              "description": "Global inference settings.",
              "type": "object",
              "properties": {
                "systemPrompt": {
                  "title": "System Prompt",
                  "description": "System-level instruction that guides the model's behavior and output style across the entire generation.",
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200000
                },
                "temperature": {
                  "title": "Temperature",
                  "description": "Controls randomness in generation. Lower values produce more deterministic outputs, higher values increase variation and creativity.",
                  "type": "number",
                  "multipleOf": 0.01,
                  "minimum": 0,
                  "maximum": 1,
                  "default": 1
                },
                "topP": {
                  "title": "Top-P",
                  "description": "Nucleus sampling parameter that controls diversity by limiting the probability mass. Lower values make outputs more focused, higher values increase diversity.",
                  "type": "number",
                  "multipleOf": 0.01,
                  "minimum": 0.01,
                  "maximum": 1
                },
                "frequencyPenalty": {
                  "title": "Frequency Penalty",
                  "description": "Penalizes tokens based on their frequency in the output so far. A value of 0.0 disables the penalty.",
                  "type": "number",
                  "multipleOf": 0.01,
                  "minimum": -2,
                  "maximum": 2
                },
                "maxTokens": {
                  "title": "Max Tokens",
                  "description": "Maximum number of tokens to generate in the response.",
                  "type": "integer",
                  "minimum": 1,
                  "default": 4096,
                  "maximum": 131072
                },
                "presencePenalty": {
                  "title": "Presence Penalty",
                  "description": "Encourages the model to introduce new topics. A value of 0.0 disables the penalty.",
                  "type": "number",
                  "multipleOf": 0.01,
                  "minimum": -2,
                  "maximum": 2
                },
                "stopSequences": {
                  "title": "Stop Sequences",
                  "description": "Array of sequences that will cause the model to stop generating further tokens when encountered.",
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 50
                  },
                  "maxItems": 5
                },
                "thinkingLevel": {
                  "title": "Thinking Level",
                  "description": "Controls the depth of internal reasoning the model performs before generating a response.",
                  "type": "string",
                  "enum": [
                    "none",
                    "low",
                    "medium",
                    "high"
                  ],
                  "default": "none"
                },
                "toolChoice": {
                  "title": "Tool Choice",
                  "description": "Controls how the model selects which tool to call.",
                  "type": "object",
                  "properties": {
                    "type": {
                      "title": "Type",
                      "description": "Tool selection strategy.",
                      "type": "string",
                      "oneOf": [
                        {
                          "const": "auto",
                          "description": "Model decides whether to call a tool."
                        },
                        {
                          "const": "any",
                          "description": "Model must call at least one tool."
                        },
                        {
                          "const": "tool",
                          "description": "Model must call the specified tool."
                        },
                        {
                          "const": "none",
                          "description": "Model must not call any tool."
                        }
                      ]
                    },
                    "name": {
                      "title": "Name",
                      "description": "Name of the tool to call.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false
                },
                "tools": {
                  "title": "Tools",
                  "description": "Function definitions available for the model to call. Each tool is a JSON Schema object describing the function signature.",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": false
                  }
                },
                "topK": {
                  "title": "Top-K",
                  "description": "Top-K sampling parameter that limits the number of highest-probability tokens considered at each step.",
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 100647
                }
              },
              "additionalProperties": false
            },
            "messages": {
              "title": "Messages",
              "description": "Array of chat messages forming the conversation context.",
              "type": "array",
              "minItems": 1,
              "items": {
                "title": "Message",
                "description": "A single chat message with a role and content.",
                "type": "object",
                "properties": {
                  "role": {
                    "title": "Role",
                    "description": "The role of the message author.",
                    "type": "string",
                    "enum": [
                      "user",
                      "assistant"
                    ]
                  },
                  "content": {
                    "title": "Content",
                    "description": "The text content of the message.",
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "role",
                  "content"
                ],
                "additionalProperties": false
              }
            },
            "taskType": {
              "title": "Task Type",
              "description": "Identifier for the type of task being performed",
              "type": "string",
              "const": "textInference"
            },
            "taskUUID": {
              "title": "Task UUID",
              "description": "UUID v4 identifier for tracking tasks and matching async responses. Must be unique per task.",
              "type": "string",
              "format": "uuid"
            },
            "webhookURL": {
              "title": "Webhook URL",
              "description": "Specifies a webhook URL where JSON responses will be sent via HTTP POST when generation tasks complete. For batch requests with multiple results, each completed item triggers a separate webhook call as it becomes available.",
              "type": "string",
              "format": "uri"
            },
            "includeCost": {
              "title": "Include Cost",
              "description": "Include task cost in the response.",
              "type": "boolean",
              "default": false
            },
            "deliveryMethod": {
              "title": "Delivery Method",
              "description": "Determines how the API delivers task results.",
              "type": "string",
              "oneOf": [
                {
                  "const": "sync",
                  "description": "Returns complete results directly in the API response."
                },
                {
                  "const": "async",
                  "description": "Returns an immediate acknowledgment with the task UUID. Poll for results using getResponse."
                },
                {
                  "const": "stream",
                  "description": "Streams results token-by-token as they are generated."
                }
              ],
              "default": "sync"
            },
            "numberResults": {
              "title": "Number of Results",
              "description": "Number of results to generate. Each result uses a different seed, producing variations of the same parameters.",
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "maximum": 4
            },
            "includeUsage": {
              "title": "Include Usage",
              "description": "Include token usage statistics in the response.",
              "type": "boolean",
              "default": false
            }
          },
          "additionalProperties": false,
          "required": [
            "taskType",
            "taskUUID",
            "model",
            "messages"
          ]
        },
        "description": "You must always POST an array of task objects."
      },
      "ResponseBody": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "Unknown response structure"
            }
          }
        }
      },
      "ErrorResponse": {
        "title": "Error Response",
        "description": "Standard error response returned by the Runware API.",
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "code",
                "message"
              ],
              "additionalProperties": true,
              "properties": {
                "code": {
                  "type": "string",
                  "description": "A short identifier for the error (e.g., invalidApiKey, timeoutProvider)."
                },
                "message": {
                  "type": "string",
                  "description": "A human-readable explanation of what went wrong."
                },
                "parameter": {
                  "type": "string",
                  "description": "The request parameter related to the error, if applicable."
                },
                "taskType": {
                  "type": "string",
                  "description": "The task type of the request that failed."
                },
                "taskUUID": {
                  "type": "string",
                  "description": "The unique identifier of the failed request."
                },
                "documentation": {
                  "type": "string",
                  "description": "A link to relevant documentation."
                }
              }
            }
          }
        },
        "required": [
          "errors"
        ],
        "additionalProperties": false
      }
    }
  },
  "paths": {
    "/": {
      "post": {
        "summary": "Run GLM-5.1",
        "description": "GLM-5.1 is Z.ai’s flagship language model for agentic engineering, coding, reasoning, and tool-driven workflows. It supports a 200K token context window with up to 128K output tokens, deep thinking, function calling, structured output, and streaming tool calls, and is designed to stay effective over long multi-step sessions rather than only short-horizon tasks.",
        "operationId": "run_zai_glm_5_1",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseBody"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request — Missing or invalid parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — No valid API key provided.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required — Insufficient account balance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — The API key lacks permissions for this request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests — Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server Error — Something went wrong on Runware's end.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable — Temporarily unavailable (maintenance or capacity).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "apiKeyAuth": []
    }
  ]
}