Fermat

OpenAI-compatible LLM gateway: pay per request with an API key, signed receipt for each call.

Should I use this

Quality & Safety

A
Description quality
92%
Schema completeness
90%
Naming quality
82%
Poisoning risk
100%
Permission match
100%
Protocol compliance
100%

Findings (3)

  • LOWTool 'docs' description lacks action verbin docs
  • LOWTool 'key' description lacks action verbin key
  • LOWTool 'route_explain' description lacks action verbin route_explain

Based on automated analysis of tool definitions and protocol compliance.

Context Cost

~3,342Tokens (tool definitions)
~2.8 KBTypical response size
Significant attention impact (2.61% of 128k context)

This is the approximate number of tokens consumed each time the server's tools are loaded into a model's context. Higher counts reduce the attention available for other tasks.

Install

One-Click Install

Add this to your `claude_desktop_config.json` file:

{
  "mcpServers": {
    "gateway": {
      "url": "https://mcp.fermat.ai.phase.xyz/mcp"
    }
  }
}

Remote endpoints

https://mcp.fermat.ai.phase.xyz/mcpstreamable-http

What it can do

Tool inventory

Tools (11)

🟢 Read-only🟡 Write🔴 Delete⚪ Unknown
🔴chat(model, prompt, system, messages, max_tokens, ...)

Run a chat completion on the Fermat gateway, paid from the Phase API key or the wallet this server uses (free models cost nothing). Returns the answer, actual price, task id for the receipt and usage.

Input Schema

{
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "description": "model id from list_models, or a class: auto | eco | premium | agentic"
    },
    "prompt": {
      "type": "string",
      "description": "single user message (use messages for multi-turn)"
    },
    "system": {
      "type": "string",
      "description": "optional system prompt"
    },
    "messages": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "description": "system | user | assistant"
          },
          "content": {
            "type": "string"
          }
        },
        "required": [
          "role",
          "content"
        ],
        "additionalProperties": false
      },
      "description": "full conversation; overrides prompt/system"
    },
    "max_tokens": {
      "type": "integer",
      "description": "output cap; also bounds the price ceiling"
    },
    "temperature": {
      "type": [
        "null",
        "number"
      ],
      "description": "sampling temperature 0–2 (Claude ignores it)"
    },
    "session": {
      "type": "string",
      "description": "saved session id (from the session tool or a /s/<id> link): the gateway prepends its history and appends this turn"
    }
  },
  "required": [
    "model"
  ],
  "additionalProperties": false
}

Output Schema

{
  "type": "object",
  "properties": {
    "text": {
      "type": "string"
    },
    "model": {
      "type": "string"
    },
    "routed_model": {
      "type": "string"
    },
    "level": {
      "type": "string"
    },
    "provider": {
      "type": "string"
    },
    "price_usd": {
      "type": "string"
    },
    "ceiling_usd": {
      "type": "string"
    },
    "payment": {
      "type": "string"
    },
    "tx_hash": {
      "type": "string"
    },
    "task_id": {
      "type": "string"
    },
    "batch": {
      "type": "string",
      "description": "payment batch this call was charged to (settled with one transaction later)"
    },
    "session": {
      "type": "string"
    },
    "session_url": {
      "type": "string"
    },
    "receipt_url": {
      "type": "string"
    },
    "elapsed_ms": {
      "type": "integer"
    },
    "usage": {
      "type": "object",
      "properties": {
        "prompt_tokens": {
          "type": "integer"
        },
        "completion_tokens": {
          "type": "integer"
        }
      },
      "required": [
        "prompt_tokens",
        "completion_tokens"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "text",
    "model",
    "provider",
    "price_usd",
    "payment",
    "task_id",
    "elapsed_ms",
    "usage"
  ],
  "additionalProperties": false
}
🔴compare(prompt, system, messages, models, max_tokens)

Run one prompt on 2 to 4 Fermat models or classes at once and compare answer, price, tokens and speed; returns the cheapest, the most expensive and how many times more the expensive one cost. Spends credit for each model. Default models: the cheapest paid chat model, auto, and the most expensive open chat model.

Input Schema

{
  "type": "object",
  "properties": {
    "prompt": {
      "type": "string",
      "description": "single user message (use messages for multi-turn)"
    },
    "system": {
      "type": "string",
      "description": "optional system prompt"
    },
    "messages": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "description": "system | user | assistant"
          },
          "content": {
            "type": "string"
          }
        },
        "required": [
          "role",
          "content"
        ],
        "additionalProperties": false
      },
      "description": "full conversation; overrides prompt/system"
    },
    "models": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": "string"
      },
      "description": "2 to 4 model ids or classes; default: the cheapest paid chat model, auto, and the most expensive open chat model"
    },
    "max_tokens": {
      "type": "integer",
      "description": "output cap for every model (default: none)"
    }
  },
  "additionalProperties": false
}

