{ "components": { "schemas": { "ChatCompletionChoice": { "description": "A single chat completion choice. A response will contain one or\nmore of these based on the setting of `n`.", "properties": { "finish_reason": { "anyOf": [ { "$ref": "#/components/schemas/FinishReason" }, { "type": "null" } ] }, "index": { "description": "A unique identifier for the chat completion.Each chunk has the same ID.", "title": "Index", "type": "integer" }, "message": { "allOf": [ { "$ref": "#/components/schemas/ChatMessage" } ], "description": "A chat completion message generated by the model." } }, "required": [ "index", "message" ], "title": "ChatCompletionChoice", "type": "object" }, "ChatCompletionChunk": { "description": "Represents a single chunk of a streaming chat completion response.\n\nThis object's schema is compatible with OpenAI's Chat Completion API.", "properties": { "choices": { "description": "A list of chat completion choices.Can be more than one if n is greater than 1.", "items": { "$ref": "#/components/schemas/ChatCompletionChunkChoice" }, "title": "Choices", "type": "array" }, "created": { "description": "The Unix timestamp (in seconds) of when the chat completion was created.", "examples": [ 1672342342 ], "title": "Created", "type": "integer" }, "id": { "description": "A unique identifier for the entire chat completion request. Each chunk in the stream has the same ID.", "title": "ID", "type": "string" }, "model": { "description": "The model used for the chat completion.", "title": "Model", "type": "string" }, "object": { "const": "chat.completion.chunk", "default": "chat.completion.chunk", "title": "Object" } }, "required": [ "id", "created", "model", "choices" ], "title": "ChatCompletionChunk", "type": "object" }, "ChatCompletionChunkChoice": { "description": "An OpenAPI compatible schema for a chat completion chunk choice.", "properties": { "delta": { "$ref": "#/components/schemas/ChatCompletionDelta" }, "finish_reason": { "anyOf": [ { "$ref": "#/components/schemas/FinishReason" }, { "type": "null" } ] }, "index": { "title": "Index", "type": "integer" } }, "required": [ "index", "delta" ], "title": "ChatCompletionChunkChoice", "type": "object" }, "ChatCompletionDelta": { "description": "An OpenAPI compatible schema for a chat completion choice delta.", "properties": { "content": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Content" }, "function_call": { "anyOf": [ { "$ref": "#/components/schemas/ChatFnCall" }, { "type": "null" } ] }, "role": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Role" } }, "required": [ "role", "content" ], "title": "ChatCompletionDelta", "type": "object" }, "ChatCompletionRequestExt": { "description": "OctoAI specific extensions for a chat completion request.", "properties": { "vllm": { "anyOf": [ { "$ref": "#/components/schemas/ChatCompletionRequestExtVLLM" }, { "type": "null" } ], "default": { "best_of": 1, "ignore_eos": false, "skip_special_tokens": true, "stop_token_ids": [], "top_k": -1, "use_beam_search": false } } }, "title": "ChatCompletionRequestExt", "type": "object" }, "ChatCompletionRequestExtVLLM": { "properties": { "best_of": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": 1, "title": "Best Of" }, "ignore_eos": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": false, "title": "Ignore Eos" }, "skip_special_tokens": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": true, "title": "Skip Special Tokens" }, "stop_token_ids": { "anyOf": [ { "items": { "type": "integer" }, "type": "array" }, { "type": "null" } ], "title": "Stop Token Ids" }, "top_k": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": -1, "title": "Top K" }, "use_beam_search": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": false, "title": "Use Beam Search" } }, "title": "ChatCompletionRequestExtVLLM", "type": "object" }, "ChatCompletionResponse": { "description": "An OpenAI API compatible schema for a chat completion response object.", "properties": { "choices": { "description": "A list of chat completion choices.Can be more than one if n is greater than 1.", "items": { "$ref": "#/components/schemas/ChatCompletionChoice" }, "title": "Choices", "type": "array" }, "created": { "description": "The Unix timestamp (in seconds) of when the chat completion was created.", "examples": [ 1672342342 ], "title": "Created", "type": "integer" }, "id": { "description": "A unique identifier for the chat completion.", "title": "Id", "type": "string" }, "model": { "description": "The model used for the chat completion.", "title": "Model", "type": "string" }, "object": { "const": "chat.completion", "default": "chat.completion", "title": "Object" }, "usage": { "allOf": [ { "$ref": "#/components/schemas/UsageStats" } ], "description": "Usage statistics for the completion request." } }, "required": [ "id", "created", "model", "choices", "usage" ], "title": "ChatCompletionResponse", "type": "object" }, "ChatCompletionResponseFormat": { "properties": { "schema": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "title": "Schema" }, "type": { "title": "Type", "type": "string" } }, "required": [ "type" ], "title": "ChatCompletionResponseFormat", "type": "object" }, "ChatFnCall": { "description": "An OpenAI API compatible schema for a chat function call.", "properties": { "arguments": { "title": "Arguments", "type": "string" }, "name": { "title": "Name", "type": "string" } }, "required": [ "name", "arguments" ], "title": "ChatFnCall", "type": "object" }, "ChatMessage": { "description": "An OpenAI API compatible schema for a single ChatMessage.", "properties": { "content": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Content" }, "function_call": { "anyOf": [ { "$ref": "#/components/schemas/ChatFnCall" }, { "type": "null" } ] }, "role": { "title": "Role", "type": "string" } }, "required": [ "role", "content" ], "title": "ChatMessage", "type": "object" }, "CompletionChoice": { "properties": { "finish_reason": { "anyOf": [ { "$ref": "#/components/schemas/FinishReason" }, { "type": "null" } ] }, "index": { "title": "Index", "type": "integer" }, "logprobs": { "anyOf": [ { "$ref": "#/components/schemas/LogProbs" }, { "type": "null" } ] }, "text": { "title": "Text", "type": "string" } }, "required": [ "index", "text" ], "title": "CompletionChoice", "type": "object" }, "CompletionResponse": { "description": "Represents a completion response from the API.\nNote: both the streamed and non-streamed response objects\nshare the same shape (unlike the chat endpoint).", "examples": [ { "choices": [], "created": 11, "id": "cmpl-123", "model": "my_model", "system_fingerprint": "system_fingerprint" } ], "properties": { "choices": { "items": { "$ref": "#/components/schemas/CompletionChoice" }, "title": "Choices", "type": "array" }, "created": { "description": "The Unix timestamp (in seconds) of when the completion was created.", "examples": [ 1672342342 ], "title": "Created", "type": "integer" }, "id": { "title": "Id", "type": "string" }, "model": { "title": "Model", "type": "string" }, "object": { "const": "text_completion", "default": "text_completion", "title": "Object" }, "system_fingerprint": { "title": "System Fingerprint", "type": "string" }, "usage": { "anyOf": [ { "$ref": "#/components/schemas/UsageStats" }, { "type": "null" } ] } }, "required": [ "id", "choices", "created", "model", "system_fingerprint" ], "title": "CompletionResponse", "type": "object" }, "CreateChatCompletionRequest": { "description": "An OpenAI API compatible chat completion request.", "examples": [ { "max_tokens": 128, "messages": [ { "content": "You are a helpful assistant. Keep your responses limited to one short paragraph if possible.", "role": "system" }, { "content": "Hello world", "role": "user" } ], "model": "llama-2-13b-chat-fp16", "temperature": 0.1, "top_p": 0.9 } ], "properties": { "frequency_penalty": { "anyOf": [ { "maximum": 2.0, "minimum": -2.0, "type": "number" }, { "type": "null" } ], "default": 0.0, "description": "Penalizes new tokens based on their frequency in the generated text so far.", "title": "Frequency Penalty" }, "function_call": { "anyOf": [ { "type": "string" }, { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "title": "Function Call" }, "functions": { "anyOf": [ { "items": { "$ref": "#/components/schemas/Function" }, "type": "array" }, { "type": "null" } ], "default": [], "title": "Functions" }, "ignore_eos": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": false, "title": "Ignore Eos" }, "logit_bias": { "anyOf": [ { "additionalProperties": { "type": "number" }, "type": "object" }, { "type": "null" } ], "title": "Logit Bias" }, "max_tokens": { "anyOf": [ { "minimum": 1.0, "type": "integer" }, { "type": "null" } ], "default": 512, "description": "Maximum number of tokens to generate per output sequence.", "title": "Max Tokens" }, "messages": { "description": "A list of messages comprising the conversation so far.", "items": { "$ref": "#/components/schemas/ChatMessage" }, "title": "Messages", "type": "array" }, "model": { "description": "The identifier of the model to use.Can be a shared tenancy or custom model identifier.", "title": "Model", "type": "string" }, "n": { "anyOf": [ { "minimum": 1.0, "type": "integer" }, { "type": "null" } ], "default": 1, "title": "N" }, "octoai": { "anyOf": [ { "$ref": "#/components/schemas/ChatCompletionRequestExt" }, { "type": "null" } ] }, "presence_penalty": { "anyOf": [ { "maximum": 2.0, "minimum": -2.0, "type": "number" }, { "type": "null" } ], "default": 0.0, "description": "Penalizes new tokens based on whether they appear in the generated text so far", "title": "Presence Penalty" }, "repetition_penalty": { "anyOf": [ { "minimum": 0.0, "type": "number" }, { "type": "null" } ], "default": 1.0, "title": "Repetition Penalty" }, "response_format": { "anyOf": [ { "$ref": "#/components/schemas/ChatCompletionResponseFormat" }, { "type": "null" } ], "description": "Allows specification of a response format and associated schema that will constrain the LLM output to that structure. For example, using the `json_object` type allows you to provide a desired json schema for the output to follow." }, "stop": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "title": "Stop" }, "stream": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": false, "description": "If set, tokens will be streamed incrementally to users.", "title": "Stream" }, "temperature": { "anyOf": [ { "maximum": 2.0, "minimum": 0.0, "type": "number" }, { "type": "null" } ], "default": 1.0, "description": "Controls the randomness of the sampling.", "title": "Temperature" }, "top_p": { "anyOf": [ { "exclusiveMinimum": 0.0, "maximum": 1.0, "type": "number" }, { "type": "null" } ], "default": 1.0, "description": "Controls the cumulative probability of the top tokens to consider.", "title": "Top P" }, "user": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "User" } }, "required": [ "model", "messages" ], "title": "CreateChatCompletionRequest", "type": "object" }, "CreateCompletionRequest": { "description": "`POST https://text.octoai.run/v1/completions`\n\nCompletes the provided prefix prompt given the parameters.\n\nYou can view this as the \"raw\" API to the model which provides\nmore complete user control than the chat completions API.\n\nThis API is compatible with OpenAI's API.", "properties": { "best_of": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": 1, "description": "Number of sequences that are generated from the prompt.`best_of` must be greater than or equal to `n`.", "title": "Best Of" }, "echo": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": false, "description": "Echo back the prompt in addition to the completion.", "title": "Echo" }, "frequency_penalty": { "anyOf": [ { "maximum": 2.0, "minimum": -2.0, "type": "number" }, { "type": "null" } ], "default": 0.0, "description": "Penalizes new tokens based on their frequency in the generated text so far.", "title": "Frequency Penalty" }, "logit_bias": { "anyOf": [ { "additionalProperties": { "type": "number" }, "type": "object" }, { "type": "null" } ], "description": "Modify the likelihood of specified tokens appearing in the completion.", "title": "Logit Bias" }, "logprobs": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "description": "Number of log probabilities to return per output token.", "title": "Logprobs" }, "max_tokens": { "anyOf": [ { "minimum": 1.0, "type": "integer" }, { "type": "null" } ], "default": 16, "description": "Maximum number of tokens to generate per output sequence.", "title": "Max Tokens" }, "model": { "description": "Model name to use for completion.", "title": "Model", "type": "string" }, "n": { "anyOf": [ { "minimum": 1.0, "type": "integer" }, { "type": "null" } ], "default": 1, "description": "Number of output sequences to return.", "title": "N" }, "presence_penalty": { "anyOf": [ { "maximum": 2.0, "minimum": -2.0, "type": "number" }, { "type": "null" } ], "default": 0.0, "description": "Penalizes new tokens based on whether they appear in the generated text so far", "title": "Presence Penalty" }, "prompt": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" }, { "items": { "type": "integer" }, "type": "array" }, { "items": { "items": { "type": "integer" }, "type": "array" }, "type": "array" } ], "description": "The prompt to generate completions from.", "title": "Prompt" }, "repetition_penalty": { "anyOf": [ { "minimum": 0.0, "type": "number" }, { "type": "null" } ], "default": 1.0, "description": "Controls the likelihood of the model generating repeated texts", "title": "Repetition Penalty" }, "seed": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": 0, "title": "Seed" }, "stop": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "description": "Strings that stop the generation when they are generated.", "title": "Stop" }, "stream": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": false, "description": "If set, tokens will be streamed incrementally to users.", "title": "Stream" }, "suffix": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "description": "The suffix that comes after a completion of inserted text.", "title": "Suffix" }, "temperature": { "anyOf": [ { "maximum": 2.0, "minimum": 0.0, "type": "number" }, { "type": "null" } ], "default": 1.0, "description": "Controls the randomness of the sampling.", "title": "Temperature" }, "top_p": { "anyOf": [ { "exclusiveMinimum": 0.0, "maximum": 1.0, "type": "number" }, { "type": "null" } ], "default": 1.0, "description": "Controls the cumulative probability of the top tokens to consider.", "title": "Top P" }, "user": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "User" } }, "required": [ "model", "prompt" ], "title": "CreateCompletionRequest", "type": "object" }, "ErrorResponse": { "description": "An OpenAI API compatible schema for a error response.", "properties": { "code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Code" }, "message": { "title": "Message", "type": "string" }, "object": { "default": "error", "title": "Object", "type": "string" }, "param": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Param" }, "type": { "title": "Type", "type": "string" }, "validation_errors": { "anyOf": [ { "additionalProperties": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" } ] }, "type": "object" }, { "type": "null" } ], "title": "Validation Errors" } }, "required": [ "message", "type" ], "title": "ErrorResponse", "type": "object" }, "FinishReason": { "description": "The reason why the model stopped generating tokens.\nThis will be `stop` if the model naturally completed generation or encountered a\nprovided stop sequence, `length` if the maximum number of tokens specified in the\nrequest was reached, content_filter if content was omitted due to a flag from our\ncontent filters, tool_calls if the model called a tool, or function_call\n(deprecated) if the model called a function.", "enum": [ "stop", "length", "content_filter", "function_call" ], "title": "FinishReason", "type": "string" }, "Function": { "description": "An OpenAI API compatible schema for function which can be called.", "properties": { "description": { "title": "Description", "type": "string" }, "name": { "title": "Name", "type": "string" }, "parameters": { "title": "Parameters" } }, "required": [ "name", "description", "parameters" ], "title": "Function", "type": "object" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "title": "Detail", "type": "array" } }, "title": "HTTPValidationError", "type": "object" }, "LogProbs": { "description": "The tokens and their [log probabilities](https://en.wikipedia.org/wiki/Log_probability).", "properties": { "text_offset": { "items": { "type": "integer" }, "title": "Text Offset", "type": "array" }, "token_logprobs": { "items": { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "title": "Token Logprobs", "type": "array" }, "tokens": { "items": { "type": "string" }, "title": "Tokens", "type": "array" }, "top_logprobs": { "items": { "anyOf": [ { "additionalProperties": { "type": "number" }, "type": "object" }, { "type": "null" } ] }, "title": "Top Logprobs", "type": "array" } }, "title": "LogProbs", "type": "object" }, "UsageStats": { "description": "The token usage statistics for a request.", "properties": { "completion_tokens": { "description": "Number of tokens in the prompt.", "title": "Completion Tokens", "type": "integer" }, "prompt_tokens": { "description": "Number of tokens in the prompt.", "title": "Prompt Tokens", "type": "integer" }, "total_tokens": { "description": "Total number of tokens used in the request (prompt + completion).", "title": "Total Tokens", "type": "integer" } }, "required": [ "prompt_tokens", "completion_tokens", "total_tokens" ], "title": "UsageStats", "type": "object" }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "title": "Location", "type": "array" }, "msg": { "title": "Message", "type": "string" }, "type": { "title": "Error Type", "type": "string" } }, "required": [ "loc", "msg", "type" ], "title": "ValidationError", "type": "object" } } }, "info": { "title": "ollm-api", "version": "0.1" }, "openapi": "3.1.0", "paths": { "/v1/chat/completions": { "post": { "description": "Create a Chat Completion.", "operationId": "create_chat_completion_v1_chat_completions_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateChatCompletionRequest" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "examples": [], "schema": { "$ref": "#/components/schemas/ChatCompletionResponse", "anyOf": [ { "$ref": "#/components/schemas/ChatCompletionResponse" }, { "$ref": "#/components/schemas/ChatCompletionChunk" }, { "$ref": "#/components/schemas/ChatCompletionResponse" }, { "$ref": "#/components/schemas/ChatCompletionChunk" } ], "title": "Response 200 Create Chat Completion V1 Chat Completions Post" } }, "text/event-stream": { "examples": [], "schema": { "$ref": "#/components/schemas/ChatCompletionChunk" } } }, "description": "An OctoAI text endpoint can be requested in either a synchronous orstreaming mode.When the request body has `stream: False` set the content type will be`application/json`. When the request body has `stream: True` set thecontent type will be `text-event-stream` and will respond with a stream of[server-send-events (SSE)](https://en.wikipedia.org/wiki/Server-sent_events)." }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error" }, "500": { "content": { "application/json": { "example": { "message": "An example error", "object": "error", "type": "internal_error" }, "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }, "description": "Internal Server Error" } }, "summary": "Create Chat Completion", "tags": [ "text" ], "x-fern-streaming": { "response": { "$ref": "#/components/schemas/ChatCompletionResponse" }, "response-stream": { "$ref": "#/components/schemas/ChatCompletionChunk" }, "stream-condition": "$request.stream" } } }, "/v1/completions": { "post": { "description": "Create a Completion.", "operationId": "create_completion_v1_completions_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateCompletionRequest" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "examples": [ { "choices": [], "created": 11, "id": "cmpl-123", "model": "my_model", "system_fingerprint": "system_fingerprint" } ], "schema": { "$ref": "#/components/schemas/CompletionResponse" } }, "text/event-stream": { "examples": [ { "choices": [], "created": 11, "id": "cmpl-123", "model": "my_model", "system_fingerprint": "system_fingerprint" } ], "schema": { "$ref": "#/components/schemas/CompletionResponse" } } }, "description": "An OctoAI text endpoint can be requested in either a synchronous orstreaming mode.When the request body has `stream: False` set the content type will be`application/json`. When the request body has `stream: True` set thecontent type will be `text-event-stream` and will respond with a stream of[server-send-events (SSE)](https://en.wikipedia.org/wiki/Server-sent_events)." }, "422": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } }, "description": "Validation Error" }, "500": { "content": { "application/json": { "example": { "message": "An example error", "object": "error", "type": "internal_error" }, "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }, "description": "Internal Server Error" } }, "summary": "Create Completion", "tags": [ "text" ], "x-fern-streaming": { "response": { "$ref": "#/components/schemas/CompletionResponse" }, "response-stream": { "$ref": "#/components/schemas/CompletionResponse" }, "stream-condition": "$request.stream" } } } } }