Martian Messages API

The Messages API from Martian — 1 operation(s) for messages.

Operations 1

POST /v1/messages Create a routed message (Anthropic-compatible) #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/martian-ai-messages-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

martian-ai-messages-api-openapi.yml Raw ↑
openapi: 3.2.0
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:
    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'
    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.
    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.