{
  "openapi": "3.1.0",
  "info": {
    "title": "Token4AI Cloud Model and Files API",
    "version": "2026-09-11",
    "description": "Documented public model and file operations. Core request fields only; vendor-specific options and capability availability depend on the selected model, serving route, scopes and billing group. Not a contract for provider administration, realtime, training or batch execution."
  },
  "servers": [
    {
      "url": "https://api.token4ai.cloud"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "tags": [
          "models"
        ],
        "summary": "listModels",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/models/"
        },
        "x-required-scope": "models.read",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        }
      }
    },
    "/v1/models/{model}": {
      "get": {
        "operationId": "getModel",
        "tags": [
          "models"
        ],
        "summary": "getModel",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/models/"
        },
        "x-required-scope": "models.read",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Exact resource identifier; URL-encode special characters."
          }
        ]
      }
    },
    "/v1/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "tags": [
          "chat-completions"
        ],
        "summary": "createChatCompletion",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/chat-completions/"
        },
        "x-required-scope": "chat.completions",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Choose a model id available to the current API key and billing group. Capability depends on model and route."
                  },
                  "messages": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string"
                        },
                        "content": {
                          "oneOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {}
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "required": [
                  "model",
                  "messages"
                ],
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/v1/responses": {
      "post": {
        "operationId": "createResponse",
        "tags": [
          "responses"
        ],
        "summary": "createResponse",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/responses/"
        },
        "x-required-scope": "responses.create",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Choose a model id available to the current API key and billing group. Capability depends on model and route."
                  },
                  "input": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {}
                      }
                    ]
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  },
                  "store": {
                    "type": "boolean",
                    "description": "Subject to deployment storage policy."
                  },
                  "previous_response_id": {
                    "type": "string"
                  }
                },
                "required": [
                  "model"
                ],
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/v1/responses/{response_id}": {
      "get": {
        "operationId": "getResponse",
        "tags": [
          "responses"
        ],
        "summary": "getResponse",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/responses/"
        },
        "x-required-scope": "responses.create",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "parameters": [
          {
            "name": "response_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Exact resource identifier; URL-encode special characters."
          }
        ]
      },
      "delete": {
        "operationId": "deleteResponse",
        "tags": [
          "responses"
        ],
        "summary": "deleteResponse",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/responses/"
        },
        "x-required-scope": "responses.create",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "parameters": [
          {
            "name": "response_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Exact resource identifier; URL-encode special characters."
          }
        ]
      }
    },
    "/v1/embeddings": {
      "post": {
        "operationId": "createEmbedding",
        "tags": [
          "embeddings-rerank"
        ],
        "summary": "createEmbedding",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/embeddings-rerank/"
        },
        "x-required-scope": "embeddings.create",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Choose a model id available to the current API key and billing group. Capability depends on model and route."
                  },
                  "input": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {}
                      }
                    ]
                  }
                },
                "required": [
                  "model",
                  "input"
                ],
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "operationId": "createMessage",
        "tags": [
          "anthropic"
        ],
        "summary": "createMessage",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/anthropic/"
        },
        "x-required-scope": "messages.create",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          }
        ],
        "parameters": [
          {
            "name": "anthropic-version",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "example": "2023-06-01"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Choose a model id available to the current API key and billing group. Capability depends on model and route."
                  },
                  "messages": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string"
                        },
                        "content": {
                          "oneOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {}
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "max_tokens": {
                    "type": "number"
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  },
                  "system": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "model",
                  "messages"
                ],
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/v1/messages/count_tokens": {
      "post": {
        "operationId": "countMessageTokens",
        "tags": [
          "anthropic"
        ],
        "summary": "countMessageTokens",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/anthropic/"
        },
        "x-required-scope": "messages.create",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "anthropicKey": []
          }
        ],
        "parameters": [
          {
            "name": "anthropic-version",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "example": "2023-06-01"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Choose a model id available to the current API key and billing group. Capability depends on model and route."
                  },
                  "messages": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string"
                        },
                        "content": {
                          "oneOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {}
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "max_tokens": {
                    "type": "number"
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  },
                  "system": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {}
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "model",
                  "messages"
                ],
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/v1beta/models/{model_action}": {
      "post": {
        "operationId": "geminiGenerateContent",
        "tags": [
          "gemini"
        ],
        "summary": "geminiGenerateContent",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/gemini/"
        },
        "x-required-scope": "chat.completions",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "security": [
          {
            "bearerAuth": []
          },
          {
            "geminiKey": []
          }
        ],
        "parameters": [
          {
            "name": "alt",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "sse"
              ]
            },
            "description": "Use sse with streamGenerateContent."
          },
          {
            "name": "model_action",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "For Gemini use MODEL_ID:generateContent or MODEL_ID:streamGenerateContent."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contents": {
                    "type": "array",
                    "items": {}
                  },
                  "systemInstruction": {
                    "type": "object"
                  },
                  "generationConfig": {
                    "type": "object"
                  }
                },
                "required": [
                  "contents"
                ],
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "operationId": "createImage",
        "tags": [
          "multimodal"
        ],
        "summary": "createImage",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/multimodal/"
        },
        "x-required-scope": "images.generate",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Choose a model id available to the current API key and billing group. Capability depends on model and route."
                  },
                  "prompt": {
                    "type": "string",
                    "description": "Nonblank image prompt."
                  },
                  "n": {
                    "type": "number"
                  },
                  "size": {
                    "type": "string"
                  }
                },
                "required": [
                  "model",
                  "prompt"
                ],
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/v1/rerank": {
      "post": {
        "operationId": "createRerank",
        "tags": [
          "embeddings-rerank"
        ],
        "summary": "createRerank",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/embeddings-rerank/"
        },
        "x-required-scope": "embeddings.create",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Choose a model id available to the current API key and billing group. Capability depends on model and route."
                  },
                  "query": {
                    "type": "string",
                    "minLength": 1
                  },
                  "documents": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "text"
                          ],
                          "additionalProperties": true
                        }
                      ]
                    }
                  },
                  "top_n": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "return_documents": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "model",
                  "query",
                  "documents"
                ],
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/v1/audio/transcriptions": {
      "post": {
        "operationId": "createTranscription",
        "tags": [
          "audio"
        ],
        "summary": "createTranscription",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/audio/"
        },
        "x-required-scope": "audio.create",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Choose a model id available to the current API key and billing group. Capability depends on model and route."
                  },
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "language": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "json",
                      "text",
                      "verbose_json",
                      "srt",
                      "vtt"
                    ]
                  },
                  "temperature": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                },
                "required": [
                  "model",
                  "file"
                ],
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/v1/audio/translations": {
      "post": {
        "operationId": "createTranslation",
        "tags": [
          "audio"
        ],
        "summary": "createTranslation",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/audio/"
        },
        "x-required-scope": "audio.create",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Choose a model id available to the current API key and billing group. Capability depends on model and route."
                  },
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "language": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "json",
                      "text",
                      "verbose_json",
                      "srt",
                      "vtt"
                    ]
                  },
                  "temperature": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                },
                "required": [
                  "model",
                  "file"
                ],
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/v1/audio/speech": {
      "post": {
        "operationId": "createSpeech",
        "tags": [
          "audio"
        ],
        "summary": "createSpeech",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/audio/"
        },
        "x-required-scope": "audio.create",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Choose a model id available to the current API key and billing group. Capability depends on model and route."
                  },
                  "input": {
                    "type": "string",
                    "minLength": 1
                  },
                  "voice": {
                    "type": "string"
                  },
                  "response_format": {
                    "type": "string",
                    "enum": [
                      "mp3",
                      "opus",
                      "aac",
                      "flac",
                      "wav",
                      "pcm"
                    ]
                  },
                  "speed": {
                    "type": "number",
                    "minimum": 0.25,
                    "maximum": 4
                  }
                },
                "required": [
                  "model",
                  "input"
                ],
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/v1/files": {
      "get": {
        "operationId": "listFiles",
        "tags": [
          "files"
        ],
        "summary": "listFiles",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/files/"
        },
        "x-required-scope": "assets.read",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        }
      },
      "post": {
        "operationId": "createFile",
        "tags": [
          "files"
        ],
        "summary": "createFile",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/files/"
        },
        "x-required-scope": "assets.write",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "purpose": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                },
                "required": [
                  "purpose",
                  "file"
                ],
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/v1/files/{file_id}": {
      "get": {
        "operationId": "getFile",
        "tags": [
          "files"
        ],
        "summary": "getFile",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/files/"
        },
        "x-required-scope": "assets.read",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Exact resource identifier; URL-encode special characters."
          }
        ]
      },
      "delete": {
        "operationId": "deleteFile",
        "tags": [
          "files"
        ],
        "summary": "deleteFile",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/files/"
        },
        "x-required-scope": "assets.write",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Exact resource identifier; URL-encode special characters."
          }
        ]
      }
    },
    "/v1/files/{file_id}/content": {
      "get": {
        "operationId": "getFileContent",
        "tags": [
          "files"
        ],
        "summary": "getFileContent",
        "externalDocs": {
          "url": "https://docs.token4ai.cloud/en/guides/files/"
        },
        "x-required-scope": "assets.read",
        "responses": {
          "200": {
            "description": "Successful result; response details depend on the operation and model."
          },
          "default": {
            "description": "An error response. Inspect HTTP status, body and x-request-id; follow retry headers if provided."
          }
        },
        "parameters": [
          {
            "name": "file_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Exact resource identifier; URL-encode special characters."
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      },
      "anthropicKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      },
      "geminiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-goog-api-key"
      }
    }
  }
}
