Skip to main content
Glama

Create a gateway

create_gateway

Create a gateway

Saves a new gateway from its config, validated and normalized; the stored config comes back. The name is its id here and in the x-klinn-gateway header: a-z, 0-9 and -, at most 48 characters, and not new, playground, rules or templates (the console's own pages); a name already in use is 409 conflict. A chat gateway needs only a name; a fallback or a split needs at least two targets. A decision gateway (kind decision) needs a default_model that is a decision model (kind decisions in the list_models tool) and 1 to 128 questions. At most 50 gateways an account. Keys are attached with the update_key tool. At most 50 gateways per account: past it, 409 limit_reached.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "name": "<name>"
    },
    "name": "create_gateway"
  }
}

Input Schema

NameRequiredDescriptionDefault
dataNoData handling. Left out: no constraint.
kindNochat routes the requests your code sends; decision is a classifier: its default model is a decision model and its questions are saved here.chat
nameYesIts id in this API and in the x-klinn-gateway header: 1 to 48 characters of a-z, 0-9 and -, starting and ending with a letter or digit. new, playground, rules and templates are reserved for the console's own pages: a new gateway or a rename cannot take them.
cacheNoThe exact same request gets the kept answer, free, for max_age_s seconds; null for no cache.
retryNoRetries on every target; a target's own retry replaces it. null for none.
speedNoThe default speed of chat requests under this gateway: how they pick among routes ({sort, minThroughput, maxLatencySecs}; cheapest, balanced, fastest or a custom floor and ceiling, see /docs/speed). It comes before the key's speed, field by field: a floor or ceiling it leaves out falls to the key's. A request's own sort, min_throughput and max_latency settings come first, then a :nitro / :floor model suffix. An explicit {sort: price} puts the sort back to cheapest over a faster key. max_price still caps the price. Left out: none. Not on a decision gateway.
regionNoA region pin: eu keeps requests under this gateway off community-supplied capacity. Left out or null: none.
targetsNoThe models of a fallback or a split, in order: at least two for either, at most 10. Empty for single.
io_ratioNoThe expected input:output token ratio of chat requests under this gateway, as input tokens per output token (15 for 15:1). Their routes are ranked at it instead of at max_tokens (see /docs/speed#io-ratio). It replaces the key's ioRatio; a request's own x-klinn-io-ratio header comes first. Ranking only: holds, limits, max_price and the bill are unchanged. Left out: none. Not on a decision gateway.
strategyNoHow a request picks its model.
max_priceNoThe default limit order of chat requests under this gateway: they are billed at most this per 1M tokens, or refused with 422 no_offer_under_limit when nothing in the market is within it. It replaces the key's maxPrice; a request's own limit (its max_price field or the x-max-price header) comes first. Left out: none. Not on a decision gateway.
questionsNoDecision gateways: the questions by name (1 to 40 characters of a-z, 0-9 and _, starting with a letter), 1 to 128 of them.
guardrailsNoChat gateways: checks on every message of each request, whole, run by a decision model before the model is called (https://docs.opencheap.si/guardrails). null for none; a string (an old policy name) also reads as none. A decision gateway takes none: its /v1/systemone calls are not checked.
log_bodiesNoLogging prompts and answers is not available yet: leave it false.
rate_limitNoRequests a minute per key through this gateway; null for no limit.
allow_modelsNoModel ids, or patterns with *, the gateway lets through; any other model is 403 model_not_allowed. null for any model.
instructionsNoDecision gateways: a context line, what the text is. Left out when empty.
min_discountNoThe default minimum discount of chat requests under this gateway: they are served only at least this many percent under the model's list price, or refused with 422 no_offer_under_limit when nothing in the market is. The strictest of it, the key's minDiscount and the request's own (the min_discount field or the x-min-discount header) applies. Left out: none. Not on a decision gateway.
default_modelNoThe model a request with model "default" (or none) gets; null for the request's own model. A decision gateway needs one, and it must be a decision model (kind decisions in GET /models).
idempotencyKeyNoOptional. A unique string so that repeating this call never creates twice.
community_supplyNoWhether community-supplied capacity (first-party vendor capacity other accounts list, under the same no-training terms) may serve requests under this gateway. Left out: on. A decision gateway never uses it: it may not be set true there.
request_timeout_msNoA deadline for the whole request, fallbacks and retries included, in milliseconds (1,000 to 600,000); null for none.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations (readOnly=false, destructive=false, idempotent=false), the description discloses validation and normalization on write, the returned stored config, reserved names, the 409 name-conflict outcome, and a hard per-account ceiling of 50 gateways returning 409 limit_reached. Those are exactly the failure modes an agent needs before firing a non-idempotent create.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The first paragraph is front-loaded with the verb, the write behavior and the name contract, which is the right order. It loses a point for redundancy: the 50-gateway ceiling appears twice in slightly different wording ('At most 50 gateways an account' and again with the error code), and the header merely restates the title.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 22-parameter, deeply nested creation tool with no output schema, the description supplies the return statement ('the stored config comes back'), per-kind prerequisites, reserved-name and limit constraints, and points to `list_models` for validating a decision model. An agent has enough to call it correctly without guessing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already explains name, kind, targets, default_model, questions and every nested field; the baseline of 3 applies. The description adds genuine cross-field semantics (kind determines which parameters become mandatory, minimum target count), but repeats the name rules and does not touch the majority of the 22 parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource ('Saves a new gateway from its config') and immediately states the outcome (validated, normalized, config returned). It further splits the resource into its three shapes (chat, fallback/split, decision), so an agent knows exactly what it would be creating and what each shape demands.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives concrete preconditions per case: a chat gateway needs only a name, a fallback or split needs at least two targets, a decision gateway needs a decision-kind default_model and 1-128 questions, and keys are attached afterwards with the `update_key` tool. It does not explicitly say when to prefer a sibling (e.g. `update_gateway` for an existing gateway) or what happens if the wrong kind is chosen, so the routing is implied rather than spelled out.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources