{"openapi":"3.1.0","info":{"title":"Fire Mission API","version":"1.0.0","description":"Fire Mission is a BYOK AI gateway that speaks the OpenAI and Anthropic wire formats. Point your existing SDK at `https://firemission.us/v1` and change only the API key. Every call passes through mandatory security scanning (PII, prompt-injection, key leakage), geopolitical provider authorization, model-substitution detection, and per-key spend caps. No raw prompt or completion bytes are persisted (Two-Plane isolation).","contact":{"name":"Fire Mission Support","url":"https://firemission.us/contact"},"license":{"name":"Proprietary"}},"servers":[{"url":"https://firemission.us/v1","description":"Production"}],"security":[{"BearerAuth":[]},{"AnthropicKey":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"fm_live_...","description":"OpenAI surface — pass your Fire Mission key as `Authorization: Bearer fm_live_...`."},"AnthropicKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"Anthropic surface — pass your Fire Mission key as `x-api-key: fm_live_...`."}},"schemas":{"ChatCompletionRequest":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string","description":"Model id reachable on your tier (e.g. `gpt-4o-mini`, `gpt-4.1`). Use `firemission/auto` to opt into MoE routing.","example":"gpt-4o-mini"},"messages":{"type":"array","items":{"type":"object","required":["role"],"properties":{"role":{"type":"string","enum":["system","user","assistant","tool"]},"content":{"oneOf":[{"type":"string"},{"type":"array"}]},"name":{"type":"string"},"tool_call_id":{"type":"string"}}}},"stream":{"type":"boolean","default":false,"description":"Server-Sent Events stream when true."},"temperature":{"type":"number","minimum":0,"maximum":2},"top_p":{"type":"number","minimum":0,"maximum":1},"max_tokens":{"type":"integer","minimum":1},"n":{"type":"integer","minimum":1},"tools":{"type":"array","items":{"type":"object"}},"tool_choice":{"oneOf":[{"type":"string"},{"type":"object"}]},"response_format":{"type":"object","description":"JSON mode: `{ \"type\": \"json_object\" }`."},"user":{"type":"string"}}},"ChatCompletionResponse":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["chat.completion"]},"created":{"type":"integer"},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"message":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string","nullable":true},"tool_calls":{"type":"array","items":{"type":"object"}}}},"finish_reason":{"type":"string","nullable":true}}}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer"},"completion_tokens":{"type":"integer"},"total_tokens":{"type":"integer"}}}}},"MessagesRequest":{"type":"object","required":["model","messages","max_tokens"],"properties":{"model":{"type":"string","example":"claude-3-5-sonnet-latest"},"messages":{"type":"array","items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"oneOf":[{"type":"string"},{"type":"array"}]}}}},"max_tokens":{"type":"integer","minimum":1},"system":{"type":"string"},"stream":{"type":"boolean","default":false},"temperature":{"type":"number"},"top_p":{"type":"number"},"top_k":{"type":"integer"},"tools":{"type":"array","items":{"type":"object"}},"tool_choice":{"type":"object"}}},"MessagesResponse":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["message"]},"role":{"type":"string","enum":["assistant"]},"model":{"type":"string"},"content":{"type":"array","items":{"type":"object"}},"stop_reason":{"type":"string","nullable":true},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"}}}}},"EmbeddingsRequest":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","example":"text-embedding-3-small"},"input":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"encoding_format":{"type":"string","enum":["float","base64"]},"dimensions":{"type":"integer"},"user":{"type":"string"}}},"EmbeddingsResponse":{"type":"object","properties":{"object":{"type":"string","enum":["list"]},"model":{"type":"string"},"data":{"type":"array","items":{"type":"object","properties":{"object":{"type":"string","enum":["embedding"]},"index":{"type":"integer"},"embedding":{"type":"array","items":{"type":"number"}}}}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer"},"total_tokens":{"type":"integer"}}}}},"ModelsResponse":{"type":"object","properties":{"object":{"type":"string","enum":["list"]},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","enum":["model"]},"created":{"type":"integer"},"owned_by":{"type":"string"}}}}}},"GatewayRequest":{"type":"object","required":["operation"],"properties":{"operation":{"type":"string","example":"ai.proxy","description":"Operation id. Examples: `ai.proxy`, `ai.cost`, `ai.models`, `metrics.cost`, `metrics.rate-limits`, `provider.list`, `provider.create`, `org.api-keys.list`, `org.service-account.create`, `org.api-key.revoke`."},"params":{"type":"object","additionalProperties":true}}},"GatewayResponse":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","additionalProperties":true},"error":{"type":"string","nullable":true}}},"ErrorEnvelopeOpenAI":{"type":"object","required":["error"],"properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string","example":"invalid_request_error"},"code":{"type":"string","nullable":true,"example":"monthly_cap_exceeded"},"param":{"type":"string","nullable":true}}}}},"ErrorEnvelopeAnthropic":{"type":"object","required":["type","error"],"properties":{"type":{"type":"string","enum":["error"]},"error":{"type":"object","properties":{"type":{"type":"string","example":"rate_limit_error"},"message":{"type":"string"}}}}}}},"tags":[{"name":"OpenAI","description":"OpenAI-compatible surface (Chat, Embeddings, Models)."},{"name":"Anthropic","description":"Anthropic-compatible Messages surface."}],"paths":{"/chat/completions":{"post":{"tags":["OpenAI"],"operationId":"createChatCompletion","summary":"Create a chat completion","description":"OpenAI-compatible chat completion. Supports streaming (SSE), tools, JSON mode, vision, and the `firemission/auto` MoE alias. Set `x-fm-route: cost|speed|quality|balanced` to engage MoE routing.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"}}}},"responses":{"200":{"description":"Completion (or `text/event-stream` when `stream=true`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelopeOpenAI"}}}},"401":{"description":"Invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelopeOpenAI"}}}},"403":{"description":"Provider blocked by policy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelopeOpenAI"}}}},"429":{"description":"Rate limit / spend cap / monthly cap exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelopeOpenAI"}}}},"502":{"description":"Model substitution detected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelopeOpenAI"}}}}}}},"/embeddings":{"post":{"tags":["OpenAI"],"operationId":"createEmbeddings","summary":"Create text embeddings","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingsRequest"}}}},"responses":{"200":{"description":"Embeddings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingsResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelopeOpenAI"}}}},"429":{"description":"Cap exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelopeOpenAI"}}}}}}},"/models":{"get":{"tags":["OpenAI"],"operationId":"listModels","summary":"List models reachable on your tier","description":"Returns the union of (1) every BYOK provider you have configured and (2) the catalog entries from llmMetadata that match those providers. Every entry is policy-cleared via the central authorization choke point — entries you cannot call don't appear in the list.","responses":{"200":{"description":"List of models","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelsResponse"}}}}}}},"/messages":{"post":{"tags":["Anthropic"],"operationId":"createMessage","summary":"Create a message (Anthropic-compatible)","description":"Anthropic Messages-shape endpoint. Serves Anthropic directly and AWS Bedrock for `anthropic.*` model ids. Streaming and tool use are pass-through.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagesRequest"}}}},"responses":{"200":{"description":"Message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagesResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelopeAnthropic"}}}},"401":{"description":"Invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelopeAnthropic"}}}},"404":{"description":"Unknown model","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelopeAnthropic"}}}},"429":{"description":"Rate limit / cap exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelopeAnthropic"}}}}}}}}}