{
  "openapi": "3.1.0",
  "info": {
    "title": "Inception API",
    "version": "1.0.0",
    "description": "Inception Labs LLM API — chat, FIM, and edit completions powered by Mercury diffusion language models. OpenAI-compatible request/response shapes with extensions for diffusion-specific features.",
    "contact": {
      "name": "Inception Labs",
      "url": "https://docs.inceptionlabs.ai",
      "email": "support@inceptionlabs.ai"
    },
    "license": {
      "name": "Proprietary"
    },
    "x-logo": {
      "url": "https://docs.inceptionlabs.ai/logo.png"
    }
  },
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "summary": "Create a chat completion",
        "operationId": "createChatCompletion",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              },
              "example": {
                "model": "mercury-2",
                "messages": [
                  {
                    "role": "user",
                    "content": "What is a diffusion language model?"
                  }
                ],
                "max_tokens": 256,
                "temperature": 0.75
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful response. Returns a JSON object when `stream=false`, or a server-sent events stream of `ChatCompletionChunk` objects (terminated by `data: [DONE]`) when `stream=true`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                },
                "example": {
                  "id": "chatcmpl-7a2b3c4d5e",
                  "object": "chat.completion",
                  "created": 1745798400,
                  "model": "mercury-2",
                  "choices": [
                    {
                      "index": 0,
                      "finish_reason": "stop",
                      "message": {
                        "role": "assistant",
                        "content": "A diffusion language model is a type of language model that uses diffusion to generate text."
                      }
                    }
                  ],
                  "usage": {
                    "prompt_tokens": 12,
                    "completion_tokens": 8,
                    "total_tokens": 20,
                    "reasoning_tokens": 0,
                    "cached_input_tokens": 0
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionChunk"
                },
                "x-stainless-stream-type": "sse",
                "x-stainless-stream-event-schema": {
                  "$ref": "#/components/schemas/ChatCompletionChunk"
                },
                "x-stainless-stream-terminator": "[DONE]"
              }
            }
          },
          "400": {
            "description": "Bad Request — invalid parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "You exceeded the maximum context length for this model of 128000. Please reduce the length of the messages or completion.",
                    "type": "invalid_request_error",
                    "param": "messages",
                    "code": "context_length_exceeded"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided",
                    "type": "authentication_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required — billing inactive or quota exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Account is inactive",
                    "type": "account_error",
                    "param": null,
                    "code": "account_error"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found — model not available for this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "model `jupyter-2` not found",
                    "type": "invalid_request_error",
                    "param": "model",
                    "code": "model_not_found"
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests — rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Rate limit exceeded. Please try again later.",
                    "type": "rate_limit_error",
                    "param": null,
                    "code": "rate_limit_reached"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "The server had an error while processing your request.",
                    "type": "server_error",
                    "param": null,
                    "code": "server_error"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "tags": [
          "Chat"
        ],
        "description": "Generate a chat completion from a sequence of messages. Returns a `ChatCompletion` object, or a server-sent events stream of `ChatCompletionChunk` deltas when `stream=true`. Supports tool calling, structured output via `response_format`, and reasoning controls."
      }
    },
    "/v1/fim/completions": {
      "post": {
        "summary": "Create a fill-in-the-middle completion",
        "description": "Generate a code completion given a `prompt` (prefix) and optional `suffix`. Designed for IDE-style inline completion. Returns a `FimCompletion` object, or a server-sent events stream of `FimCompletionChunk` deltas when `stream=true`. Tool calling and function calling are not supported.",
        "operationId": "createFimCompletion",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FIMCompletionRequest"
              },
              "example": {
                "model": "mercury-edit-2",
                "prompt": "def fibonacci(n: int) -> int:\n    if n <= 1:\n        return n\n    return ",
                "suffix": "\n\nprint(fibonacci(10))\n",
                "max_tokens": 256
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful response. Returns a JSON object when `stream=false`, or a server-sent events stream of `TextCompletionChunk` objects (terminated by `data: [DONE]`) when `stream=true`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FIMCompletionResponse"
                },
                "example": {
                  "id": "cmpl-7a2b3c4d5e",
                  "object": "text_completion",
                  "created": 1745798400,
                  "model": "mercury-edit-2",
                  "choices": [
                    {
                      "index": 0,
                      "finish_reason": "stop",
                      "text": "fibonacci(n - 1) + fibonacci(n - 2)"
                    }
                  ],
                  "usage": {
                    "prompt_tokens": 24,
                    "completion_tokens": 14,
                    "total_tokens": 38,
                    "reasoning_tokens": 0,
                    "cached_input_tokens": 0
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "$ref": "#/components/schemas/TextCompletionChunk"
                },
                "x-stainless-stream-type": "sse",
                "x-stainless-stream-event-schema": {
                  "$ref": "#/components/schemas/TextCompletionChunk"
                },
                "x-stainless-stream-terminator": "[DONE]"
              }
            }
          },
          "400": {
            "description": "Bad Request — invalid parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "You exceeded the maximum context length for this model of 128000. Please reduce the length of the messages or completion.",
                    "type": "invalid_request_error",
                    "param": "messages",
                    "code": "context_length_exceeded"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided",
                    "type": "authentication_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required — billing inactive or quota exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Account is inactive",
                    "type": "account_error",
                    "param": null,
                    "code": "account_error"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found — model not available for this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "model `jupyter-2` not found",
                    "type": "invalid_request_error",
                    "param": "model",
                    "code": "model_not_found"
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests — rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Rate limit exceeded. Please try again later.",
                    "type": "rate_limit_error",
                    "param": null,
                    "code": "rate_limit_reached"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "The server had an error while processing your request.",
                    "type": "server_error",
                    "param": null,
                    "code": "server_error"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "tags": [
          "FIM"
        ]
      }
    },
    "/v1/edit/completions": {
      "post": {
        "summary": "Create a code edit completion",
        "description": "Generate an edit to a code region given the surrounding context. The request must contain a single user message whose content includes the required edit prompt tags (e.g. `<|code_to_edit|>`, `<|cursor|>`, `<|current_file_content|>`). Returns an `EditCompletion` object. Streaming and tool calling are not supported on this endpoint.",
        "operationId": "createEditCompletion",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EditCompletionRequest"
              },
              "example": {
                "model": "mercury-edit-2",
                "messages": [
                  {
                    "role": "user",
                    "content": "<|recently_viewed_code_snippets|>\n<|/recently_viewed_code_snippets|>\n<|edit_diff_history|>\n<|/edit_diff_history|>\n<|current_file_content|>\ndef greet(name):\n    print(\"hi\")\n<|/current_file_content|>\n<|code_to_edit|>\ndef greet(name):\n    print(\"hi\")<|cursor|>\n<|/code_to_edit|>"
                  }
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EditCompletionResponse"
                },
                "example": {
                  "id": "cmpl-7a2b3c4d5e",
                  "object": "edit.completion",
                  "created": 1745798400,
                  "model": "mercury-edit-2",
                  "choices": [
                    {
                      "index": 0,
                      "finish_reason": "stop",
                      "message": {
                        "role": "assistant",
                        "content": "def greet(name):\n    print(f\"hi {name}\")\n"
                      }
                    }
                  ],
                  "usage": {
                    "prompt_tokens": 156,
                    "completion_tokens": 18,
                    "total_tokens": 174,
                    "reasoning_tokens": 0,
                    "cached_input_tokens": 0
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request — invalid parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "You exceeded the maximum context length for this model of 128000. Please reduce the length of the messages or completion.",
                    "type": "invalid_request_error",
                    "param": "messages",
                    "code": "context_length_exceeded"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided",
                    "type": "authentication_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required — billing inactive or quota exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Account is inactive",
                    "type": "account_error",
                    "param": null,
                    "code": "account_error"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found — model not available for this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "model `jupyter-2` not found",
                    "type": "invalid_request_error",
                    "param": "model",
                    "code": "model_not_found"
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests — rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Rate limit exceeded. Please try again later.",
                    "type": "rate_limit_error",
                    "param": null,
                    "code": "rate_limit_reached"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "The server had an error while processing your request.",
                    "type": "server_error",
                    "param": null,
                    "code": "server_error"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "tags": [
          "Edit"
        ]
      }
    },
    "/v1/models": {
      "get": {
        "summary": "List available models",
        "description": "List the models currently available through the API.",
        "operationId": "listModels",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelsResponse"
                },
                "example": {
                  "data": [
                    {
                      "id": "mercury-2",
                      "name": "Inception: Mercury 2",
                      "created": 1745798400,
                      "description": "Mercury 2 diffusion language model for chat completions.",
                      "input_modalities": [
                        "text"
                      ],
                      "output_modalities": [
                        "text"
                      ],
                      "context_length": 128000,
                      "max_output_length": 50000,
                      "pricing": {
                        "prompt": "0.00000025",
                        "completion": "0.00000075",
                        "input_cache_reads": "0.000000025",
                        "input_cache_writes": "0"
                      },
                      "supported_sampling_parameters": [
                        "temperature",
                        "stop"
                      ],
                      "supported_features": [
                        "tools",
                        "json_mode",
                        "structured_outputs"
                      ],
                      "openrouter": {
                        "slug": "inception/mercury-2"
                      },
                      "datacenters": [
                        {
                          "country_code": "US"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided",
                    "type": "authentication_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "The server had an error while processing your request.",
                    "type": "server_error",
                    "param": null,
                    "code": "server_error"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "tags": [
          "Models"
        ]
      }
    },
    "/v1/chat/completions/models": {
      "get": {
        "summary": "List chat models",
        "description": "List models available for chat completions.",
        "operationId": "listChatModels",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelsResponse"
                },
                "example": {
                  "data": [
                    {
                      "id": "mercury-2",
                      "name": "Inception: Mercury 2",
                      "created": 1745798400,
                      "description": "Mercury 2 diffusion language model for chat completions.",
                      "input_modalities": [
                        "text"
                      ],
                      "output_modalities": [
                        "text"
                      ],
                      "context_length": 128000,
                      "max_output_length": 50000,
                      "pricing": {
                        "prompt": "0.00000025",
                        "completion": "0.00000075",
                        "input_cache_reads": "0.000000025",
                        "input_cache_writes": "0"
                      },
                      "supported_sampling_parameters": [
                        "temperature",
                        "stop"
                      ],
                      "supported_features": [
                        "tools",
                        "json_mode",
                        "structured_outputs"
                      ],
                      "openrouter": {
                        "slug": "inception/mercury-2"
                      },
                      "datacenters": [
                        {
                          "country_code": "US"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided",
                    "type": "authentication_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "The server had an error while processing your request.",
                    "type": "server_error",
                    "param": null,
                    "code": "server_error"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "tags": [
          "Models"
        ]
      }
    },
    "/v1/fim/completions/models": {
      "get": {
        "summary": "List FIM models",
        "description": "List models available for fill-in-the-middle completions.",
        "operationId": "listFIMModels",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelsResponse"
                },
                "example": {
                  "data": [
                    {
                      "id": "mercury-edit-2",
                      "name": "Inception: Mercury Edit 2",
                      "created": 1745798400,
                      "description": "Mercury Edit 2 for code edit completions and fill-in-the-middle code completions.",
                      "input_modalities": [
                        "text"
                      ],
                      "output_modalities": [
                        "text"
                      ],
                      "context_length": 128000,
                      "max_output_length": 32000,
                      "pricing": {
                        "prompt": "0.00000025",
                        "completion": "0.00000075",
                        "input_cache_reads": "0.000000025",
                        "input_cache_writes": "0"
                      },
                      "supported_sampling_parameters": [
                        "temperature",
                        "stop"
                      ],
                      "supported_features": [],
                      "openrouter": {
                        "slug": "inception/mercury-edit-2"
                      },
                      "datacenters": [
                        {
                          "country_code": "US"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided",
                    "type": "authentication_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "The server had an error while processing your request.",
                    "type": "server_error",
                    "param": null,
                    "code": "server_error"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "tags": [
          "Models"
        ]
      }
    },
    "/v1/edit/completions/models": {
      "get": {
        "summary": "List Edit models",
        "description": "List models available for edit completions.",
        "operationId": "listEditModels",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelsResponse"
                },
                "example": {
                  "data": [
                    {
                      "id": "mercury-edit-2",
                      "name": "Inception: Mercury Edit 2",
                      "created": 1745798400,
                      "description": "Mercury Edit 2 for code edit completions and fill-in-the-middle code completions.",
                      "input_modalities": [
                        "text"
                      ],
                      "output_modalities": [
                        "text"
                      ],
                      "context_length": 128000,
                      "max_output_length": 32000,
                      "pricing": {
                        "prompt": "0.00000025",
                        "completion": "0.00000075",
                        "input_cache_reads": "0.000000025",
                        "input_cache_writes": "0"
                      },
                      "supported_sampling_parameters": [
                        "temperature",
                        "stop"
                      ],
                      "supported_features": [],
                      "openrouter": {
                        "slug": "inception/mercury-edit-2"
                      },
                      "datacenters": [
                        {
                          "country_code": "US"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided",
                    "type": "authentication_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": {
                    "message": "The server had an error while processing your request.",
                    "type": "server_error",
                    "param": null,
                    "code": "server_error"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "tags": [
          "Models"
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "ChatCompletionRequest": {
        "properties": {
          "messages": {
            "items": {
              "$ref": "#/components/schemas/Message"
            },
            "type": "array",
            "title": "Messages"
          },
          "model": {
            "type": "string",
            "title": "Model",
            "description": "The model to use for the chat completion."
          },
          "max_tokens": {
            "type": "integer",
            "title": "Max Tokens",
            "description": "Maximum number of tokens to generate.",
            "minimum": 1,
            "maximum": 50000,
            "default": 16384
          },
          "temperature": {
            "type": "number",
            "title": "Temperature",
            "description": "What sampling temperature to use, between 0.5 and 1. Higher values make the output more random; lower values make it more focused and deterministic. Values outside this range are reset to 0.75 and a `warning` is returned in the response.",
            "default": 0.75,
            "minimum": 0.5,
            "maximum": 1
          },
          "stop": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Stop",
            "description": "A list of sequences where the API will stop generating further tokens. The returned text will not contain the stop sequences."
          },
          "tools": {
            "type": "array",
            "title": "Tools",
            "description": "A list of tools the model may call. Use this to provide functions the model can generate JSON arguments for.",
            "items": {
              "$ref": "#/components/schemas/ChatCompletionTool"
            }
          },
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "description": "Whether to stream the response.",
            "default": false
          },
          "stream_options": {
            "$ref": "#/components/schemas/StreamOptions",
            "description": "Options that control streaming behavior."
          },
          "diffusing": {
            "type": "boolean",
            "title": "Diffusing",
            "description": "Whether to show the diffusion effect in the streamed response.",
            "default": false
          },
          "extra_body": {
            "additionalProperties": true,
            "type": "object",
            "title": "Extra Body",
            "description": "Extra parameters passed to the model (OpenAI-compat passthrough).",
            "x-stainless-param": "extra_params"
          },
          "realtime": {
            "type": "boolean",
            "title": "Realtime",
            "description": "Enable flag for more realtime workloads that require lower TTFT/TTFAT.",
            "default": false
          },
          "response_format": {
            "title": "Response Format",
            "description": "An object specifying the format that the model must output.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/ResponseFormatText"
              },
              {
                "$ref": "#/components/schemas/ResponseFormatJSONObject"
              },
              {
                "$ref": "#/components/schemas/ResponseFormatJSONSchema"
              }
            ]
          },
          "reasoning_summary": {
            "type": "boolean",
            "title": "Reasoning Summary",
            "description": "Request a summary of the model's reasoning process.",
            "default": false
          },
          "reasoning_summary_wait": {
            "type": "boolean",
            "title": "Reasoning Summary Wait",
            "description": "Wait for all reasoning summaries to complete before finishing the response.",
            "default": false
          },
          "reasoning_effort": {
            "type": "string",
            "title": "Reasoning Effort",
            "description": "Constrains the effort spent on reasoning before the model responds.",
            "enum": [
              "instant",
              "low",
              "medium",
              "high"
            ],
            "default": "medium"
          }
        },
        "type": "object",
        "required": [
          "messages",
          "model"
        ],
        "title": "ChatCompletionRequest"
      },
      "ChatCompletionResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "object": {
            "type": "string",
            "const": "chat.completion",
            "title": "Object",
            "default": "chat.completion"
          },
          "created": {
            "type": "integer",
            "title": "Created"
          },
          "model": {
            "type": "string",
            "title": "Model"
          },
          "choices": {
            "items": {
              "$ref": "#/components/schemas/Choice"
            },
            "type": "array",
            "title": "Choices"
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          },
          "warning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Warning"
          },
          "reasoning_summary": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ReasoningSummary"
              },
              {
                "type": "null"
              }
            ],
            "description": "Summary of reasoning process if requested and available."
          }
        },
        "type": "object",
        "required": [
          "id",
          "created",
          "model",
          "choices",
          "usage",
          "object"
        ],
        "title": "ChatCompletionResponse",
        "example": {
          "id": "chatcmpl-7a2b3c4d5e",
          "object": "chat.completion",
          "created": 1745798400,
          "model": "mercury-2",
          "choices": [
            {
              "index": 0,
              "finish_reason": "stop",
              "message": {
                "role": "assistant",
                "content": "A diffusion language model is a type of language model that uses diffusion to generate text."
              }
            }
          ],
          "usage": {
            "prompt_tokens": 12,
            "completion_tokens": 8,
            "total_tokens": 20,
            "reasoning_tokens": 0,
            "cached_input_tokens": 0
          }
        }
      },
      "Choice": {
        "properties": {
          "index": {
            "type": "integer",
            "title": "Index"
          },
          "message": {
            "$ref": "#/components/schemas/Message"
          },
          "finish_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "stop",
              "length",
              "tool_calls",
              "content_filter",
              null
            ],
            "description": "The reason the model stopped generating tokens."
          }
        },
        "type": "object",
        "required": [
          "index",
          "message",
          "finish_reason"
        ],
        "title": "Choice"
      },
      "DataCenter": {
        "properties": {
          "country_code": {
            "type": "string",
            "title": "Country Code",
            "description": "ISO 3166 Alpha-2 country code."
          }
        },
        "type": "object",
        "required": [
          "country_code"
        ],
        "title": "DataCenter",
        "description": "Datacenter location information."
      },
      "EditChoice": {
        "properties": {
          "index": {
            "type": "integer",
            "title": "Index"
          },
          "message": {
            "$ref": "#/components/schemas/EditMessage"
          },
          "finish_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "stop",
              "length",
              "content_filter",
              null
            ],
            "description": "The reason the model stopped generating tokens."
          }
        },
        "type": "object",
        "required": [
          "index",
          "message",
          "finish_reason"
        ],
        "title": "EditChoice",
        "description": "Choice for edit completions."
      },
      "EditCompletionRequest": {
        "properties": {
          "messages": {
            "items": {
              "$ref": "#/components/schemas/EditMessageParam"
            },
            "type": "array",
            "title": "Messages"
          },
          "model": {
            "type": "string",
            "title": "Model",
            "description": "The model to use for the edit completion."
          },
          "max_tokens": {
            "type": "integer",
            "title": "Max Tokens",
            "description": "Maximum number of tokens to generate.",
            "default": 1024,
            "minimum": 1,
            "maximum": 8192
          },
          "temperature": {
            "type": "number",
            "title": "Temperature",
            "description": "What sampling temperature to use, between 0 and 2. Higher values make the output more random; lower values make it more focused and deterministic.",
            "default": 0.2,
            "minimum": 0,
            "maximum": 2
          },
          "top_p": {
            "type": "number",
            "title": "Top P",
            "description": "Float that controls the cumulative probability of the top tokens to consider.",
            "default": 1,
            "minimum": 0,
            "maximum": 1
          },
          "presence_penalty": {
            "type": "number",
            "title": "Presence Penalty",
            "description": "Number between -2 and 2. Positive values penalize tokens based on whether they have appeared in the text so far, increasing the model's likelihood to talk about new topics.",
            "default": 1,
            "minimum": -2,
            "maximum": 2
          }
        },
        "type": "object",
        "required": [
          "messages",
          "model"
        ],
        "title": "EditCompletionRequest"
      },
      "EditCompletionResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "object": {
            "type": "string",
            "const": "edit.completion",
            "title": "Object",
            "default": "edit.completion"
          },
          "created": {
            "type": "integer",
            "title": "Created"
          },
          "model": {
            "type": "string",
            "title": "Model"
          },
          "choices": {
            "items": {
              "$ref": "#/components/schemas/EditChoice"
            },
            "type": "array",
            "title": "Choices"
          },
          "usage": {
            "$ref": "#/components/schemas/EditUsage"
          },
          "warning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Warning"
          }
        },
        "type": "object",
        "required": [
          "id",
          "created",
          "model",
          "choices",
          "usage",
          "object"
        ],
        "title": "EditCompletionResponse",
        "example": {
          "id": "cmpl-7a2b3c4d5e",
          "object": "edit.completion",
          "created": 1745798400,
          "model": "mercury-edit-2",
          "choices": [
            {
              "index": 0,
              "finish_reason": "stop",
              "message": {
                "role": "assistant",
                "content": "def greet(name):\n    print(f\"hi {name}\")\n"
              }
            }
          ],
          "usage": {
            "prompt_tokens": 156,
            "completion_tokens": 18,
            "total_tokens": 174,
            "reasoning_tokens": 0,
            "cached_input_tokens": 0
          }
        }
      },
      "EditMessage": {
        "properties": {
          "role": {
            "type": "string",
            "const": "assistant",
            "title": "Role",
            "description": "Edit responses are always from the assistant.",
            "default": "assistant"
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content",
            "description": "The model's edit output."
          }
        },
        "type": "object",
        "title": "EditMessage",
        "description": "Edit response message. The model always responds as the assistant.",
        "required": [
          "role"
        ]
      },
      "EditMessageParam": {
        "properties": {
          "role": {
            "type": "string",
            "const": "user",
            "title": "Role",
            "description": "Edit requests only accept user messages.",
            "default": "user"
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              }
            ],
            "title": "Content",
            "description": "The content of the edit request. Must contain the required edit prompt tags."
          }
        },
        "type": "object",
        "required": [
          "content",
          "role"
        ],
        "title": "EditMessageParam",
        "description": "Edit request message. Edit endpoints only accept a single user message."
      },
      "EditUsage": {
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "title": "Prompt Tokens"
          },
          "reasoning_tokens": {
            "type": "integer",
            "title": "Reasoning Tokens"
          },
          "completion_tokens": {
            "type": "integer",
            "title": "Completion Tokens"
          },
          "total_tokens": {
            "type": "integer",
            "title": "Total Tokens"
          },
          "cached_input_tokens": {
            "type": "integer",
            "title": "Cached Input Tokens"
          }
        },
        "type": "object",
        "required": [
          "prompt_tokens",
          "reasoning_tokens",
          "completion_tokens",
          "total_tokens",
          "cached_input_tokens"
        ],
        "title": "EditUsage",
        "description": "Usage for edit completions."
      },
      "FIMCompletionRequest": {
        "properties": {
          "prompt": {
            "type": "string",
            "title": "Prompt",
            "description": "The prompt to complete."
          },
          "suffix": {
            "type": "string",
            "title": "Suffix",
            "description": "The suffix to complete."
          },
          "model": {
            "type": "string",
            "title": "Model",
            "description": "The model to use for the FIM completion."
          },
          "max_tokens": {
            "type": "integer",
            "title": "Max Tokens",
            "description": "Maximum number of tokens to generate.",
            "default": 512,
            "minimum": 1,
            "maximum": 8192
          },
          "top_p": {
            "type": "number",
            "title": "Top P",
            "description": "Float that controls the cumulative probability of the top tokens to consider.",
            "default": 1,
            "minimum": 0,
            "maximum": 1
          },
          "top_k": {
            "type": "integer",
            "title": "Top K",
            "description": "Limits sampling to the `k` most likely tokens. Must be `-1` (disables the cutoff and considers all tokens) or an integer from 1 to 1000; other values such as 0 are rejected.",
            "default": -1,
            "minimum": -1,
            "maximum": 1000
          },
          "frequency_penalty": {
            "type": "number",
            "title": "Frequency Penalty",
            "description": "Number between -2 and 2. Positive values penalize tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.",
            "default": 0,
            "minimum": -2,
            "maximum": 2
          },
          "presence_penalty": {
            "type": "number",
            "title": "Presence Penalty",
            "description": "Number between -2 and 2. Positive values penalize tokens based on whether they have appeared in the text so far, increasing the model's likelihood to talk about new topics.",
            "default": 1.5,
            "minimum": -2,
            "maximum": 2
          },
          "repetition_penalty": {
            "type": "number",
            "title": "Repetition Penalty",
            "description": "Penalizes tokens that have already appeared in the generated text. Must be greater than 0. Values greater than 1.0 discourage repetition; 1.0 applies no penalty.",
            "default": 1,
            "minimum": 0
          },
          "stop": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Stop",
            "description": "A list of sequences where the API will stop generating further tokens. The returned text will not contain the stop sequences. Defaults to common code-block boundaries.",
            "default": [
              "\n\n",
              "\n \n"
            ]
          },
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "description": "Whether to stream the response.",
            "default": false
          },
          "stream_options": {
            "$ref": "#/components/schemas/StreamOptions",
            "description": "Options that control streaming behavior."
          }
        },
        "type": "object",
        "required": [
          "prompt",
          "model"
        ],
        "title": "FIMCompletionRequest"
      },
      "FIMCompletionResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "object": {
            "type": "string",
            "const": "text_completion",
            "title": "Object",
            "default": "text_completion"
          },
          "created": {
            "type": "integer",
            "title": "Created"
          },
          "model": {
            "type": "string",
            "title": "Model"
          },
          "choices": {
            "items": {
              "$ref": "#/components/schemas/TextCompletionChoice"
            },
            "type": "array",
            "title": "Choices"
          },
          "usage": {
            "$ref": "#/components/schemas/FIMUsage"
          },
          "warning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Warning"
          }
        },
        "type": "object",
        "required": [
          "id",
          "created",
          "model",
          "choices",
          "usage",
          "object"
        ],
        "title": "FIMCompletionResponse",
        "example": {
          "id": "cmpl-7a2b3c4d5e",
          "object": "text_completion",
          "created": 1745798400,
          "model": "mercury-edit-2",
          "choices": [
            {
              "index": 0,
              "finish_reason": "stop",
              "text": "fibonacci(n - 1) + fibonacci(n - 2)"
            }
          ],
          "usage": {
            "prompt_tokens": 24,
            "completion_tokens": 14,
            "total_tokens": 38,
            "reasoning_tokens": 0,
            "cached_input_tokens": 0
          }
        }
      },
      "FIMUsage": {
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "title": "Prompt Tokens"
          },
          "reasoning_tokens": {
            "type": "integer",
            "title": "Reasoning Tokens"
          },
          "completion_tokens": {
            "type": "integer",
            "title": "Completion Tokens"
          },
          "total_tokens": {
            "type": "integer",
            "title": "Total Tokens"
          },
          "cached_input_tokens": {
            "type": "integer",
            "title": "Cached Input Tokens"
          }
        },
        "type": "object",
        "required": [
          "prompt_tokens",
          "reasoning_tokens",
          "completion_tokens",
          "total_tokens",
          "cached_input_tokens"
        ],
        "title": "FIMUsage",
        "description": "Usage for FIM completions."
      },
      "FunctionCall": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Name"
          },
          "arguments": {
            "title": "Arguments",
            "type": "string"
          }
        },
        "required": [
          "arguments"
        ],
        "title": "FunctionCall",
        "type": "object"
      },
      "ModelObject": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "Unique identifier for the model."
          },
          "name": {
            "type": "string",
            "title": "Name",
            "description": "Display name for the model."
          },
          "created": {
            "type": "integer",
            "title": "Created",
            "description": "Unix timestamp when model was created."
          },
          "input_modalities": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Input Modalities",
            "description": "Supported input modalities."
          },
          "output_modalities": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Output Modalities",
            "description": "Supported output modalities."
          },
          "context_length": {
            "type": "integer",
            "title": "Context Length",
            "description": "Maximum context length in tokens."
          },
          "max_output_length": {
            "type": "integer",
            "title": "Max Output Length",
            "description": "Maximum output length in tokens."
          },
          "pricing": {
            "$ref": "#/components/schemas/PricingInfo",
            "description": "Pricing information."
          },
          "supported_sampling_parameters": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Supported Sampling Parameters",
            "description": "Supported sampling parameters."
          },
          "supported_features": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Supported Features",
            "description": "Supported model features."
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Model description."
          },
          "openrouter": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OpenRouterInfo"
              },
              {
                "type": "null"
              }
            ],
            "description": "OpenRouter-specific metadata."
          },
          "datacenters": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/DataCenter"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Datacenters",
            "description": "Available datacenters."
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "created",
          "input_modalities",
          "output_modalities",
          "context_length",
          "max_output_length",
          "pricing",
          "supported_sampling_parameters",
          "supported_features"
        ],
        "title": "ModelObject",
        "description": "Model information object."
      },
      "ModelsResponse": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/ModelObject"
            },
            "type": "array",
            "title": "Data"
          }
        },
        "type": "object",
        "required": [
          "data"
        ],
        "title": "ModelsResponse",
        "description": "Response model for models endpoint.",
        "example": {
          "data": [
            {
              "id": "mercury-2",
              "name": "Inception: Mercury 2",
              "created": 1745798400,
              "description": "Mercury 2 diffusion language model for chat completions.",
              "input_modalities": [
                "text"
              ],
              "output_modalities": [
                "text"
              ],
              "context_length": 128000,
              "max_output_length": 50000,
              "pricing": {
                "prompt": "0.00000025",
                "completion": "0.00000075",
                "input_cache_reads": "0.000000025",
                "input_cache_writes": "0"
              },
              "supported_sampling_parameters": [
                "temperature",
                "stop"
              ],
              "supported_features": [
                "tools",
                "json_mode",
                "structured_outputs"
              ],
              "openrouter": {
                "slug": "inception/mercury-2"
              },
              "datacenters": [
                {
                  "country_code": "US"
                }
              ]
            }
          ]
        }
      },
      "OpenRouterInfo": {
        "properties": {
          "slug": {
            "type": "string",
            "title": "Slug",
            "description": "OpenRouter slug for the model."
          }
        },
        "type": "object",
        "required": [
          "slug"
        ],
        "title": "OpenRouterInfo",
        "description": "Optional OpenRouter-specific information."
      },
      "PricingInfo": {
        "properties": {
          "prompt": {
            "type": "string",
            "title": "Prompt",
            "description": "Pricing per 1 token for input."
          },
          "completion": {
            "type": "string",
            "title": "Completion",
            "description": "Pricing per 1 token for output."
          },
          "input_cache_reads": {
            "type": "string",
            "title": "Input Cache Reads",
            "description": "Pricing per 1 token for cache reads.",
            "default": "0"
          },
          "input_cache_writes": {
            "type": "string",
            "title": "Input Cache Writes",
            "description": "Pricing per 1 token for cache writes.",
            "default": "0"
          }
        },
        "type": "object",
        "required": [
          "prompt",
          "completion"
        ],
        "title": "PricingInfo",
        "description": "Pricing information for a model."
      },
      "ReasoningSummary": {
        "description": "Summary of the model's reasoning process.",
        "properties": {
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "The summarized reasoning.",
            "title": "Content"
          },
          "status": {
            "default": "unavailable",
            "description": "Status of the summary.",
            "enum": [
              "complete",
              "unavailable"
            ],
            "title": "Status",
            "type": "string"
          }
        },
        "title": "ReasoningSummary",
        "type": "object",
        "required": []
      },
      "StreamOptions": {
        "properties": {
          "include_usage": {
            "type": "boolean",
            "title": "Include Usage",
            "description": "If true, an additional chunk is streamed before the `data: [DONE]` message containing the token usage statistics for the entire request. Inside that chunk, `choices` is an empty array and the `usage` field is populated.",
            "default": false
          }
        },
        "type": "object",
        "title": "StreamOptions",
        "description": "Options for controlling streaming behavior. Only used when `stream=true`.",
        "required": []
      },
      "TextCompletionChoice": {
        "properties": {
          "index": {
            "type": "integer",
            "title": "Index"
          },
          "text": {
            "type": "string",
            "title": "Text"
          },
          "finish_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "stop",
              "length",
              "content_filter",
              null
            ],
            "description": "The reason the model stopped generating tokens."
          }
        },
        "type": "object",
        "required": [
          "index",
          "text",
          "finish_reason"
        ],
        "title": "TextCompletionChoice",
        "description": "Choice for FIM completions."
      },
      "ToolCall": {
        "properties": {
          "index": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "default": 0,
            "title": "Index"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "type": {
            "const": "function",
            "default": "function",
            "title": "Type",
            "type": "string"
          },
          "function": {
            "$ref": "#/components/schemas/FunctionCall"
          }
        },
        "required": [
          "id",
          "function",
          "type"
        ],
        "title": "ToolCall",
        "type": "object"
      },
      "Usage": {
        "properties": {
          "prompt_tokens": {
            "type": "integer",
            "title": "Prompt Tokens"
          },
          "reasoning_tokens": {
            "type": "integer",
            "title": "Reasoning Tokens"
          },
          "completion_tokens": {
            "type": "integer",
            "title": "Completion Tokens"
          },
          "total_tokens": {
            "type": "integer",
            "title": "Total Tokens"
          },
          "cached_input_tokens": {
            "type": "integer",
            "title": "Cached Input Tokens"
          }
        },
        "type": "object",
        "required": [
          "prompt_tokens",
          "reasoning_tokens",
          "completion_tokens",
          "total_tokens",
          "cached_input_tokens"
        ],
        "title": "Usage"
      },
      "ChatCompletionChunk": {
        "description": "Model for a single chunk in a streaming chat completion response.",
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "object": {
            "const": "chat.completion.chunk",
            "default": "chat.completion.chunk",
            "title": "Object",
            "type": "string"
          },
          "created": {
            "title": "Created",
            "type": "integer"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "choices": {
            "items": {
              "$ref": "#/components/schemas/ChunkChoice"
            },
            "title": "Choices",
            "type": "array"
          },
          "reasoning_summary": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ReasoningSummary"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Summary of reasoning process (included in final chunk if available)."
          }
        },
        "required": [
          "id",
          "created",
          "model",
          "choices",
          "object"
        ],
        "title": "ChatCompletionChunk",
        "type": "object"
      },
      "ChunkChoice": {
        "description": "Represents a choice in a streaming response chunk.",
        "properties": {
          "index": {
            "title": "Index",
            "type": "integer"
          },
          "delta": {
            "$ref": "#/components/schemas/ChunkDelta"
          },
          "finish_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "stop",
              "length",
              "tool_calls",
              "content_filter",
              null
            ],
            "description": "The reason the model stopped generating tokens."
          }
        },
        "required": [
          "index",
          "delta"
        ],
        "title": "ChunkChoice",
        "type": "object"
      },
      "ChunkDelta": {
        "description": "Represents a partial message in a streaming response chunk.",
        "properties": {
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "The partial content of the message.",
            "title": "Content"
          },
          "role": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "The role of the message sender, typically only in the first chunk.",
            "title": "Role"
          },
          "tool_calls": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ToolCall"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "The tool calls generated by the model in this chunk.",
            "title": "Tool Calls"
          }
        },
        "title": "ChunkDelta",
        "type": "object",
        "required": []
      },
      "TextChunkChoice": {
        "description": "Represents a choice in a streaming text completion response chunk.",
        "properties": {
          "index": {
            "title": "Index",
            "type": "integer"
          },
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "The text in this chunk.",
            "title": "Text"
          },
          "finish_reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "stop",
              "length",
              "content_filter",
              null
            ],
            "description": "The reason the model stopped generating tokens."
          }
        },
        "required": [
          "index"
        ],
        "title": "TextChunkChoice",
        "type": "object"
      },
      "TextCompletionChunk": {
        "description": "Model for a single chunk in a streaming text completion response.",
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "object": {
            "const": "text_completion",
            "default": "text_completion",
            "title": "Object",
            "type": "string"
          },
          "created": {
            "title": "Created",
            "type": "integer"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "choices": {
            "items": {
              "$ref": "#/components/schemas/TextChunkChoice"
            },
            "title": "Choices",
            "type": "array"
          }
        },
        "required": [
          "id",
          "created",
          "model",
          "choices",
          "object"
        ],
        "title": "TextCompletionChunk",
        "type": "object"
      },
      "Message": {
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "user",
              "assistant",
              "tool",
              "function"
            ],
            "title": "Role",
            "description": "The role of the message sender (system, user, assistant, tool, function)."
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content",
            "description": "The content of the message, can be string or array of content items."
          },
          "tool_calls": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/ToolCall"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Calls",
            "description": "The tool calls generated by the model."
          },
          "tool_call_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Call Id",
            "description": "The ID of the tool call this message is responding to (for role='tool')."
          }
        },
        "type": "object",
        "required": [
          "role"
        ],
        "title": "Message"
      },
      "FunctionDefinition": {
        "type": "object",
        "title": "FunctionDefinition",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the function to call. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."
          },
          "description": {
            "type": "string",
            "description": "A description of what the function does, used by the model to choose when and how to call the function."
          },
          "parameters": {
            "type": "object",
            "additionalProperties": true,
            "description": "The parameters the function accepts, described as a JSON Schema object."
          },
          "strict": {
            "type": "boolean",
            "default": false,
            "description": "Whether to enforce strict schema adherence when generating the function call. When true, the model output is constrained to match the `parameters` schema exactly."
          }
        }
      },
      "ChatCompletionTool": {
        "type": "object",
        "title": "ChatCompletionTool",
        "required": [
          "type",
          "function"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "function",
            "description": "The type of the tool."
          },
          "function": {
            "$ref": "#/components/schemas/FunctionDefinition"
          }
        }
      },
      "ResponseFormatText": {
        "type": "object",
        "title": "ResponseFormatText",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "text",
            "description": "The type of response format being defined. Always `text`. The model responds with plain text and output is not constrained to JSON."
          }
        }
      },
      "ResponseFormatJSONObject": {
        "type": "object",
        "title": "ResponseFormatJSONObject",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "json_object",
            "description": "The type of response format being defined. Always `json_object`."
          }
        }
      },
      "JSONSchema": {
        "type": "object",
        "title": "JSONSchema",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."
          },
          "description": {
            "type": "string",
            "description": "A description of what the response format is for, used by the model to determine how to respond in the format."
          },
          "schema": {
            "type": "object",
            "additionalProperties": true,
            "description": "The schema for the response format, described as a JSON Schema object."
          },
          "strict": {
            "type": "boolean",
            "default": false,
            "description": "Whether to enforce strict schema adherence when generating the output. When true, the model output is constrained to match the supplied `schema` exactly."
          }
        }
      },
      "ResponseFormatJSONSchema": {
        "type": "object",
        "title": "ResponseFormatJSONSchema",
        "required": [
          "type",
          "json_schema"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "json_schema",
            "description": "The type of response format being defined. Always `json_schema`."
          },
          "json_schema": {
            "$ref": "#/components/schemas/JSONSchema"
          }
        }
      },
      "ErrorObject": {
        "type": "object",
        "title": "ErrorObject",
        "required": [
          "message",
          "type"
        ],
        "properties": {
          "message": {
            "type": "string",
            "description": "Human-readable error message."
          },
          "type": {
            "type": "string",
            "description": "Error category, e.g. `invalid_request_error`, `rate_limit_error`."
          },
          "param": {
            "type": [
              "string",
              "null"
            ],
            "description": "Offending parameter, if applicable."
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Machine-readable error code."
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "title": "ErrorResponse",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorObject"
          }
        },
        "example": {
          "error": {
            "message": "You exceeded the maximum context length for this model of 128000. Please reduce the length of the messages or completion.",
            "type": "invalid_request_error",
            "param": "messages",
            "code": "context_length_exceeded"
          }
        }
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key provided as a Bearer token: `Authorization: Bearer <api_key>`. Get an API key at https://platform.inceptionlabs.ai."
      }
    }
  },
  "servers": [
    {
      "url": "https://api.inceptionlabs.ai",
      "description": "Production"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Chat",
      "description": "Chat completion endpoints (OpenAI-compatible)."
    },
    {
      "name": "FIM",
      "description": "Fill-in-the-middle code completion endpoints."
    },
    {
      "name": "Edit",
      "description": "Code edit completion endpoints."
    },
    {
      "name": "Models",
      "description": "List available models."
    }
  ]
}