Output Schema

{
  "type": "object",
  "properties": {
    "results": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "truncated": {
            "type": "boolean",
            "description": "true when text was cut to 2,000 characters"
          },
          "routed_model": {
            "type": "string"
          },
          "level": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "price_usd": {
            "type": "string"
          },
          "tokens": {
            "type": "object",
            "properties": {
              "prompt": {
                "type": "integer"
              },
              "completion": {
                "type": "integer"
              }
            },
            "required": [
              "prompt",
              "completion"
            ],
            "additionalProperties": false
          },
          "elapsed_ms": {
            "type": "integer"
          },
          "task_id": {
            "type": "string"
          },
          "receipt_url": {
            "type": "string"
          },
          "error": {
            "type": "string"
          }
        },
        "required": [
          "model",
          "tokens",
          "elapsed_ms"
        ],
        "additionalProperties": false
      }
    },
    "cheapest": {
      "type": "string",
      "description": "model with the lowest price among the answers"
    },
    "most_expensive": {
      "type": "string",
      "description": "model with the highest price among the answers"
    },
    "ratio": {
      "type": "number",
      "description": "most expensive price divided by the cheapest, one decimal"
    }
  },
  "required": [
    "results"
  ],
  "additionalProperties": false
}
🟢docs(topic)

Fermat documentation in short: connect, pricing (with the live price table), savings, mcp, byok, data, receipts, limits.

Input Schema

{
  "type": "object",
  "properties": {
    "topic": {
      "description": "what to explain",
      "enum": [
        "connect",
        "pricing",
        "savings",
        "mcp",
        "byok",
        "data",
        "receipts",
        "limits"
      ],
      "type": "string"
    }
  },
  "required": [
    "topic"
  ],
  "additionalProperties": false
}

Output Schema

{
  "type": "object",
  "properties": {
    "topic": {
      "type": "string"
    },
    "text": {
      "type": "string"
    }
  },
  "required": [
    "topic",
    "text"
  ],
  "additionalProperties": false
}
🔴embed(model, input)

Compute embeddings on the Fermat gateway (paid from the Phase API key or the wallet).

Input Schema

{
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "description": "embeddings model id"
    },
    "input": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "model",
    "input"
  ],
  "additionalProperties": false
}

Output Schema

{
  "type": "object",
  "properties": {
    "vectors": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": [
          "null",
          "array"
        ],
        "items": {
          "type": "number"
        }
      }
    },
    "price_usd": {
      "type": "string"
    },
    "payment": {
      "type": "string"
    }
  },
  "required": [
    "vectors",
    "price_usd",
    "payment"
  ],
  "additionalProperties": false
}
🟢key

Balance, daily cap and spend of the Phase API key this server pays with (key mode).

Input Schema

{
  "type": "object",
  "additionalProperties": false
}

Output Schema

