{
  "openapi": "3.1.0",
  "info": {
    "title": "TokLab GPT-5.6 Terra",
    "version": "1.0.0",
    "description": "Core text-generation API. Model-specific optional controls are validated by the serving route. See the online reference for current prices."
  },
  "servers": [
    {
      "url": "https://api.toklab.ai"
    }
  ],
  "paths": {
    "/v1/responses": {
      "post": {
        "summary": "Generate text with GPT-5.6 Terra",
        "operationId": "gpt_5_6_terra_responses",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["model", "input"],
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "gpt-5.6-terra",
                    "description": "Use this model ID or an available model:group ID."
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  },
                  "input": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    ]
                  },
                  "instructions": {
                    "type": "string"
                  },
                  "max_output_tokens": {
                    "type": "integer",
                    "minimum": 1
                  }
                },
                "additionalProperties": true,
                "description": "Core text request. Additional model-specific fields are forwarded and validated by the serving route."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON response, or server-sent events when stream is true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "Gateway or upstream error; inspect HTTP status and response body."
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "summary": "Generate text with GPT-5.6 Terra",
        "operationId": "gpt_5_6_terra_chat_completions",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["model", "messages"],
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "gpt-5.6-terra",
                    "description": "Use this model ID or an available model:group ID."
                  },
                  "messages": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": ["role", "content"],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "system",
                            "user",
                            "assistant",
                            "tool",
                            "developer"
                          ]
                        },
                        "content": {
                          "oneOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": true
                              }
                            }
                          ]
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON response, or server-sent events when stream is true.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "Gateway or upstream error; inspect HTTP status and response body."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      },
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  }
}
