{
  "openapi": "3.1.0",
  "info": {
    "title": "TokLab Claude Opus 4.8",
    "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/messages": {
      "post": {
        "summary": "Generate text with Claude Opus 4.8",
        "operationId": "claude_opus_4_8_messages",
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "anthropic-version",
            "required": true,
            "schema": {
              "type": "string",
              "example": "2023-06-01"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["model", "messages", "max_tokens"],
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "claude-opus-4-8",
                    "description": "Use this model ID or an available model:group ID."
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  },
                  "max_tokens": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "messages": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": ["role", "content"],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": ["user", "assistant"]
                        },
                        "content": {
                          "oneOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": true
                              }
                            }
                          ]
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "system": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      }
                    ]
                  }
                },
                "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 Claude Opus 4.8",
        "operationId": "claude_opus_4_8_chat_completions",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["model", "messages"],
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "claude-opus-4-8",
                    "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"
      }
    }
  }
}