{
  "type": "object",
  "properties": {
    "key": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "additionalProperties": false
}
🟢list_models(layer)

List models of the Fermat gateway with prices (USD per 1M tokens, fee per call) and layer (flagship | open | class | free).

Input Schema

{
  "type": "object",
  "properties": {
    "layer": {
      "type": "string",
      "description": "optional filter: flagship | open | class | free"
    }
  },
  "additionalProperties": false
}

Output Schema

{
  "type": "object",
  "properties": {
    "gateway": {
      "type": "string"
    },
    "wallet": {
      "type": "string"
    },
    "models": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "layer": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "context_window": {
            "type": "integer"
          },
          "input_usd_per_1m": {
            "type": "string"
          },
          "output_usd_per_1m": {
            "type": "string"
          },
          "per_call_usd": {
            "type": "string"
          },
          "free": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "layer",
          "kind",
          "context_window",
          "input_usd_per_1m",
          "output_usd_per_1m",
          "per_call_usd",
          "free"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "gateway",
    "models"
  ],
  "additionalProperties": false
}
🟢quote(model, prompt, system, messages, max_tokens, ...)

Get the price ceiling for a chat request without paying (the gateway's 402 quote).

Input Schema

{
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "description": "model id from list_models, or a class: auto | eco | premium | agentic"
    },
    "prompt": {
      "type": "string",
      "description": "single user message (use messages for multi-turn)"
    },
    "system": {
      "type": "string",
      "description": "optional system prompt"
    },
    "messages": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "description": "system | user | assistant"
          },
          "content": {
            "type": "string"
          }
        },
        "required": [
          "role",
          "content"
        ],
        "additionalProperties": false
      },
      "description": "full conversation; overrides prompt/system"
    },
    "max_tokens": {
      "type": "integer",
      "description": "output cap; also bounds the price ceiling"
    },
    "temperature": {
      "type": [
        "null",
        "number"
      ],
      "description": "sampling temperature 0–2 (Claude ignores it)"
    },
    "session": {
      "type": "string",
      "description": "saved session id (from the session tool or a /s/<id> link): the gateway prepends its history and appends this turn"
    }
  },
  "required": [
    "model"
  ],
  "additionalProperties": false
}

Output Schema

{
  "type": "object",
  "properties": {
    "model": {
      "type": "string"
    },
    "ceiling_usd": {
      "type": "string"
    },
    "per_call_usd": {
      "type": "string"
    },
    "input_tokens_estimate": {
      "type": "integer"
    },
    "max_output_tokens_priced": {
      "type": "integer"
    },
    "input_usd_per_1m": {
      "type": "string"
    },
    "output_usd_per_1m": {
      "type": "string"
    },
    "network": {
      "type": "string"
    },
    "free": {
      "type": "boolean"
    },
    "wallet_can_pay": {
      "type": "boolean"
    },
    "paid_by_key": {
      "type": "boolean",
      "description": "true when a Phase API key pays: its balance and daily cap apply, max_usd_per_call does not"
    },
    "max_usd_per_call": {
      "type": "string",
      "description": "largest quote the wallet will sign (wallet mode only)"
    }
  },
  "required": [
    "model",
    "ceiling_usd",
    "per_call_usd",
    "input_tokens_estimate",
    "max_output_tokens_priced",
    "input_usd_per_1m",
    "output_usd_per_1m",
    "network",
    "free",
    "wallet_can_pay"
  ],
  "additionalProperties": false
}
🟢receipt(task_id)

Fetch the public receipt of a paid request by task id (model, provider, tokens, price, settlement tx, request/response hashes, signatures) and its Merkle proof once the weekly epoch is closed.

Input Schema

{
  "type": "object",
  "properties": {
    "task_id": {
      "type": "string",
      "description": "task id from chat / embed (0x…)"
    }
  },
  "required": [
    "task_id"
  ],
  "additionalProperties": false
}

Output Schema

{
  "type": "object",
  "properties": {
    "receipt": {
      "type": "object",
      "additionalProperties": true
    },
    "proof": {
      "type": "object",
      "additionalProperties": true
    },
    "epoch_state": {
      "type": "string"
    },
    "url": {
      "type": "string"
    }
  },
  "required": [
    "receipt",
    "epoch_state",
    "url"
  ],
  "additionalProperties": false
}
🟢route_explain(task_id)

Explain one Fermat request from its public receipt: the model or class it named, the complexity level, the model and provider that served it, the price, the price of the class baseline model and the saving in percent, and the providers tried.

