{ "/chat/completions": { "post": { "tags": [ "chat/completions" ], "summary": "Chat Completion", "description": "Follows the exact same API spec as `OpenAI's Chat API https://platform.openai.com/docs/api-reference/chat`\n\n```bash\ncurl -X POST http://localhost:4000/v1/chat/completions \n-H \"Content-Type: application/json\" \n-H \"Authorization: Bearer sk-1234\" \n-d '{\n \"model\": \"gpt-4o\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello!\"\n }\n ]\n}'\n```", "operationId": "chat_completion_chat_completions_post", "security": [ { "APIKeyHeader": [] } ], "parameters": [], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "model", "messages" ], "properties": { "model": { "title": "Model", "type": "string" }, "messages": { "items": { "anyOf": [ { "$ref": "#/components/schemas/ChatCompletionUserMessage" }, { "$ref": "#/components/schemas/ChatCompletionAssistantMessage" }, { "$ref": "#/components/schemas/ChatCompletionToolMessage" }, { "$ref": "#/components/schemas/ChatCompletionSystemMessage" }, { "$ref": "#/components/schemas/ChatCompletionFunctionMessage" }, { "$ref": "#/components/schemas/ChatCompletionDeveloperMessage" } ] }, "title": "Messages", "type": "array", "example": [ { "role": "user", "content": "Hello, how are you?" } ] }, "frequency_penalty": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Frequency Penalty" }, "logit_bias": { "anyOf": [ { "additionalProperties": { "type": "number" }, "type": "object" }, { "type": "null" } ], "default": null, "title": "Logit Bias" }, "logprobs": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Logprobs" }, "top_logprobs": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Top Logprobs" }, "max_tokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Max Tokens" }, "n": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "N" }, "presence_penalty": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Presence Penalty" }, "response_format": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Response Format" }, "seed": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Seed" }, "service_tier": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Service Tier" }, "stop": { "anyOf": [ { "type": "string" }, { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Stop" }, "stream_options": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Stream Options" }, "temperature": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Temperature" }, "top_p": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "title": "Top P" }, "tools": { "anyOf": [ { "items": { "additionalProperties": true, "type": "object" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Tools" }, "tool_choice": { "anyOf": [ { "type": "string" }, { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Tool Choice" }, "parallel_tool_calls": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Parallel Tool Calls" }, "function_call": { "anyOf": [ { "type": "string" }, { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Function Call" }, "functions": { "anyOf": [ { "items": { "additionalProperties": true, "type": "object" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Functions" }, "user": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "User" }, "stream": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Stream" }, "metadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "title": "Metadata" }, "guardrails": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Guardrails" }, "caching": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Caching" }, "num_retries": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Num Retries" }, "context_window_fallback_dict": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "default": null, "title": "Context Window Fallback Dict" }, "fallbacks": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "title": "Fallbacks" } } } } } } } } }