openapi: 3.0.1 info: title: Martian Gateway Chat Completions Messages API description: OpenAPI specification for the Martian Gateway, an LLM model router. The Gateway exposes an OpenAI-compatible chat completions endpoint, an Anthropic Messages-compatible endpoint, and a models listing endpoint. Requests are routed dynamically across a catalog of provider models. Models are addressed with a provider/model-name string (for example, openai/gpt-4.1-nano). termsOfService: https://www.withmartian.com contact: name: Martian url: https://www.withmartian.com version: '1.0' servers: - url: https://api.withmartian.com description: Martian Gateway production server tags: - name: Messages paths: /v1/messages: post: operationId: createMessage tags: - Messages summary: Create a routed message (Anthropic-compatible) description: Anthropic Messages-compatible endpoint. Supports most parameters of the Anthropic Messages API and routes the request through the Martian Gateway. The model is specified as a provider/model-name string. security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/MessagesRequest' responses: '200': description: An Anthropic-compatible message response. content: application/json: schema: $ref: '#/components/schemas/MessagesResponse' '401': description: Authentication failed (missing or invalid API key). '429': description: Rate limit or quota exceeded. components: schemas: ChatMessage: type: object required: - role - content properties: role: type: string enum: - system - user - assistant - tool description: The role of the author of this message. content: type: string description: The contents of the message. name: type: string description: An optional name for the participant. MessagesResponse: type: object properties: id: type: string type: type: string example: message role: type: string example: assistant model: type: string description: The provider/model-name that the router selected. content: type: array items: type: object properties: type: type: string text: type: string usage: $ref: '#/components/schemas/Usage' MessagesRequest: type: object required: - model - messages - max_tokens properties: model: type: string description: Routing target in provider/model-name format. example: anthropic/claude-sonnet-4 messages: type: array description: Anthropic-style input messages. items: $ref: '#/components/schemas/ChatMessage' max_tokens: type: integer description: The maximum number of tokens to generate. system: type: string description: An optional system prompt. temperature: type: number description: Sampling temperature. stream: type: boolean default: false Usage: type: object properties: prompt_tokens: type: integer completion_tokens: type: integer total_tokens: type: integer securitySchemes: bearerAuth: type: http scheme: bearer description: Provide your Martian API key as a Bearer token in the Authorization header.