Create a gateway
create_gatewayCreate 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
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | Data handling. Left out: no constraint. | |
| kind | No | chat routes the requests your code sends; decision is a classifier: its default model is a decision model and its questions are saved here. | chat |
| name | Yes | Its 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. | |
| cache | No | The exact same request gets the kept answer, free, for max_age_s seconds; null for no cache. | |
| retry | No | Retries on every target; a target's own retry replaces it. null for none. | |
| speed | No | The 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. | |
| region | No | A region pin: eu keeps requests under this gateway off community-supplied capacity. Left out or null: none. | |
| targets | No | The models of a fallback or a split, in order: at least two for either, at most 10. Empty for single. | |
| io_ratio | No | The 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. | |
| strategy | No | How a request picks its model. | |
| max_price | No | The 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. | |
| questions | No | Decision gateways: the questions by name (1 to 40 characters of a-z, 0-9 and _, starting with a letter), 1 to 128 of them. | |
| guardrails | No | Chat 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_bodies | No | Logging prompts and answers is not available yet: leave it false. | |
| rate_limit | No | Requests a minute per key through this gateway; null for no limit. | |
| allow_models | No | Model ids, or patterns with *, the gateway lets through; any other model is 403 model_not_allowed. null for any model. | |
| instructions | No | Decision gateways: a context line, what the text is. Left out when empty. | |
| min_discount | No | The 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_model | No | The 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). | |
| idempotencyKey | No | Optional. A unique string so that repeating this call never creates twice. | |
| community_supply | No | Whether 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_ms | No | A deadline for the whole request, fallbacks and retries included, in milliseconds (1,000 to 600,000); null for none. |