{
	"openapi": "3.1.0",
	"info": {
		"title": "Stogas Gateway API",
		"summary": "OpenAI-compatible public API gateway.",
		"description": "The Stogas Gateway exposes an OpenAI-compatible surface. Authenticate requests with your Stogas API key, and the gateway will relay the request to the configured upstream provider.",
		"version": "1.0.0"
	},
	"jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
	"servers": [
		{
			"url": "{serverUrl}",
			"description": "Gateway origin. Endpoint paths include their API version.",
			"variables": {
				"serverUrl": {
					"default": "https://api.stogas.ai"
				}
			}
		}
	],
	"paths": {
		"/v1/chat/completions": {
			"post": {
				"operationId": "createChatCompletion",
				"tags": [
					"OpenAI-compatible"
				],
				"summary": "Chat Completions",
				"description": "Create an OpenAI-compatible chat completion. The gateway resolves the requested model and route through the compiled Stogas catalog, applies deployment facts such as implied service tier, rejects unsupported parameters, and then relays the request to the configured provider.",
				"parameters": [
					{
						"$ref": "#/components/parameters/ReturnExtraFields"
					}
				],
				"requestBody": {
					"required": true,
					"content": {
						"application/json": {
							"schema": {
								"$ref": "#/components/schemas/ChatCompletionRequest"
							}
						}
					}
				},
				"responses": {
					"200": {
						"description": "Successful completion. Non-streaming requests return JSON; streaming requests return Server-Sent Events.",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ChatCompletionResponse"
								}
							},
							"text/event-stream": {
								"schema": {
									"type": "string",
									"description": "Server-Sent Events stream. Each `data:` frame contains a chat completion chunk; the stream ends with `data: [DONE]`."
								},
								"example": "data: {\"id\":\"8ee3487c-e5b1-4fe0-9dd6-84bc23ddd5f7\",\"object\":\"chat.completion.chunk\",\"created\":1714343120,\"model\":\"gpt-5.5\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"Hello\"},\"finish_reason\":null}]}\n\ndata: [DONE]\n\n"
							}
						}
					},
					"400": {
						"$ref": "#/components/responses/BadRequest"
					},
					"401": {
						"$ref": "#/components/responses/Unauthorized"
					},
					"402": {
						"$ref": "#/components/responses/PaymentRequired"
					},
					"403": {
						"$ref": "#/components/responses/Forbidden"
					},
					"404": {
						"$ref": "#/components/responses/NotFound"
					},
					"409": {
						"$ref": "#/components/responses/Conflict"
					},
					"413": {
						"$ref": "#/components/responses/PayloadTooLarge"
					},
					"429": {
						"$ref": "#/components/responses/RateLimited"
					},
					"500": {
						"$ref": "#/components/responses/InternalError"
					},
					"503": {
						"$ref": "#/components/responses/ServiceUnavailable"
					}
				}
			}
		}
	},
	"components": {
		"securitySchemes": {
			"bearerAuth": {
				"type": "http",
				"scheme": "bearer",
				"bearerFormat": "Stogas API key",
				"description": "Pass the Stogas API key as `Authorization: Bearer <token>`. This is the canonical OpenAI-compatible header."
			},
			"authorizationHeader": {
				"type": "apiKey",
				"in": "header",
				"name": "Authorization",
				"description": "Pass the Stogas API key directly as `Authorization: <token>`. The gateway normalizes this to the canonical Bearer authentication path."
			},
			"apiKeyHeader": {
				"type": "apiKey",
				"in": "header",
				"name": "api-key",
				"description": "Catalog-defined authentication alias. The gateway canonicalizes `api-key: <token>` to `Authorization: Bearer <token>`."
			},
			"xApiKeyHeader": {
				"type": "apiKey",
				"in": "header",
				"name": "x-api-key",
				"description": "Catalog-defined authentication alias. The gateway canonicalizes `x-api-key: <token>` to `Authorization: Bearer <token>`."
			},
			"xGoogApiKeyHeader": {
				"type": "apiKey",
				"in": "header",
				"name": "x-goog-api-key",
				"description": "Catalog-defined authentication alias. The gateway canonicalizes `x-goog-api-key: <token>` to `Authorization: Bearer <token>`."
			}
		},
		"parameters": {
			"ReturnExtraFields": {
				"name": "X-Stogas-Return-Extra-Fields",
				"in": "header",
				"schema": {
					"type": "string"
				},
				"description": "Comma-separated catalog-defined Stogas metadata fields to include under `stogas`, such as `provider`, `model_requested`, `model_deployment`, `latency`, `provider_response_headers`, `raw_request`, and `raw_response`."
			}
		},
		"schemas": {
			"ChatCompletionRequest": {
				"type": "object",
				"description": "OpenAI-compatible chat request fields parsed by the Stogas HTTP API.",
				"additionalProperties": false,
				"required": [
					"model",
					"messages"
				],
				"properties": {
					"model": {
						"type": "string",
						"description": "Catalog model or deployment slug to route to, optionally provider-qualified, such as `gpt-5.5-latest`, `gpt-5.5-flex-latest`, or `openai/gpt-5.5-priority-latest`."
					},
					"provider": {
						"$ref": "#/components/schemas/ProviderRoutingPreference",
						"description": "Optional Stogas-owned routing preference used to select a provider when a public model slug is available from more than one provider. This field is never forwarded upstream."
					},
					"rules": {
						"$ref": "#/components/schemas/ProviderRoutingPreference",
						"description": "Alias for `provider`. Optional Stogas-owned routing preference used to select a provider when a public model slug is available from more than one provider. This field is never forwarded upstream."
					},
					"messages": {
						"type": "array",
						"description": "Conversation messages. Stogas currently accepts text-only content only.",
						"items": {
							"$ref": "#/components/schemas/ChatMessage"
						}
					},
					"audio": {
						"type": "object",
						"description": "Not supported by the text-only Stogas MVP. Requests that set audio are rejected before upstream dispatch.",
						"properties": {
							"format": {
								"type": "string"
							},
							"voice": {
								"type": "string"
							}
						}
					},
					"fallbacks": {
						"type": "array",
						"description": "Not supported. Stogas fallback policy is server-owned and client-supplied fallbacks are rejected.",
						"items": {
							"type": "string"
						}
					},
					"function_call": {
						"description": "Not supported. Deprecated Chat Completions function-calling fields are rejected; use `tools` and `tool_choice`.",
						"oneOf": [
							{
								"type": "string"
							},
							{
								"type": "object"
							}
						]
					},
					"functions": {
						"type": "array",
						"description": "Not supported. Deprecated Chat Completions function definitions are rejected; use `tools`.",
						"items": {
							"type": "object"
						}
					},
					"container": {
						"description": "Not supported. Stateful provider containers require separate lifecycle, isolation, and pricing controls.",
						"oneOf": [
							{
								"type": "string"
							},
							{
								"type": "object"
							}
						]
					},
					"stream": {
						"type": "boolean",
						"default": false
					},
					"frequency_penalty": {
						"type": "number",
						"description": "OpenAI-only Chat Completions frequency penalty. Anthropic deployments reject this field."
					},
					"logit_bias": {
						"type": "object",
						"description": "OpenAI-only token bias map. Values must be numbers because the gateway decodes the request into the OpenAI-compatible schema; provider-owned key semantics are left upstream. Anthropic deployments reject this field.",
						"additionalProperties": {
							"type": "number"
						}
					},
					"logprobs": {
						"type": "boolean",
						"description": "OpenAI-only Chat Completions log probability output. Anthropic deployments reject this field."
					},
					"max_tokens": {
						"type": "integer",
						"minimum": 0,
						"description": "Legacy maximum completion token field. Zero is only accepted for Anthropic cache prewarm requests that include an allowed cache_control marker."
					},
					"max_completion_tokens": {
						"type": "integer",
						"minimum": 0,
						"description": "Maximum completion token cap. Zero is only accepted for Anthropic cache prewarm requests that include an allowed cache_control marker."
					},
					"metadata": {
						"type": "object",
						"description": "Application metadata for Stogas telemetry only. Stogas validates this object, logs it internally, and removes it before upstream dispatch.",
						"maxProperties": 16,
						"propertyNames": {
							"type": "string",
							"minLength": 1,
							"maxLength": 64
						},
						"additionalProperties": {
							"type": "string",
							"maxLength": 512
						}
					},
					"modalities": {
						"type": "array",
						"description": "Text-only MVP: when present, this must be exactly [\"text\"]. Image and audio modalities are rejected before upstream dispatch.",
						"items": {
							"type": "string",
							"enum": [
								"text"
							]
						}
					},
					"n": {
						"type": "integer",
						"description": "Number of choices to generate. Stogas currently accepts only omitted or `1`; larger values are rejected before upstream dispatch.",
						"minimum": 1,
						"maximum": 1
					},
					"parallel_tool_calls": {
						"type": "boolean",
						"description": "Whether the model may call multiple tools in parallel."
					},
					"prediction": {
						"type": "object",
						"description": "Predicted output content used by compatible OpenAI models to reduce latency."
					},
					"presence_penalty": {
						"type": "number",
						"description": "OpenAI-only Chat Completions presence penalty. Anthropic deployments reject this field."
					},
					"prompt_cache_key": {
						"type": "string",
						"description": "OpenAI-only prompt cache key. Must be non-empty UTF-8 up to 256 bytes and must not contain NUL, CR, or LF. Anthropic deployments reject this field; use `cache_control` instead.",
						"minLength": 1,
						"maxLength": 256
					},
					"prompt_cache_retention": {
						"type": "string",
						"description": "OpenAI-only prompt cache retention policy. Stogas validates that this is a string, normalizes known aliases before dispatch, and rejects this field on Anthropic deployments."
					},
					"prompt_cache_isolation_key": {
						"type": "string",
						"description": "Not supported. This provider-specific cache isolation field is outside the current OpenAI/Anthropic public Stogas surface."
					},
					"cache_control": {
						"type": "object",
						"description": "Anthropic-only prompt caching control. Stogas accepts `{type:\"ephemeral\"}` with optional `ttl:\"5m\"` or `\"1h\"`, validates explicit cache controls on text content/tool blocks, prices cache writes conservatively for holds, and rejects this field on OpenAI deployments.",
						"properties": {
							"type": {
								"type": "string",
								"enum": [
									"ephemeral"
								]
							},
							"ttl": {
								"type": "string",
								"enum": [
									"5m",
									"1h"
								]
							}
						},
						"required": [
							"type"
						],
						"additionalProperties": false
					},
					"reasoning": {
						"type": "object",
						"description": "Reasoning configuration for models that expose reasoning controls.",
						"properties": {
							"enabled": {
								"type": "boolean"
							},
							"effort": {
								"type": "string"
							},
							"display": {
								"type": "string"
							},
							"max_tokens": {
								"type": "integer",
								"minimum": 1
							}
						},
						"additionalProperties": false
					},
					"reasoning_effort": {
						"type": "string",
						"description": "Compatibility shortcut for `reasoning.effort`."
					},
					"reasoning_max_tokens": {
						"type": "integer",
						"minimum": 1,
						"description": "Compatibility shortcut for `reasoning.max_tokens`."
					},
					"response_format": {
						"type": "object",
						"description": "Provider-owned output format constraint. Stogas forwards supported OpenAI-compatible fields and leaves provider-specific format details to the selected upstream provider.",
						"properties": {
							"type": {
								"type": "string"
							},
							"json_schema": {
								"type": "object",
								"properties": {
									"name": {
										"type": "string"
									},
									"schema": {
										"type": "object"
									},
									"strict": {
										"type": "boolean"
									}
								},
								"additionalProperties": true
							}
						},
						"additionalProperties": true
					},
					"task_budget": {
						"type": "object",
						"description": "Anthropic-only advisory token budget object for agentic loops. Provider-owned details are forwarded and do not reduce Stogas billing holds.",
						"additionalProperties": true
					},
					"context_management": {
						"type": "object",
						"description": "Anthropic-only context management object. Provider-owned edit details are forwarded and do not reduce Stogas billing holds.",
						"additionalProperties": true
					},
					"inference_geo": {
						"type": "string",
						"description": "Anthropic-only deployment routing hint. `global` selects standard multi-region pricing, while `us` selects US-only inference pricing. Stogas sends the selected Anthropic `inference_geo` upstream.",
						"enum": [
							"global",
							"us"
						]
					},
					"safety_identifier": {
						"type": "string",
						"description": "Client-supplied safety identifiers are not supported. Stogas sets provider-visible safety/user identifiers from the authenticated API key."
					},
					"seed": {
						"type": "integer",
						"description": "Best-effort deterministic sampling seed for providers that support it."
					},
					"service_tier": {
						"type": "string",
						"description": "Provider service tier selection preserved by the gateway. OpenAI accepts `auto`, `default`, `flex`, and `priority`; `scale` and `provisioned` are not available. Anthropic accepts `auto`, `priority`, `default`, `flex`, `standard`, and `standard_only`; all currently use standard-tier Stogas deployment rates. Anthropic `auto` / `priority` are sent upstream as `auto`, while `default` / `flex` / `standard` / `standard_only` are sent as `standard_only`.",
						"enum": [
							"auto",
							"default",
							"flex",
							"priority",
							"standard",
							"standard_only"
						]
					},
					"speed": {
						"type": "string",
						"description": "Anthropic-only deployment routing hint. `fast` selects cataloged fast-mode deployments where available; `standard` selects normal-speed deployments.",
						"enum": [
							"fast",
							"standard"
						]
					},
					"stream_options": {
						"type": "object",
						"description": "Additional options for streamed Chat Completions. Requires `stream:true`. Stogas accepts `include_usage` and always forces it to `true`; `include_obfuscation` is not supported on Chat Completions.",
						"properties": {
							"include_usage": {
								"type": "boolean"
							}
						},
						"additionalProperties": false
					},
					"stop": {
						"oneOf": [
							{
								"type": "string"
							},
							{
								"type": "array",
								"items": {
									"type": "string"
								}
							}
						],
						"description": "OpenAI-compatible stop sequence or stop sequence array. Stogas validates JSON shape and normalizes the string shorthand to an array before upstream dispatch; provider-owned value limits are left to the selected provider."
					},
					"stop_sequences": {
						"type": "array",
						"description": "Anthropic-only stop sequence alias. Stogas rejects this field on OpenAI deployments and rejects requests that set both `stop` and `stop_sequences`.",
						"items": {
							"type": "string"
						}
					},
					"store": {
						"type": "boolean",
						"description": "Not supported. Provider retention behavior is server-owned; requests that set store are rejected before upstream dispatch, and OpenAI-bound requests are forced to store:false."
					},
					"temperature": {
						"type": "number",
						"default": 1,
						"description": "Sampling temperature. Stogas validates JSON shape only; provider-owned numeric bounds are left to the selected provider. Anthropic deployments reject requests that set both `temperature` and `top_p`."
					},
					"tool_choice": {
						"type": [
							"string",
							"object"
						],
						"description": "Tool choice. Chat Completions accepts `auto`, `none`, `required`, declared function choices, and custom tool choices where supported."
					},
					"tools": {
						"type": "array",
						"description": "Tool definitions. Chat Completions accepts function tools for OpenAI and Anthropic, custom tools where supported, and Anthropic-only `mcp_toolset` entries paired one-to-one with `mcp_servers`.",
						"items": {
							"type": "object"
						}
					},
					"mcp_servers": {
						"type": "array",
						"description": "Anthropic Chat only. Remote MCP server definitions paired one-to-one with `tools[].type=\"mcp_toolset\"`; each server must be `type:\"url\"` with an HTTPS URL and unique name.",
						"items": {
							"type": "object",
							"additionalProperties": false,
							"properties": {
								"type": {
									"type": "string",
									"enum": [
										"url"
									]
								},
								"url": {
									"type": "string",
									"format": "uri"
								},
								"name": {
									"type": "string"
								},
								"authorization_token": {
									"type": "string",
									"description": "Forwarded upstream and redacted from Stogas raw request metadata."
								}
							},
							"required": [
								"type",
								"url",
								"name"
							]
						}
					},
					"top_logprobs": {
						"type": "integer",
						"description": "Provider-owned OpenAI Chat Completions log probability detail."
					},
					"top_k": {
						"type": "integer",
						"description": "Anthropic-only sampling control. Rejected for OpenAI deployments."
					},
					"top_p": {
						"type": "number",
						"description": "Nucleus sampling control. Stogas validates JSON shape only; provider-owned numeric bounds are left to the selected provider. Anthropic deployments reject requests that set both `temperature` and `top_p`."
					},
					"user": {
						"type": "string",
						"description": "Client-supplied user identifiers are not supported. Stogas sets upstream user identity from the authenticated API key."
					},
					"verbosity": {
						"type": "string",
						"description": "Text verbosity preference for models that support it."
					},
					"reasoning_display": {
						"type": "string"
					},
					"web_search_options": {
						"type": "object",
						"properties": {
							"search_context_size": {
								"type": "string",
								"enum": [
									"low",
									"medium",
									"high"
								]
							},
							"user_location": {
								"type": "object",
								"required": [
									"type"
								],
								"properties": {
									"type": {
										"const": "approximate"
									},
									"approximate": {
										"type": "object",
										"properties": {
											"city": {
												"type": "string"
											},
											"country": {
												"type": "string"
											},
											"region": {
												"type": "string"
											},
											"timezone": {
												"type": "string"
											}
										},
										"additionalProperties": false
									}
								},
								"additionalProperties": false
							}
						},
						"additionalProperties": false
					}
				},
				"example": {
					"model": "gpt-5.5-latest",
					"messages": [
						{
							"role": "user",
							"content": "Reflect on the issue of trusting trust"
						}
					],
					"temperature": 0.7
				}
			},
			"ChatCompletionResponse": {
				"type": "object",
				"description": "Chat completion response",
				"properties": {
					"id": {
						"type": "string",
						"description": "Unique completion identifier"
					},
					"object": {
						"type": "string",
						"description": "The object type, which is always \"chat.completion\""
					},
					"created": {
						"type": "integer",
						"description": "Unix timestamp of creation"
					},
					"model": {
						"type": "string",
						"description": "Model used for completion"
					},
					"choices": {
						"type": "array",
						"description": "List of completion choices",
						"items": {
							"$ref": "#/components/schemas/ChatChoice"
						}
					},
					"usage": {
						"$ref": "#/components/schemas/ChatUsage"
					},
					"stogas": {
						"type": "object",
						"title": "Gateway Metadata",
						"description": "Optional Stogas metadata returned when requested with Stogas debug headers.",
						"properties": {
							"provider": {
								"type": "string",
								"description": "The upstream AI provider that served the request"
							},
							"latency": {
								"type": "integer",
								"description": "Total round-trip latency in milliseconds"
							},
							"model_requested": {
								"type": "string",
								"description": "The exact model alias or name requested"
							},
							"model_deployment": {
								"type": "string",
								"description": "The upstream model deployment selected by the gateway"
							},
							"provider_response_headers": {
								"type": "object",
								"additionalProperties": {
									"type": "string"
								},
								"description": "Catalog-approved response headers from the upstream provider"
							},
							"raw_request": {
								"type": [
									"object",
									"array",
									"string",
									"number",
									"boolean",
									"null"
								],
								"description": "The translated upstream provider request, returned when requested."
							},
							"raw_response": {
								"type": [
									"object",
									"array",
									"string",
									"number",
									"boolean",
									"null"
								],
								"description": "The raw upstream provider JSON body, returned when requested."
							}
						}
					}
				},
				"required": [
					"id",
					"object",
					"created",
					"model",
					"choices"
				],
				"example": {
					"id": "8ee3487c-e5b1-4fe0-9dd6-84bc23ddd5f7",
					"object": "chat.completion",
					"created": 1714343120,
					"model": "gpt-5.5",
					"choices": [
						{
							"index": 0,
							"message": {
								"role": "assistant",
								"content": "You can never fully trust code you did not write yourself."
							},
							"finish_reason": "stop"
						}
					],
					"usage": {
						"prompt_tokens": 9,
						"completion_tokens": 11,
						"total_tokens": 20
					},
					"stogas": {
						"provider": "OpenAI",
						"latency": 842,
						"model_requested": "gpt-5.5-latest"
					}
				}
			},
			"ProviderRoutingPreference": {
				"oneOf": [
					{
						"type": "string",
						"description": "Known provider ID or provider slug, such as `openai`, `open-ai`, or `anthropic`."
					},
					{
						"type": "object",
						"additionalProperties": false,
						"anyOf": [
							{
								"required": [
									"only"
								]
							},
							{
								"required": [
									"order"
								]
							}
						],
						"properties": {
							"only": {
								"type": "array",
								"items": {
									"type": "string"
								},
								"minItems": 1,
								"description": "Provider IDs or provider slugs allowed to serve this request."
							},
							"order": {
								"type": "array",
								"items": {
									"type": "string"
								},
								"minItems": 1,
								"description": "Preferred provider order after the optional `only` filter is applied."
							}
						},
						"description": "Stogas-owned provider routing rules. At least one of `only` or `order` is required."
					}
				],
				"description": "Optional Stogas-owned routing preference used to select a provider when a public model slug is available from more than one provider. This field is never forwarded upstream."
			},
			"ChatMessage": {
				"type": "object",
				"required": [
					"role"
				],
				"properties": {
					"name": {
						"type": "string",
						"description": "Optional participant name."
					},
					"role": {
						"type": "string",
						"enum": [
							"system",
							"user",
							"assistant",
							"tool",
							"developer"
						]
					},
					"content": {
						"$ref": "#/components/schemas/ChatMessageContent"
					},
					"tool_call_id": {
						"type": "string",
						"description": "Tool call ID for tool response messages."
					},
					"refusal": {
						"type": "string",
						"description": "Assistant refusal text when provided by the model."
					},
					"audio": {
						"type": "object",
						"description": "Not supported in Chat Completions requests. Stogas is text-only for the MVP and rejects message-level audio before upstream dispatch."
					},
					"reasoning": {
						"type": "string",
						"description": "Reasoning output when returned by the provider."
					},
					"reasoning_details": {
						"type": "array",
						"items": {
							"type": "object"
						}
					},
					"annotations": {
						"type": "array",
						"items": {
							"type": "object"
						}
					},
					"tool_calls": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ChatToolCall"
						}
					}
				}
			},
			"ChatChoice": {
				"type": "object",
				"description": "Chat completion choice",
				"properties": {
					"index": {
						"type": "integer",
						"description": "Choice index"
					},
					"message": {
						"$ref": "#/components/schemas/ChatAssistantMessage"
					},
					"finish_reason": {
						"type": "string",
						"description": "Reason why the model stopped generating",
						"enum": [
							"stop",
							"length",
							"tool_calls",
							"content_filter",
							"error"
						]
					}
				},
				"required": [
					"index",
					"message",
					"finish_reason"
				]
			},
			"ChatUsage": {
				"type": "object",
				"description": "Token usage statistics",
				"properties": {
					"prompt_tokens": {
						"type": "integer",
						"description": "Number of tokens in the prompt"
					},
					"completion_tokens": {
						"type": "integer",
						"description": "Number of tokens in the completion"
					},
					"total_tokens": {
						"type": "integer",
						"description": "Total number of tokens used"
					}
				},
				"required": [
					"prompt_tokens",
					"completion_tokens",
					"total_tokens"
				]
			},
			"ErrorResponse": {
				"type": "object",
				"properties": {
					"error": {
						"type": "object",
						"properties": {
							"message": {
								"type": "string"
							},
							"type": {
								"type": "string"
							}
						}
					}
				}
			},
			"ChatMessageContent": {
				"description": "Message content as either a string or an array of content blocks.",
				"oneOf": [
					{
						"type": "string"
					},
					{
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ChatContentBlock"
						}
					}
				]
			},
			"ChatToolCall": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string"
					},
					"type": {
						"type": "string",
						"enum": [
							"function"
						]
					},
					"function": {
						"type": "object",
						"properties": {
							"name": {
								"type": "string"
							},
							"arguments": {
								"type": "string"
							}
						}
					}
				}
			},
			"ChatAssistantMessage": {
				"type": "object",
				"description": "Assistant message",
				"properties": {
					"role": {
						"type": "string",
						"enum": [
							"assistant"
						]
					},
					"content": {
						"$ref": "#/components/schemas/ChatMessageContent",
						"description": "Assistant message content"
					},
					"tool_calls": {
						"type": "array",
						"description": "Tool calls made by the assistant",
						"items": {
							"$ref": "#/components/schemas/ChatToolCall"
						}
					}
				},
				"required": [
					"role"
				]
			},
			"ChatContentBlock": {
				"type": "object",
				"description": "Text-only chat content block accepted by Stogas.",
				"required": [
					"type"
				],
				"properties": {
					"type": {
						"type": "string",
						"enum": [
							"text"
						]
					},
					"text": {
						"type": "string"
					}
				}
			}
		},
		"responses": {
			"BadRequest": {
				"description": "<span className=\"text-red-500 font-bold\">Bad Request:</span> The request was malformed, missing required fields, or specifying an unavailable model.",
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/ErrorResponse"
						},
						"example": {
							"error": {
								"message": "Invalid text completion request: the 'messages' array cannot be empty.",
								"type": "invalid_request_error"
							}
						}
					}
				}
			},
			"Unauthorized": {
				"description": "<span className=\"text-red-500 font-bold\">Unauthorized:</span> The API key provided was missing or invalid.",
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/ErrorResponse"
						},
						"example": {
							"error": {
								"message": "Invalid API key",
								"type": "authentication_error"
							}
						}
					}
				}
			},
			"PaymentRequired": {
				"description": "<span className=\"text-red-500 font-bold\">Payment Required:</span> Returned when your account balance is insufficient or the API key lifetime or recurring spend limit is exhausted.",
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/ErrorResponse"
						},
						"example": {
							"error": {
								"message": "Insufficient balance. Please add funds to your Stogas account to continue making requests.",
								"type": "billing_error"
							}
						}
					}
				}
			},
			"Forbidden": {
				"description": "<span className=\"text-red-500 font-bold\">Forbidden:</span> The API key is disabled or expired. Expired keys are disabled automatically before the error is returned.",
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/ErrorResponse"
						},
						"example": {
							"error": {
								"message": "API key is disabled",
								"type": "permission_denied"
							}
						}
					}
				}
			},
			"NotFound": {
				"description": "<span className=\"text-red-500 font-bold\">Not Found:</span> The requested endpoint route does not exist.",
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/ErrorResponse"
						},
						"example": {
							"error": {
								"message": "Not Found: The requested endpoint '/v1/chat/compl' does not exist.",
								"type": "invalid_request_error"
							}
						}
					}
				}
			},
			"Conflict": {
				"description": "<span className=\"text-red-500 font-bold\">Conflict:</span> The gateway request ID was already finalized, expired, or reused with different hold parameters. Generate a new request ID and retry.",
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/ErrorResponse"
						},
						"example": {
							"error": {
								"message": "Request already finalized; generate a new requestId",
								"type": "invalid_request_error"
							}
						}
					}
				}
			},
			"PayloadTooLarge": {
				"description": "<span className=\"text-red-500 font-bold\">Payload Too Large:</span> The request body exceeds the gateway's maximum allowed size.",
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/ErrorResponse"
						},
						"example": {
							"error": {
								"message": "Payload Too Large: The request body exceeds the maximum allowed size of 100MB.",
								"type": "invalid_request_error"
							}
						}
					}
				}
			},
			"RateLimited": {
				"description": "<span className=\"text-red-500 font-bold\">Rate Limited:</span> The API key token bucket does not currently have capacity for another request.",
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/ErrorResponse"
						},
						"example": {
							"error": {
								"message": "API key rate limit exceeded",
								"type": "rate_limit_error"
							}
						}
					}
				}
			},
			"InternalError": {
				"description": "<span className=\"text-red-500 font-bold\">Internal Server Error:</span> An unexpected error occurred within the gateway or upstream provider.",
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/ErrorResponse"
						},
						"example": {
							"error": {
								"message": "Upstream provider error",
								"type": "gateway_error"
							}
						}
					}
				}
			},
			"ServiceUnavailable": {
				"description": "<span className=\"text-red-500 font-bold\">Service Unavailable:</span> The gateway could not reach the billing database while placing the authorization hold. The provider is not called and no usage telemetry is written.",
				"content": {
					"application/json": {
						"schema": {
							"$ref": "#/components/schemas/ErrorResponse"
						},
						"example": {
							"error": {
								"message": "Gateway billing database unavailable",
								"type": "gateway_error"
							}
						}
					}
				}
			}
		}
	},
	"tags": [
		{
			"name": "OpenAI-compatible",
			"description": "Model inference endpoints."
		}
	],
	"security": [
		{
			"bearerAuth": []
		},
		{
			"authorizationHeader": []
		},
		{
			"apiKeyHeader": []
		},
		{
			"xApiKeyHeader": []
		},
		{
			"xGoogApiKeyHeader": []
		}
	]
}