Input Schema

{
  "type": "object",
  "properties": {
    "task_id": {
      "type": "string",
      "description": "task id from chat / embed (0x…)"
    }
  },
  "required": [
    "task_id"
  ],
  "additionalProperties": false
}

Output Schema

{
  "type": "object",
  "properties": {
    "task_id": {
      "type": "string"
    },
    "requested": {
      "type": "string",
      "description": "model or class the request named"
    },
    "is_class": {
      "type": "boolean"
    },
    "level": {
      "type": "string",
      "description": "complexity level the classifier gave the request"
    },
    "routed_model": {
      "type": "string"
    },
    "provider": {
      "type": "string"
    },
    "price_usd": {
      "type": "string"
    },
    "baseline_usd": {
      "type": "string",
      "description": "price of the same usage on the class baseline model"
    },
    "saved_usd": {
      "type": "string"
    },
    "saving_percent": {
      "type": "number"
    },
    "attempts": {
      "type": "integer",
      "description": "providers tried, the one that served included"
    },
    "failed_attempts": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "explanation": {
      "type": "string"
    },
    "receipt_url": {
      "type": "string"
    }
  },
  "required": [
    "task_id",
    "requested",
    "is_class",
    "routed_model",
    "provider",
    "price_usd",
    "explanation",
    "receipt_url"
  ],
  "additionalProperties": false
}
🔴session(action, id, model, system, title)

Saved chat sessions on the Fermat gateway: create one (returns an id and a shareable /s/<id> link), read its thread, list the wallet's sessions (wallet mode only: signed with the wallet key, no transaction), or delete one. Pass the id as `session` to chat and the gateway carries the context between turns and visits.

Input Schema

{
  "type": "object",
  "properties": {
    "action": {
      "type": "string",
      "description": "create | get | list | delete"
    },
    "id": {
      "type": "string",
      "description": "session id (get, delete)"
    },
    "model": {
      "type": "string",
      "description": "create: model the session starts with (informational; each chat names its own)"
    },
    "system": {
      "type": "string",
      "description": "create: system prompt kept for every turn"
    },
    "title": {
      "type": "string",
      "description": "create: title (defaults to the first message)"
    }
  },
  "required": [
    "action"
  ],
  "additionalProperties": false
}

Output Schema

{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "url": {
      "type": "string"
    },
    "model": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "system": {
      "type": "string"
    },
    "messages": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "requests": {
      "type": "integer"
    },
    "spent_usd": {
      "type": "string"
    },
    "expires_at": {
      "type": "string"
    },
    "deleted": {
      "type": "boolean"
    },
    "sessions": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    }
  },
  "required": [
    "id",
    "url",
    "messages",
    "requests",
    "spent_usd",
    "expires_at"
  ],
  "additionalProperties": false
}
🟢usage(days)

Spend and savings of the Fermat API key over the last N days (1 to 90, default 7): totals, per day and per model when the gateway has the history (source usage), otherwise the key's totals (source key). Key mode only.

Input Schema

{
  "type": "object",
  "properties": {
    "days": {
      "type": "integer",
      "description": "period in days, 1 to 90 (default 7)"
    }
  },
  "additionalProperties": false
}

Output Schema

{
  "type": "object",
  "properties": {
    "source": {
      "type": "string",
      "description": "usage: per-day history from /v1/key/usage; key: totals only from /v1/key"
    },
    "days": {
      "type": "integer"
    },
    "requests": {
      "type": "integer"
    },
    "spent_usd": {
      "type": "string"
    },
    "saved_usd": {
      "type": "string"
    },
    "spent_today_usd": {
      "type": "string"
    },
    "available_usd": {
      "type": "string"
    },
    "daily_cap_usd": {
      "type": "string"
    },
    "per_day": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "per_model": {
      "type": [
        "null",
        "array"
      ],
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    }
  },
  "required": [
    "source",
    "days",
    "requests",
    "spent_usd"
  ],
  "additionalProperties": false
}

Community

Rate this Server

Evidence

Recent observations

verifiedversion not recorded11 tools