{
  "openapi": "3.1.1",
  "info": {
    "title": "Morse API",
    "version": "1",
    "description": "The Morse API serves chat models through an OpenAI-compatible interface. Each request pays with your Morse account's credits.\n\nSend an API key from the Morse app with every request, in the Authorization header as Bearer sk_morse_.... Send it to https://inference.trymorse.ai, the inference door, where TLS ends inside the enclave. https://api.trymorse.ai serves the Morse app and refuses any key. It returns 403 use_inference_door, or 404 wrong_host at a path it does not serve, and both name the door's base URL. A key acts for its account and always pays with credits, never with a plan's included use. One credit is $0.01. GET /v1/models lists prices in micro-dollars, 10,000 to the credit. Keep keys on your server. Browsers on other sites cannot call the API.\n\nAll of an account's keys and its owner's use of the Morse app share two limits. One is a budget of requests per minute, and one a limit on requests in flight. The account's plan sets both. A request refused for either limit carries Retry-After, the number of seconds to wait. A retried POST is a new request, and the API charges it again.\n\nAn error response is JSON in the Error shape, with a stable code. At the inference door, a path the API does not serve, or a method a path does not take, returns 404 not_found."
  },
  "servers": [
    {
      "url": "https://inference.trymorse.ai"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "summary": "Create a chat completion",
        "description": "Sends a conversation to a model and returns the model's response, whole or as a stream. The request and the response follow OpenAI's chat completions format. Each parameter below notes where Morse differs.\n\nBefore the call, the account must hold enough credit for the most the request could cost. That is the prompt plus the output limit, at the model's prices. After the call, the account pays for the tokens the provider reports. If a stream stops early, the account pays for what the stream delivered. A retried request that reached the model costs again. Each response's X-Request-Id identifies the request.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              },
              "example": {
                "model": "kimi-k3",
                "messages": [
                  {
                    "role": "system",
                    "content": "Answer in one sentence."
                  },
                  {
                    "role": "user",
                    "content": "What does a TEE attest?"
                  }
                ],
                "max_completion_tokens": 200
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The response. When stream is true, the body is server-sent events. Each data line is a ChatCompletionChunk, and the stream ends with data: [DONE]. If the provider fails after the first event, the stream ends with one error event in the Error shape and no [DONE]. Some reasoning models send a : keepalive comment every 25 seconds while they reason.",
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Funding": {
                "$ref": "#/components/headers/X-Funding"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-Output-Limited": {
                "$ref": "#/components/headers/X-Output-Limited"
              },
              "X-Tier": {
                "$ref": "#/components/headers/X-Tier"
              },
              "X-Model-Successor": {
                "$ref": "#/components/headers/X-Model-Successor"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                },
                "example": {
                  "id": "chatcmpl-YYOKD77FV2J75JOVRH6T77B4GZ",
                  "object": "chat.completion",
                  "created": 1792187800,
                  "model": "kimi-k3",
                  "choices": [
                    {
                      "index": 0,
                      "message": {
                        "role": "assistant",
                        "content": "A TEE attests which code runs inside it, signed by keys the hardware vendor vouches for."
                      },
                      "finish_reason": "stop"
                    }
                  ],
                  "usage": {
                    "prompt_tokens": 24,
                    "completion_tokens": 19,
                    "total_tokens": 43
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "x-event-schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ChatCompletionChunk"
                    },
                    {
                      "$ref": "#/components/schemas/Error"
                    }
                  ]
                },
                "example": "data: {\"id\":\"chatcmpl-YYOKD77FV2J75JOVRH6T77B4GZ\",\"object\":\"chat.completion.chunk\",\"created\":1792187800,\"model\":\"kimi-k3\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"A TEE\"},\"finish_reason\":null}],\"obfuscation\":\"Xg7U0KyODYismlz2\"}\n\ndata: {\"id\":\"chatcmpl-YYOKD77FV2J75JOVRH6T77B4GZ\",\"object\":\"chat.completion.chunk\",\"created\":1792187800,\"model\":\"kimi-k3\",\"choices\":[{\"index\":0,\"delta\":{},\"finish_reason\":\"stop\"}],\"obfuscation\":\"NYdsGQw6HoQVX7pCODcrHz43\"}\n\ndata: {\"id\":\"chatcmpl-YYOKD77FV2J75JOVRH6T77B4GZ\",\"object\":\"chat.completion.chunk\",\"created\":1792187800,\"model\":\"kimi-k3\",\"choices\":[],\"usage\":{\"prompt_tokens\":24,\"completion_tokens\":19,\"total_tokens\":43},\"obfuscation\":\"Uy9SG40zNe5p8eJh\"}\n\ndata: [DONE]\n\n"
              }
            }
          },
          "400": {
            "description": "The request is malformed, or the model or its provider refused it.",
            "x-error-codes": [
              {
                "code": "invalid_request_body",
                "when": "The body is not a JSON object, a parameter has the wrong JSON type, or model is missing."
              },
              {
                "code": "invalid_parameter",
                "when": "A parameter has a value the endpoint refuses. The message names the parameter."
              },
              {
                "code": "duplicate_json_key",
                "when": "A JSON object in the body repeats a key."
              },
              {
                "code": "too_many_messages",
                "when": "messages holds more than 4,096 entries."
              },
              {
                "code": "request_too_complex",
                "when": "The body holds more than 262,144 JSON values."
              },
              {
                "code": "invalid_output_limit",
                "when": "max_tokens or max_completion_tokens is not a positive integer."
              },
              {
                "code": "privacy_floor_unmet",
                "when": "One of these is true:\n- The model's tier is below provider.min_privacy.\n- The model's tier is below the API key's min_privacy, when param is key.min_privacy.\n- The request sets provider.zdr or provider.data_collection deny, and no endpoint at the tiers the request may run at keeps no data.\n\nThe message names both tiers. GET /v1/models lists only the models the key may call. Morse refuses before it calls the model or holds any credit."
              },
              {
                "code": "unsupported_parameter",
                "when": "One of these is true:\n- provider.max_price names image, audio, or request, which no chat price has.\n- The request sets a parameter that changes the response and that Morse sends to no model, such as logprobs or frequency_penalty.\n- An API key whose forward_settings is on sets temperature, top_p, stop, seed, n, or response_format. Morse sends none of these to any provider of the model, such as a Claude model.\n- A response_format of type json_object or json_schema names a type no endpoint of the model honours. The message names the type.\n- An API key's request lets a model call a tool, with tools or a tool_choice other than none. GET /v1/models lists that model with tools false. The parameter named is tools.\n\nThe message names the parameter."
              },
              {
                "code": "setting_not_forwarded",
                "when": "An API key whose forward_settings was turned off set temperature, top_p, stop, seed, n, or a response_format other than {\"type\":\"text\"}. Morse sends these to no model for that key. A new key has forward_settings on unless it is created with forward_settings false or null. The message names the parameter and the key setting that sends them, \"Let my settings reach the model host\". It also names the keys page of the developer console where the setting is turned back on. For a request sent to this reference's API address, that page is https://console.trymorse.ai/keys."
              },
              {
                "code": "provider_choice_unsupported",
                "when": "provider names only, ignore, or enforce_distillable_text. Morse chooses the provider within a privacy tier and refuses a request that would ignore the choice. The message points to the Pricing page, which lists the providers, and to provider.min_privacy, which requires a tier."
              },
              {
                "code": "max_price_unmet",
                "when": "Every tier of the model costs you more than provider.max_price allows, at your price: list for an API key. The message names the cheapest tier's price."
              },
              {
                "code": "quantization_unmet",
                "when": "No provider of the model at the tiers the request may run at serves a precision that provider.quantizations admits. param is provider.quantizations, and the message names the precisions those providers do serve. Morse never moves a request to another tier to find one, so a precision that only a tee provider serves needs min_privacy tee. Morse refuses before it calls the model or holds any credit."
              },
              {
                "code": "invalid_request",
                "when": "A message, part, or tool has a shape the model does not take, or the provider refused the request."
              },
              {
                "code": "remote_media",
                "when": "A media part links a URL instead of a data: URL."
              },
              {
                "code": "unsupported_input",
                "when": "An API key's messages carry an image part for a model whose input_modalities in GET /v1/models do not include image. The message names what the model reads. Morse refuses before it calls the model or holds any credit."
              },
              {
                "code": "message_too_long",
                "when": "In a chat with a character, the last user message holds more than 8,000 bytes of text."
              },
              {
                "code": "model_unsupported_for_characters",
                "when": "A chat that plays a character, one that sends X-Character or a character's prompt, names a model that GET /v1/models lists with characters false. param is model. Morse refuses before it calls the model or holds any credit."
              },
              {
                "code": "context_length_exceeded",
                "when": "The conversation is too long for the model."
              },
              {
                "code": "content_filter",
                "when": "The model provider declined the request."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Media must be attached as inline data, not linked by URL.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "remote_media"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "The key is missing or wrong.",
            "x-error-codes": [
              {
                "code": "invalid_api_key",
                "when": "One of these is true:\n- The Authorization header is missing or not Bearer.\n- The key is unknown or revoked.\n- A token that starts with sk_ is not a whole sk_morse_ key.\n- The bearer is no Morse key or login token at all, such as another service's API key (sk-proj-...)."
              },
              {
                "code": "api_key_expired",
                "when": "The key is past the expiry set on it. Make a new key, or set a later expiry before a key expires."
              },
              {
                "code": "invalid_token",
                "when": "The bearer is shaped as a Morse login token (a JWT) but its signature fails or it has expired. An API key sends the whole sk_morse_ key."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "402": {
            "description": "The account's credits, or what the key's spend limit has left, do not cover the request.",
            "x-error-codes": [
              {
                "code": "insufficient_balance",
                "when": "The balance is below the amount the request must hold. While the balance is negative, the API refuses every metered request. No credit is free when the balance is zero or below, or when requests still running hold all of it. The message then says to add credit. It also says to wait for those requests and set max_tokens or max_completion_tokens lower on each, so each holds less."
              },
              {
                "code": "key_spend_limit_reached",
                "when": "What the key's spend limit has left in its window is below the amount the request must hold. A limit that resets daily, weekly, or monthly sends Retry-After, the seconds until it resets. A limit that never resets sends none. Raise or remove the limit in the dashboard, and the next request is served."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The account balance does not cover the most this request could cost. Add credits from $5 at https://console.trymorse.ai/credits?sheet=add-credits, or set max_tokens or max_completion_tokens to lower the amount held.",
                    "type": "insufficient_balance",
                    "param": null,
                    "code": "insufficient_balance"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "403": {
            "description": "The key's account may not make this request.",
            "x-error-codes": [
              {
                "code": "account_disabled",
                "when": "Morse has disabled the key's account."
              },
              {
                "code": "account_deleted",
                "when": "The key's account has been deleted."
              },
              {
                "code": "account_under_18",
                "when": "The account's owner said they are under 18."
              },
              {
                "code": "characters_app_only",
                "when": "The first system message opens with the prompt of a Morse character, or the request names one in X-Character-Content or sends X-Writer-Examples. Morse characters are available only in the Morse app, not through an API key."
              },
              {
                "code": "ip_not_allowed",
                "when": "The key allows requests only from its allowed IPs, and the request came from another address. The message names the address the proxy saw."
              },
              {
                "code": "sealed_required",
                "when": "The key is sealed_only, and the request came unsealed. Send it inside POST /v1/sealed, as the Morse app does."
              },
              {
                "code": "e2ee_app_only",
                "when": "The request carries end-to-end encryption headers or names a sealed model. API keys are not offered end-to-end encryption for now. Morse refuses before it calls the model or holds any credit."
              },
              {
                "code": "model_unavailable_in_region",
                "when": "The model's lab doesn't offer its models where the request comes from. GET /v1/models leaves the model out there."
              },
              {
                "code": "service_unavailable_in_region",
                "when": "Morse doesn't serve the place the request comes from, because of US sanctions rules and its providers' terms. Every request from there returns this, whatever the key, unless Morse has admitted your network for a time."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "This account has been disabled. Contact support.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "account_disabled"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "404": {
            "description": "The model does not exist, or it is not a model for this endpoint.",
            "x-error-codes": [
              {
                "code": "model_not_found",
                "when": "No model of this endpoint's type has that name."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The requested model does not exist.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "model_not_found"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "408": {
            "description": "The request body arrived too slowly.",
            "x-error-codes": [
              {
                "code": "request_timeout",
                "when": "The request body did not arrive within one minute."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The request body did not arrive in time.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "request_timeout"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "413": {
            "description": "The request body is too large.",
            "x-error-codes": [
              {
                "code": "request_too_large",
                "when": "The body is over 32 MiB, or too large for the provider."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Request body is too large.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "request_too_large"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "429": {
            "description": "The account is over its rate limit or its concurrency limit. Wait the number of seconds in Retry-After, then retry.",
            "x-error-codes": [
              {
                "code": "rate_limit_exceeded",
                "when": "The account used up its requests per minute. All of the account's keys and its owner's use of the Morse app share one budget."
              },
              {
                "code": "concurrency_limit_exceeded",
                "when": "The account already has its maximum number of requests in flight. Retry-After is 1."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Rate limit reached for this account. Retry after the time in the Retry-After header.",
                    "type": "requests",
                    "param": null,
                    "code": "rate_limit_exceeded"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "502": {
            "description": "The model provider failed or refused the request.",
            "x-error-codes": [
              {
                "code": "upstream_error",
                "when": "The provider failed or did not answer."
              },
              {
                "code": "upstream_unavailable",
                "when": "The provider is unavailable right now. Retry later, or choose another model."
              },
              {
                "code": "upstream_retention",
                "when": "A zero-retention model's provider did not confirm zero data retention."
              },
              {
                "code": "upstream_refused",
                "when": "The provider refused the request, such as when it does not serve the model to Morse right now. Retry later, or choose another model."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The upstream model server failed.",
                    "type": "upstream_error",
                    "param": null,
                    "code": "upstream_error"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "description": "Morse or the provider is busy or unavailable. Retry the request later.",
            "x-error-codes": [
              {
                "code": "service_unavailable",
                "when": "Morse could not start the request. Retry it."
              },
              {
                "code": "server_busy",
                "when": "Morse is busy. Retry-After is 1."
              },
              {
                "code": "upstream_busy",
                "when": "The provider is overloaded. Try again shortly."
              },
              {
                "code": "upstream_unattested",
                "when": "Morse could not verify the attested endpoint. Try again shortly."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The service is temporarily unable to authorize requests. Try again shortly.",
                    "type": "server_error",
                    "param": null,
                    "code": "service_unavailable"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "operationId": "createMessage",
        "summary": "Create a message (Anthropic Messages)",
        "description": "Takes an Anthropic Messages request on any Morse chat model and answers in Anthropic's format, whole or as a stream. Anthropic's SDKs and Claude Code can use Morse by pointing their base URL at it. Morse reads the request as a chat completion. It is billed, held, routed, and refused exactly as POST /v1/chat/completions is, and Morse keeps no state between requests. The key goes in Authorization: Bearer or in x-api-key. The query string, such as ?beta=true, is ignored, and so are the anthropic-version and anthropic-beta headers.\n\nA stream is Anthropic's named events. message_start comes first. Then each text, thinking, or tool_use block sends a content_block_start, its deltas, and a content_block_stop. Then come message_delta, with the stop_reason and the usage, and message_stop. It sends no [DONE]. A comment line (: keepalive) keeps an idle stream open, and so does a ping event every 15 seconds while the model reasons unseen. Each event's data carries an obfuscation string of random length that hides the event's size. A stream that fails after it began ends with an error event and no message_stop. Usage splits the prompt as Anthropic does, into input_tokens, cache_read_input_tokens, and cache_creation_input_tokens.\n\nMorse refuses each of these with a 400 in Anthropic's envelope that names it:\n- server tools\n- document blocks\n- images linked by URL\n- an output_config.format of any type but json_schema\n- context_management, container, and mcp_servers (\"Extra inputs are not permitted\")\n\ntop_k is sent as the chat completion's top_k, on the same terms. A context_management that asks to clear nothing, as Claude Code sends, is taken and dropped. A 400, 401, 403, 404, 413, or 422 refusal, on this route or any other, carries X-Should-Retry: false. The Anthropic and OpenAI SDKs and Claude Code read it and do not send the request again. output_config.format of type json_schema is sent as the chat's response_format, named output and strict. So it needs forward_settings and a model whose providers list json_schema. thinking of type disabled, with no output_config.effort, asks for the effort none. A model that lists no none runs it at its lowest effort. With disable_parallel_tool_use, as with a chat's parallel_tool_calls: false, the response carries the first tool call alone, whichever provider served it. The calls it drops are billed. API keys are not offered end-to-end encryption for now, so a request for an end-to-end encrypted chat is refused with 403.",
        "security": [
          {
            "apiKey": []
          },
          {
            "anthropicAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessagesRequest"
              },
              "example": {
                "model": "glm-5.3",
                "max_tokens": 1024,
                "system": "Answer in one sentence.",
                "messages": [
                  {
                    "role": "user",
                    "content": "What is a TEE?"
                  }
                ],
                "stream": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The response: a Message, or a stream of Anthropic events when stream is true.",
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Funding": {
                "$ref": "#/components/headers/X-Funding"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-Tier": {
                "$ref": "#/components/headers/X-Tier"
              },
              "X-Model-Successor": {
                "$ref": "#/components/headers/X-Model-Successor"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                },
                "example": {
                  "id": "msg_YYOKD77FV2J75JOVRH6T77B4GZ",
                  "type": "message",
                  "role": "assistant",
                  "model": "glm-5.3",
                  "content": [
                    {
                      "type": "text",
                      "text": "A TEE is hardware that runs code where its host cannot read it."
                    }
                  ],
                  "stop_reason": "end_turn",
                  "stop_sequence": null,
                  "usage": {
                    "input_tokens": 4,
                    "cache_creation_input_tokens": 0,
                    "cache_read_input_tokens": 20,
                    "output_tokens": 19
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "x-event-schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/MessageStreamEvent"
                    },
                    {
                      "$ref": "#/components/schemas/AnthropicError"
                    }
                  ]
                },
                "example": "event: message_start\ndata: {\"type\":\"message_start\",\"message\":{\"content\":[],\"id\":\"msg_YYOKD77FV2J75JOVRH6T77B4GZ\",\"model\":\"glm-5.3\",\"role\":\"assistant\",\"stop_reason\":null,\"stop_sequence\":null,\"type\":\"message\",\"usage\":{\"input_tokens\":0,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":0}},\"obfuscation\":\"Xg7U0KyODYismlz2\"}\n\nevent: content_block_start\ndata: {\"content_block\":{\"text\":\"\",\"type\":\"text\"},\"index\":0,\"type\":\"content_block_start\",\"obfuscation\":\"NYdsGQw6HoQVX7pC\"}\n\nevent: content_block_delta\ndata: {\"delta\":{\"text\":\"A TEE\",\"type\":\"text_delta\"},\"index\":0,\"type\":\"content_block_delta\",\"obfuscation\":\"ODcrHz43Uy9SG40z\"}\n\nevent: content_block_stop\ndata: {\"index\":0,\"type\":\"content_block_stop\",\"obfuscation\":\"Ne5p8eJhXg7U0Ky\"}\n\nevent: message_delta\ndata: {\"delta\":{\"stop_reason\":\"end_turn\",\"stop_sequence\":null},\"type\":\"message_delta\",\"usage\":{\"input_tokens\":4,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":20,\"output_tokens\":19},\"obfuscation\":\"ODYismlz2NYdsGQw\"}\n\nevent: message_stop\ndata: {\"type\":\"message_stop\",\"obfuscation\":\"6HoQVX7pCODcrHz4\"}\n\n"
              }
            }
          },
          "400": {
            "description": "The request is malformed, or asks for something Morse does not serve. The message names the parameter or block.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "invalid_request_error",
                    "message": "tools.0: Input tag 'web_search_20250305' found using 'type' does not match any of the expected tags: 'custom'. Morse serves custom tools only, not Anthropic's server tools."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "401": {
            "description": "The key is missing or wrong.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "authentication_error",
                    "message": "The API key is invalid."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "402": {
            "description": "The account's credits, or what the key's spend limit has left, do not cover the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "billing_error",
                    "message": "The account balance does not cover the most this request could cost. Add credits from $5 at https://console.trymorse.ai/credits?sheet=add-credits, or set max_tokens or max_completion_tokens to lower the amount held."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "403": {
            "description": "The key may not use this model or route. A request with E2EE headers or a sealed model name is refused here. Its error type is permission_error. Its message reads: \"End-to-end encryption is not offered to API keys for now. Send the request without E2EE headers, to a model id from GET /v1/models.\"",
            "x-error-codes": [
              {
                "code": "service_unavailable_in_region",
                "when": "Morse doesn't serve the place the request comes from, because of US sanctions rules and its providers' terms. Every request from there returns this, whatever the key, unless Morse has admitted your network for a time. It is the one refusal here that comes in Morse's own error envelope, {\"error\":{\"message\",\"type\":\"region\",\"param\",\"code\"}}, so its code stays readable; every other refusal comes in Anthropic's."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/AnthropicError"
                    },
                    {
                      "$ref": "#/components/schemas/Error"
                    }
                  ]
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "permission_error",
                    "message": "This proxy takes an API key only at https://inference.trymorse.ai/v1, where TLS ends inside the enclave. Set the client's base URL to it."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "404": {
            "description": "The model does not exist, or the key may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "not_found_error",
                    "message": "The requested model does not exist."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "413": {
            "description": "The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "request_too_large",
                    "message": "Request body is too large."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "429": {
            "description": "A rate or concurrency limit was reached. Retry after the time in the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "rate_limit_error",
                    "message": "Rate limit reached for this account. Retry after the time in the Retry-After header."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "502": {
            "description": "The model provider failed or refused the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "api_error",
                    "message": "The upstream model server failed."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "503": {
            "description": "The model provider is busy, or the service is restarting. Retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "overloaded_error",
                    "message": "The model provider is busy. Try again shortly."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/messages/count_tokens": {
      "post": {
        "operationId": "countMessageTokens",
        "summary": "Count a message's tokens (Anthropic Messages)",
        "description": "Counts the input tokens of an Anthropic Messages request without running it, as Anthropic's token count endpoint does. Claude Code and the Anthropic SDKs receive a count from Morse this way. It is free: it sends nothing to a model's provider, holds and charges no credit, and needs no balance. It does not count toward the account's requests per minute. Each account may count 60 times a minute, on every plan.\n\nOn a model whose provider publishes its tokenizer, Morse counts the system prompt, the messages, and the tool definitions with that tokenizer. It adds 32 tokens for each message and 64 for the chat template, which is what Morse bills a prompt it counts. On every other model, and on a request with an image, the count is an upper bound estimated from the request's size. A provider's own count can fall well below it. The model's response may report a different input_tokens: the provider's template and its cache decide the billed count.\n\nA count body is read under the same limits as a Messages body, and no more than 8 MiB. A larger one is refused with 413 request_too_large. The key goes in Authorization: Bearer or in x-api-key. Refusals come in Anthropic's envelope, as POST /v1/messages returns them.",
        "security": [
          {
            "apiKey": []
          },
          {
            "anthropicAPIKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessagesCountTokensRequest"
              },
              "example": {
                "model": "glm-5.3",
                "system": "Answer in one sentence.",
                "messages": [
                  {
                    "role": "user",
                    "content": "What is a TEE?"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The count.",
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageTokensCount"
                },
                "example": {
                  "input_tokens": 142
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed, or asks for something POST /v1/messages does not serve. The message names the parameter or block. A min_privacy of e2ee, on the key or on the request, is refused here too.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "invalid_request_error",
                    "message": "model: Field required"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "401": {
            "description": "The key is missing or wrong.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "authentication_error",
                    "message": "The API key is invalid."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "403": {
            "description": "The key may not use this model or route. A request with E2EE headers or a sealed model name is refused here. Its error type is permission_error. Its message reads: \"End-to-end encryption is not offered to API keys for now. Send the request without E2EE headers, to a model id from GET /v1/models.\"",
            "x-error-codes": [
              {
                "code": "service_unavailable_in_region",
                "when": "Morse doesn't serve the place the request comes from, because of US sanctions rules and its providers' terms. Every request from there returns this, whatever the key, unless Morse has admitted your network for a time. It is the one refusal here that comes in Morse's own error envelope, {\"error\":{\"message\",\"type\":\"region\",\"param\",\"code\"}}, so its code stays readable; every other refusal comes in Anthropic's."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/AnthropicError"
                    },
                    {
                      "$ref": "#/components/schemas/Error"
                    }
                  ]
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "permission_error",
                    "message": "This proxy takes an API key only at https://inference.trymorse.ai/v1, where TLS ends inside the enclave. Set the client's base URL to it."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "404": {
            "description": "The model does not exist, or the key may not see it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "not_found_error",
                    "message": "The requested model does not exist."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "413": {
            "description": "The request body is too large.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "request_too_large",
                    "message": "Request body is too large."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "429": {
            "description": "The account counted too often. Retry after the time in the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "rate_limit_error",
                    "message": "Rate limit reached for this account. Retry after the time in the Retry-After header."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "503": {
            "description": "The service is restarting or could not start the count. Retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnthropicError"
                },
                "example": {
                  "type": "error",
                  "error": {
                    "type": "overloaded_error",
                    "message": "The service is temporarily unable to authorize requests. Try again shortly."
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/responses": {
      "post": {
        "operationId": "createResponse",
        "summary": "Create a response (OpenAI Responses)",
        "description": "Takes an OpenAI Responses request on any Morse chat model and answers in OpenAI's Responses format, whole or as a stream. OpenAI's SDKs, the Agents SDK, and Codex can use Morse by pointing their base URL at it. Morse reads the request as a chat completion, so it is billed, held, routed, and refused exactly as POST /v1/chat/completions is. It keeps no state: every Response says store false. A request that relies on a stored response or conversation is refused.\n\nA stream is OpenAI's named events, each with a sequence_number counting from 0. response.created and response.in_progress come first. Then each output item sends a response.output_item.added, its content's events, and a response.output_item.done. The stream ends with response.completed, or with response.incomplete when the response hit max_output_tokens or a content filter. The ending event carries the whole Response with its usage. The usage includes input_tokens_details.cached_tokens and output_tokens_details.reasoning_tokens. Items stay open until the response ends, so their done events come together at the end. It sends no [DONE]. A comment line (: keepalive) keeps an idle stream open. So does a response.in_progress event every 15 seconds while Morse holds back a custom tool's input or reasoning the client did not ask to see. Each event's data carries an obfuscation string of random length that hides the event's size. A stream that fails after it began ends with response.failed, whose Response carries the error.\n\nFunction tools are sent to the model as they are. A custom tool is sent as a function that takes its freeform input as one string, input. Its grammar is told in its description, and its call comes back as a custom_tool_call. A namespace tool's functions are sent as <namespace>__<name>, and a call comes back named within its namespace. Reasoning shows as a reasoning item with a summary_text only when the request sets reasoning.summary and the model sends reasoning text. It is the model's reasoning as written. On a model whose vendor keeps the reasoning itself, it is the vendor's own summary of it. A reasoning item in input reaches an open model as the earlier reasoning of the message or tool call after it. It is read from its summary_text and reasoning_text parts, and its encrypted_content is dropped.\n\nMorse refuses each of these with a 400 unsupported_parameter that names the parameter:\n- previous_response_id, conversation, prompt, and context_management\n- store true, background true, and a truncation other than disabled\n- OpenAI's built-in tools (web_search, file_search, code_interpreter, computer use, mcp, image_generation, and the rest)\n- a tool_choice of allowed_tools or a built-in tool\n- a text.format of a type other than text, json_object, or json_schema\n- item_reference items, which a client sends unless its request sets store false\n- file inputs, and images linked by URL or by file_id\n\nCodex sends a web_search tool unless its config sets web_search = \"disabled\". API keys are not offered end-to-end encryption for now, so a request for an end-to-end encrypted chat is refused with 403.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest"
              },
              "example": {
                "model": "glm-5.3",
                "instructions": "Answer in one sentence.",
                "input": "What is a TEE?",
                "store": false,
                "stream": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The response: a Response, or a stream of response events when stream is true.",
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Funding": {
                "$ref": "#/components/headers/X-Funding"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-Output-Limited": {
                "$ref": "#/components/headers/X-Output-Limited"
              },
              "X-Tier": {
                "$ref": "#/components/headers/X-Tier"
              },
              "X-Model-Successor": {
                "$ref": "#/components/headers/X-Model-Successor"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Response"
                },
                "example": {
                  "id": "resp_YYOKD77FV2J75JOVRH6T77B4GZ",
                  "object": "response",
                  "created_at": 1792187800,
                  "status": "completed",
                  "background": false,
                  "error": null,
                  "incomplete_details": null,
                  "instructions": "Answer in one sentence.",
                  "max_output_tokens": null,
                  "model": "glm-5.3",
                  "output": [
                    {
                      "id": "msg_Q3J75JOVRH6T77B4GZYYOKD77F",
                      "type": "message",
                      "status": "completed",
                      "role": "assistant",
                      "content": [
                        {
                          "type": "output_text",
                          "text": "A TEE is hardware that runs code where its host cannot read it.",
                          "annotations": [],
                          "logprobs": []
                        }
                      ]
                    }
                  ],
                  "parallel_tool_calls": true,
                  "previous_response_id": null,
                  "reasoning": {
                    "effort": null,
                    "summary": null
                  },
                  "store": false,
                  "temperature": null,
                  "top_p": null,
                  "text": {
                    "format": {
                      "type": "text"
                    }
                  },
                  "tool_choice": "auto",
                  "tools": [],
                  "truncation": "disabled",
                  "usage": {
                    "input_tokens": 24,
                    "input_tokens_details": {
                      "cached_tokens": 20
                    },
                    "output_tokens": 19,
                    "output_tokens_details": {
                      "reasoning_tokens": 0
                    },
                    "total_tokens": 43
                  },
                  "user": null,
                  "metadata": {}
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "x-event-schema": {
                  "$ref": "#/components/schemas/ResponseStreamEvent"
                },
                "example": "event: response.created\ndata: {\"response\":{\"id\":\"resp_YYOKD77FV2J75JOVRH6T77B4GZ\",\"object\":\"response\",\"status\":\"in_progress\",\"model\":\"glm-5.3\",\"output\":[],\"usage\":null,\"store\":false},\"sequence_number\":0,\"type\":\"response.created\",\"obfuscation\":\"Xg7U0KyODYismlz2\"}\n\nevent: response.in_progress\ndata: {\"response\":{\"id\":\"resp_YYOKD77FV2J75JOVRH6T77B4GZ\",\"object\":\"response\",\"status\":\"in_progress\",\"model\":\"glm-5.3\",\"output\":[],\"usage\":null,\"store\":false},\"sequence_number\":1,\"type\":\"response.in_progress\",\"obfuscation\":\"NYdsGQw6HoQVX7pC\"}\n\nevent: response.output_item.added\ndata: {\"item\":{\"content\":[],\"id\":\"msg_Q3J75JOVRH6T77B4GZYYOKD77F\",\"role\":\"assistant\",\"status\":\"in_progress\",\"type\":\"message\"},\"output_index\":0,\"sequence_number\":2,\"type\":\"response.output_item.added\",\"obfuscation\":\"ODcrHz43Uy9S\"}\n\nevent: response.content_part.added\ndata: {\"content_index\":0,\"item_id\":\"msg_Q3J75JOVRH6T77B4GZYYOKD77F\",\"output_index\":0,\"part\":{\"annotations\":[],\"logprobs\":[],\"text\":\"\",\"type\":\"output_text\"},\"sequence_number\":3,\"type\":\"response.content_part.added\",\"obfuscation\":\"Ne5p8eJh\"}\n\nevent: response.output_text.delta\ndata: {\"content_index\":0,\"delta\":\"A TEE\",\"item_id\":\"msg_Q3J75JOVRH6T77B4GZYYOKD77F\",\"logprobs\":[],\"output_index\":0,\"sequence_number\":4,\"type\":\"response.output_text.delta\",\"obfuscation\":\"ODYismlz2NYdsGQw\"}\n\nevent: response.output_text.done\ndata: {\"content_index\":0,\"item_id\":\"msg_Q3J75JOVRH6T77B4GZYYOKD77F\",\"logprobs\":[],\"output_index\":0,\"sequence_number\":5,\"text\":\"A TEE\",\"type\":\"response.output_text.done\",\"obfuscation\":\"6HoQVX7p\"}\n\nevent: response.content_part.done\ndata: {\"content_index\":0,\"item_id\":\"msg_Q3J75JOVRH6T77B4GZYYOKD77F\",\"output_index\":0,\"part\":{\"annotations\":[],\"logprobs\":[],\"text\":\"A TEE\",\"type\":\"output_text\"},\"sequence_number\":6,\"type\":\"response.content_part.done\",\"obfuscation\":\"CODcrHz4\"}\n\nevent: response.output_item.done\ndata: {\"item\":{\"content\":[{\"annotations\":[],\"logprobs\":[],\"text\":\"A TEE\",\"type\":\"output_text\"}],\"id\":\"msg_Q3J75JOVRH6T77B4GZYYOKD77F\",\"role\":\"assistant\",\"status\":\"completed\",\"type\":\"message\"},\"output_index\":0,\"sequence_number\":7,\"type\":\"response.output_item.done\",\"obfuscation\":\"Uy9SG40z\"}\n\nevent: response.completed\ndata: {\"response\":{\"id\":\"resp_YYOKD77FV2J75JOVRH6T77B4GZ\",\"object\":\"response\",\"status\":\"completed\",\"model\":\"glm-5.3\",\"output\":[{\"content\":[{\"annotations\":[],\"logprobs\":[],\"text\":\"A TEE\",\"type\":\"output_text\"}],\"id\":\"msg_Q3J75JOVRH6T77B4GZYYOKD77F\",\"role\":\"assistant\",\"status\":\"completed\",\"type\":\"message\"}],\"usage\":{\"input_tokens\":24,\"input_tokens_details\":{\"cached_tokens\":20},\"output_tokens\":19,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":43},\"store\":false},\"sequence_number\":8,\"type\":\"response.completed\",\"obfuscation\":\"Xg7U0Ky\"}\n\n"
              }
            }
          },
          "400": {
            "description": "The request is malformed, or asks for something Morse does not serve. param names the parameter.",
            "x-error-codes": [
              {
                "code": "invalid_request_body",
                "when": "The body is not a JSON object, a parameter has the wrong JSON type, or model is missing."
              },
              {
                "code": "invalid_parameter",
                "when": "A parameter has a value the endpoint refuses. The message names the parameter."
              },
              {
                "code": "duplicate_json_key",
                "when": "A JSON object in the body repeats a key."
              },
              {
                "code": "too_many_messages",
                "when": "messages holds more than 4,096 entries."
              },
              {
                "code": "request_too_complex",
                "when": "The body holds more than 262,144 JSON values."
              },
              {
                "code": "invalid_output_limit",
                "when": "max_tokens or max_completion_tokens is not a positive integer."
              },
              {
                "code": "privacy_floor_unmet",
                "when": "One of these is true:\n- The model's tier is below provider.min_privacy.\n- The model's tier is below the API key's min_privacy, when param is key.min_privacy.\n- The request sets provider.zdr or provider.data_collection deny, and no endpoint at the tiers the request may run at keeps no data.\n\nThe message names both tiers. GET /v1/models lists only the models the key may call. Morse refuses before it calls the model or holds any credit."
              },
              {
                "code": "unsupported_parameter",
                "when": "A parameter asks for something Morse does not serve:\n- a stored response or conversation (previous_response_id, conversation, prompt, context_management, store true, background true, truncation other than disabled)\n- a built-in tool or tool_choice (web_search, file_search, code_interpreter, computer use, mcp, image_generation, and the rest)\n- a text.format of a type other than text, json_object, or json_schema\n- an image linked by URL or by file_id, or a file input\n- an input item Morse cannot carry\n- a parameter that changes the response and that no provider is sent"
              },
              {
                "code": "setting_not_forwarded",
                "when": "An API key whose forward_settings was turned off set temperature, top_p, stop, seed, or n. Morse sends these to no model for that key. A new key has forward_settings on unless it is created with forward_settings false or null. The message names the parameter and the key setting that sends them, \"Let my settings reach the model host\". It also names the keys page of the developer console where the setting is turned back on. For a request sent to this reference's API address, that page is https://console.trymorse.ai/keys."
              },
              {
                "code": "provider_choice_unsupported",
                "when": "provider names only, ignore, or enforce_distillable_text. Morse chooses the provider within a privacy tier and refuses a request that would ignore the choice. The message points to the Pricing page, which lists the providers, and to provider.min_privacy, which requires a tier."
              },
              {
                "code": "max_price_unmet",
                "when": "Every tier of the model costs you more than provider.max_price allows, at your price: list for an API key. The message names the cheapest tier's price."
              },
              {
                "code": "quantization_unmet",
                "when": "No provider of the model at the tiers the request may run at serves a precision that provider.quantizations admits. param is provider.quantizations, and the message names the precisions those providers do serve. Morse never moves a request to another tier to find one, so a precision that only a tee provider serves needs min_privacy tee. Morse refuses before it calls the model or holds any credit."
              },
              {
                "code": "invalid_request",
                "when": "A message, part, or tool has a shape the model does not take, or the provider refused the request."
              },
              {
                "code": "remote_media",
                "when": "A media part links a URL instead of a data: URL."
              },
              {
                "code": "unsupported_input",
                "when": "An API key's messages carry an image part for a model whose input_modalities in GET /v1/models do not include image. The message names what the model reads. Morse refuses before it calls the model or holds any credit."
              },
              {
                "code": "message_too_long",
                "when": "In a chat with a character, the last user message holds more than 8,000 bytes of text."
              },
              {
                "code": "model_unsupported_for_characters",
                "when": "A chat that plays a character, one that sends X-Character or a character's prompt, names a model that GET /v1/models lists with characters false. param is model. Morse refuses before it calls the model or holds any credit."
              },
              {
                "code": "context_length_exceeded",
                "when": "The conversation is too long for the model."
              },
              {
                "code": "content_filter",
                "when": "The model provider declined the request."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "previous_response_id is not supported: Morse keeps no responses or conversations. Send the whole conversation in input, with store false or absent.",
                    "type": "invalid_request_error",
                    "param": "previous_response_id",
                    "code": "unsupported_parameter"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "The key is missing or wrong.",
            "x-error-codes": [
              {
                "code": "invalid_api_key",
                "when": "One of these is true:\n- The Authorization header is missing or not Bearer.\n- The key is unknown or revoked.\n- A token that starts with sk_ is not a whole sk_morse_ key.\n- The bearer is no Morse key or login token at all, such as another service's API key (sk-proj-...)."
              },
              {
                "code": "api_key_expired",
                "when": "The key is past the expiry set on it. Make a new key, or set a later expiry before a key expires."
              },
              {
                "code": "invalid_token",
                "when": "The bearer is shaped as a Morse login token (a JWT) but its signature fails or it has expired. An API key sends the whole sk_morse_ key."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "402": {
            "description": "The account's credits, or what the key's spend limit has left, do not cover the request.",
            "x-error-codes": [
              {
                "code": "insufficient_balance",
                "when": "The balance is below the amount the request must hold. While the balance is negative, the API refuses every metered request. No credit is free when the balance is zero or below, or when requests still running hold all of it. The message then says to add credit. It also says to wait for those requests and set max_tokens or max_completion_tokens lower on each, so each holds less."
              },
              {
                "code": "key_spend_limit_reached",
                "when": "What the key's spend limit has left in its window is below the amount the request must hold. A limit that resets daily, weekly, or monthly sends Retry-After, the seconds until it resets. A limit that never resets sends none. Raise or remove the limit in the dashboard, and the next request is served."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The account balance does not cover the most this request could cost. Add credits from $5 at https://console.trymorse.ai/credits?sheet=add-credits, or set max_tokens or max_completion_tokens to lower the amount held.",
                    "type": "insufficient_balance",
                    "param": null,
                    "code": "insufficient_balance"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "403": {
            "description": "The key's account may not make this request.",
            "x-error-codes": [
              {
                "code": "account_disabled",
                "when": "Morse has disabled the key's account."
              },
              {
                "code": "account_deleted",
                "when": "The key's account has been deleted."
              },
              {
                "code": "account_under_18",
                "when": "The account's owner said they are under 18."
              },
              {
                "code": "characters_app_only",
                "when": "The first system message opens with the prompt of a Morse character, or the request names one in X-Character-Content or sends X-Writer-Examples. Morse characters are available only in the Morse app, not through an API key."
              },
              {
                "code": "ip_not_allowed",
                "when": "The key allows requests only from its allowed IPs, and the request came from another address. The message names the address the proxy saw."
              },
              {
                "code": "sealed_required",
                "when": "The key is sealed_only, and the request came unsealed. Send it inside POST /v1/sealed, as the Morse app does."
              },
              {
                "code": "e2ee_app_only",
                "when": "The request carries end-to-end encryption headers or names a sealed model. API keys are not offered end-to-end encryption for now. Morse refuses before it calls the model or holds any credit."
              },
              {
                "code": "model_unavailable_in_region",
                "when": "The model's lab doesn't offer its models where the request comes from. GET /v1/models leaves the model out there."
              },
              {
                "code": "service_unavailable_in_region",
                "when": "Morse doesn't serve the place the request comes from, because of US sanctions rules and its providers' terms. Every request from there returns this, whatever the key, unless Morse has admitted your network for a time."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "This account has been disabled. Contact support.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "account_disabled"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "404": {
            "description": "The model does not exist, or it is not a model for this endpoint.",
            "x-error-codes": [
              {
                "code": "model_not_found",
                "when": "No model of this endpoint's type has that name."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The requested model does not exist.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "model_not_found"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "408": {
            "description": "The request body arrived too slowly.",
            "x-error-codes": [
              {
                "code": "request_timeout",
                "when": "The request body did not arrive within one minute."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The request body did not arrive in time.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "request_timeout"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "413": {
            "description": "The request body is too large.",
            "x-error-codes": [
              {
                "code": "request_too_large",
                "when": "The body is over 32 MiB, or too large for the provider."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Request body is too large.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "request_too_large"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "429": {
            "description": "The account is over its rate limit or its concurrency limit. Wait the number of seconds in Retry-After, then retry.",
            "x-error-codes": [
              {
                "code": "rate_limit_exceeded",
                "when": "The account used up its requests per minute. All of the account's keys and its owner's use of the Morse app share one budget."
              },
              {
                "code": "concurrency_limit_exceeded",
                "when": "The account already has its maximum number of requests in flight. Retry-After is 1."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Rate limit reached for this account. Retry after the time in the Retry-After header.",
                    "type": "requests",
                    "param": null,
                    "code": "rate_limit_exceeded"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "502": {
            "description": "The model provider failed or refused the request.",
            "x-error-codes": [
              {
                "code": "upstream_error",
                "when": "The provider failed or did not answer."
              },
              {
                "code": "upstream_unavailable",
                "when": "The provider is unavailable right now. Retry later, or choose another model."
              },
              {
                "code": "upstream_retention",
                "when": "A zero-retention model's provider did not confirm zero data retention."
              },
              {
                "code": "upstream_refused",
                "when": "The provider refused the request, such as when it does not serve the model to Morse right now. Retry later, or choose another model."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The upstream model server failed.",
                    "type": "upstream_error",
                    "param": null,
                    "code": "upstream_error"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "description": "Morse or the provider is busy or unavailable. Retry the request later.",
            "x-error-codes": [
              {
                "code": "service_unavailable",
                "when": "Morse could not start the request. Retry it."
              },
              {
                "code": "server_busy",
                "when": "Morse is busy. Retry-After is 1."
              },
              {
                "code": "upstream_busy",
                "when": "The provider is overloaded. Try again shortly."
              },
              {
                "code": "upstream_unattested",
                "when": "Morse could not verify the attested endpoint. Try again shortly."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The service is temporarily unable to authorize requests. Try again shortly.",
                    "type": "server_error",
                    "param": null,
                    "code": "service_unavailable"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List models",
        "description": "Lists every model once, with the privacy tiers it is sold at and each tier's price, limits, and plan terms. A tier with no price is left out, and so is a model with no priced tier. An API key sees the model's list price. A key's list shows no e2ee tier and no sealed alias, because API keys are not offered end-to-end encryption for now. A key whose min_privacy is e2ee is listed no model. The call is free and needs no balance. It does not count toward the account's requests per minute. Each account may list the models 60 times a minute, on every plan. With no Authorization header, the call returns the tiers shape as it lists it to a key with no min_privacy. That is every model an API key can call, so a tool can read the catalog before it holds a key. Shape aliases needs a key. A header that holds a wrong key still returns 401.",
        "parameters": [
          {
            "name": "shape",
            "in": "query",
            "required": false,
            "description": "tiers lists one entry per model, with a tiers array and an aliases array beside data. An API key receives it without this parameter. aliases lists one entry per name, each at one tier, as the list did before tiers. A Morse app login or guest receives it without this parameter. An API key may ask for aliases while it is offered. Morse will announce its end date on this page. Any other value returns 400 invalid_parameter.",
            "schema": {
              "type": "string",
              "enum": [
                "tiers",
                "aliases"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The models.",
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelList"
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "id": "moonshotai/kimi-k3",
                      "object": "model",
                      "created": 0,
                      "owned_by": "morse",
                      "type": "chat",
                      "label": "Kimi K3",
                      "input_modalities": [
                        "text",
                        "image"
                      ],
                      "reasoning_efforts": [
                        "none",
                        "low",
                        "high",
                        "max"
                      ],
                      "tiers": [
                        {
                          "tier": "private",
                          "retention": "zdr",
                          "quantizations": [
                            "mxfp4",
                            "fp8"
                          ],
                          "context_tokens": 1048576,
                          "max_output_tokens": 1048576,
                          "compact_at_tokens": 838860,
                          "default_reasoning_effort": "high",
                          "plan": "pro",
                          "price": {
                            "prompt_micros_per_mtok": 3000000,
                            "completion_micros_per_mtok": 15000000,
                            "min_hold_micros": 15360
                          }
                        }
                      ]
                    }
                  ],
                  "aliases": [
                    {
                      "name": "kimi-k3",
                      "model": "moonshotai/kimi-k3",
                      "tier": "private"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The shape parameter is not tiers or aliases.",
            "x-error-codes": [
              {
                "code": "invalid_parameter",
                "when": "shape is any value but tiers or aliases, or is sent more than once. The message names tiers and aliases."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "shape must be tiers or aliases. tiers lists one entry per model with its tiers and each tier's price, and aliases lists one entry per alias.",
                    "type": "invalid_request_error",
                    "param": "shape",
                    "code": "invalid_parameter"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "401": {
            "description": "The key is missing or wrong.",
            "x-error-codes": [
              {
                "code": "invalid_api_key",
                "when": "One of these is true:\n- The Authorization header is missing or not Bearer.\n- The key is unknown or revoked.\n- A token that starts with sk_ is not a whole sk_morse_ key.\n- The bearer is no Morse key or login token at all, such as another service's API key (sk-proj-...)."
              },
              {
                "code": "api_key_expired",
                "when": "The key is past the expiry set on it. Make a new key, or set a later expiry before a key expires."
              },
              {
                "code": "invalid_token",
                "when": "The bearer is shaped as a Morse login token (a JWT) but its signature fails or it has expired. An API key sends the whole sk_morse_ key."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "403": {
            "description": "The key's account may not make this request.",
            "x-error-codes": [
              {
                "code": "account_disabled",
                "when": "Morse has disabled the key's account."
              },
              {
                "code": "account_deleted",
                "when": "The key's account has been deleted."
              },
              {
                "code": "account_under_18",
                "when": "The account's owner said they are under 18."
              },
              {
                "code": "ip_not_allowed",
                "when": "The key allows requests only from its allowed IPs, and the request came from another address. The message names the address the proxy saw."
              },
              {
                "code": "service_unavailable_in_region",
                "when": "Morse doesn't serve the place the request comes from, because of US sanctions rules and its providers' terms. Every request from there returns this, whatever the key, unless Morse has admitted your network for a time."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "This account has been disabled. Contact support.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "account_disabled"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "429": {
            "description": "The account listed the models too often. Wait the number of seconds in Retry-After, then retry.",
            "x-error-codes": [
              {
                "code": "rate_limit_exceeded",
                "when": "The account used up its 60 model lists a minute. All of the account's keys and its owner's use of the Morse app share them. Up to 7 lists can go at once, then one each second."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Rate limit reached for this account. Retry after the time in the Retry-After header.",
                    "type": "requests",
                    "param": null,
                    "code": "rate_limit_exceeded"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "503": {
            "description": "Morse or the provider is busy or unavailable. Retry the request later.",
            "x-error-codes": [
              {
                "code": "service_unavailable",
                "when": "Morse could not start the request. Retry it."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The service is temporarily unable to authorize requests. Try again shortly.",
                    "type": "server_error",
                    "param": null,
                    "code": "service_unavailable"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/models/{id}": {
      "get": {
        "operationId": "retrieveModel",
        "summary": "Retrieve a model",
        "description": "Retrieves one model, as OpenAI's model retrieve does, with the entry GET /v1/models lists for it to this caller. A model id holds a slash, such as z-ai/glm-5.3, and returns its entry with its tiers. An alias, such as glm-5.3, returns its entry at its tier. The call is free, needs no balance, and shares the account's 60 model lists a minute. With no Authorization header, it returns a model id's entry as GET /v1/models lists it without a key.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "A model id or an alias from GET /v1/models. A model id's slash may be sent as it is or escaped as %2F.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The model, as GET /v1/models lists it to this caller: a model id's entry with its tiers, or an alias's entry at its tier.",
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ModelWithTiers"
                    },
                    {
                      "$ref": "#/components/schemas/Model"
                    }
                  ]
                },
                "example": {
                  "id": "moonshotai/kimi-k3",
                  "object": "model",
                  "created": 0,
                  "owned_by": "morse",
                  "type": "chat",
                  "label": "Kimi K3",
                  "input_modalities": [
                    "text",
                    "image"
                  ],
                  "reasoning_efforts": [
                    "none",
                    "low",
                    "high",
                    "max"
                  ],
                  "tiers": [
                    {
                      "tier": "private",
                      "retention": "zdr",
                      "quantizations": [
                        "mxfp4",
                        "fp8"
                      ],
                      "context_tokens": 1048576,
                      "max_output_tokens": 1048576,
                      "compact_at_tokens": 838860,
                      "default_reasoning_effort": "high",
                      "plan": "pro",
                      "price": {
                        "prompt_micros_per_mtok": 3000000,
                        "completion_micros_per_mtok": 15000000,
                        "min_hold_micros": 15360
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "The key is missing or wrong.",
            "x-error-codes": [
              {
                "code": "invalid_api_key",
                "when": "One of these is true:\n- The Authorization header is missing or not Bearer.\n- The key is unknown or revoked.\n- A token that starts with sk_ is not a whole sk_morse_ key.\n- The bearer is no Morse key or login token at all, such as another service's API key (sk-proj-...)."
              },
              {
                "code": "api_key_expired",
                "when": "The key is past the expiry set on it. Make a new key, or set a later expiry before a key expires."
              },
              {
                "code": "invalid_token",
                "when": "The bearer is shaped as a Morse login token (a JWT) but its signature fails or it has expired. An API key sends the whole sk_morse_ key."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "403": {
            "description": "The key's account may not make this request.",
            "x-error-codes": [
              {
                "code": "account_disabled",
                "when": "Morse has disabled the key's account."
              },
              {
                "code": "account_deleted",
                "when": "The key's account has been deleted."
              },
              {
                "code": "account_under_18",
                "when": "The account's owner said they are under 18."
              },
              {
                "code": "ip_not_allowed",
                "when": "The key allows requests only from its allowed IPs, and the request came from another address. The message names the address the proxy saw."
              },
              {
                "code": "service_unavailable_in_region",
                "when": "Morse doesn't serve the place the request comes from, because of US sanctions rules and its providers' terms. Every request from there returns this, whatever the key, unless Morse has admitted your network for a time."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "This account has been disabled. Contact support.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "account_disabled"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "404": {
            "description": "No model or alias of that name is listed to this caller.",
            "x-error-codes": [
              {
                "code": "model_not_found",
                "when": "The id names no model or alias that GET /v1/models lists to this caller. Examples are a model below the key's min_privacy, or one only the Morse app may use."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The requested model does not exist.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "model_not_found"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "429": {
            "description": "The account listed the models too often. Wait the number of seconds in Retry-After, then retry.",
            "x-error-codes": [
              {
                "code": "rate_limit_exceeded",
                "when": "The account used up its 60 model lists a minute. All of the account's keys and its owner's use of the Morse app share them. Up to 7 lists can go at once, then one each second."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Rate limit reached for this account. Retry after the time in the Retry-After header.",
                    "type": "requests",
                    "param": null,
                    "code": "rate_limit_exceeded"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "503": {
            "description": "Morse or the provider is busy or unavailable. Retry the request later.",
            "x-error-codes": [
              {
                "code": "service_unavailable",
                "when": "Morse could not start the request. Retry it."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The service is temporarily unable to authorize requests. Try again shortly.",
                    "type": "server_error",
                    "param": null,
                    "code": "service_unavailable"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/images/generations": {
      "post": {
        "operationId": "createImage",
        "summary": "Generate images",
        "description": "Generates up to four images from a prompt and optional reference images, and returns them inline as base64.\n\nImage generation is not offered to API keys for now. GET /v1/models lists no image model to a key, and a key's request here returns 404 model_not_found. A Morse app login can still generate images.\n\nEach image costs the model's micros_per_image, plus micros_per_reference for each reference image. Each image costs at least one credit. You pay only for the images delivered. If the request ends before the images return, you pay nothing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageRequest"
              },
              "example": {
                "model": "flux-2-max",
                "prompt": "a red apple on a wooden table, morning light",
                "n": 2,
                "aspect_ratio": "16:9"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The images.",
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Funding": {
                "$ref": "#/components/headers/X-Funding"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "X-Model-Successor": {
                "$ref": "#/components/headers/X-Model-Successor"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageResponse"
                },
                "example": {
                  "created": 1792187825,
                  "data": [
                    {
                      "b64_json": "iVBORw0KGgoAAAANSUhEUgAA...",
                      "mime_type": "image/png"
                    },
                    {
                      "b64_json": "iVBORw0KGgoAAAANSUhEUgAA...",
                      "mime_type": "image/png"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed, or the model or its provider refused it.",
            "x-error-codes": [
              {
                "code": "invalid_request_body",
                "when": "The body is not a JSON object, a parameter has the wrong JSON type, or model is missing."
              },
              {
                "code": "invalid_parameter",
                "when": "A parameter has a value the endpoint refuses. The message names the parameter."
              },
              {
                "code": "duplicate_json_key",
                "when": "A JSON object in the body repeats a key."
              },
              {
                "code": "remote_media",
                "when": "A reference image links a URL instead of a data: URL."
              },
              {
                "code": "content_filter",
                "when": "The provider declined the prompt, or Morse's prompt check refused it: on an uncensored model while that check is on, and always when prompt_check is true. Nothing is made or charged."
              },
              {
                "code": "invalid_request",
                "when": "The provider rejected the request."
              },
              {
                "code": "privacy_floor_unmet",
                "when": "The model's tier is below the API key's min_privacy. param is key.min_privacy, and the message names both tiers. GET /v1/models lists only the models the key may call. Morse refuses before it calls the model or holds any credit."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "n must be between 1 and 4.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_parameter"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "401": {
            "description": "The key is missing or wrong.",
            "x-error-codes": [
              {
                "code": "invalid_api_key",
                "when": "One of these is true:\n- The Authorization header is missing or not Bearer.\n- The key is unknown or revoked.\n- A token that starts with sk_ is not a whole sk_morse_ key.\n- The bearer is no Morse key or login token at all, such as another service's API key (sk-proj-...)."
              },
              {
                "code": "api_key_expired",
                "when": "The key is past the expiry set on it. Make a new key, or set a later expiry before a key expires."
              },
              {
                "code": "invalid_token",
                "when": "The bearer is shaped as a Morse login token (a JWT) but its signature fails or it has expired. An API key sends the whole sk_morse_ key."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "402": {
            "description": "The account's credits, or what the key's spend limit has left, do not cover the request.",
            "x-error-codes": [
              {
                "code": "insufficient_balance",
                "when": "The balance is below the amount the request must hold. While the balance is negative, the API refuses every metered request."
              },
              {
                "code": "key_spend_limit_reached",
                "when": "What the key's spend limit has left in its window is below the amount the request must hold. A limit that resets daily, weekly, or monthly sends Retry-After, the seconds until it resets. A limit that never resets sends none. Raise or remove the limit in the dashboard, and the next request is served."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The account balance does not cover the most this request could cost. Add credits from $5 at https://console.trymorse.ai/credits?sheet=add-credits, or ask for fewer images or reference images.",
                    "type": "insufficient_balance",
                    "param": null,
                    "code": "insufficient_balance"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "403": {
            "description": "The key's account may not make this request.",
            "x-error-codes": [
              {
                "code": "account_disabled",
                "when": "Morse has disabled the key's account."
              },
              {
                "code": "account_deleted",
                "when": "The key's account has been deleted."
              },
              {
                "code": "account_under_18",
                "when": "The account's owner said they are under 18."
              },
              {
                "code": "ip_not_allowed",
                "when": "The key allows requests only from its allowed IPs, and the request came from another address. The message names the address the proxy saw."
              },
              {
                "code": "sealed_required",
                "when": "The key is sealed_only, and the request came unsealed. Send it inside POST /v1/sealed, as the Morse app does."
              },
              {
                "code": "model_unavailable_in_region",
                "when": "The model's lab doesn't offer its models where the request comes from. GET /v1/models leaves the model out there."
              },
              {
                "code": "service_unavailable_in_region",
                "when": "Morse doesn't serve the place the request comes from, because of US sanctions rules and its providers' terms. Every request from there returns this, whatever the key, unless Morse has admitted your network for a time."
              },
              {
                "code": "frame_consent_required",
                "when": "A Morse app login sent images to an uncensored image model without agreeing to the photo promises for each one, by its SHA-256, at POST /v1/account/frame-consents. param is images. Nothing is made or charged."
              },
              {
                "code": "photo_edits_unavailable_in_region",
                "when": "From December 2, 2026, Morse does not let uncensored image models take images unless the request comes from a known country outside the EU. param is images. Nothing is made or charged; send the prompt without images."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "This account has been disabled. Contact support.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "account_disabled"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "404": {
            "description": "The model does not exist, or it is not a model for this endpoint.",
            "x-error-codes": [
              {
                "code": "model_not_found",
                "when": "No model of this endpoint's type has that name."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The requested model does not exist.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "model_not_found"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "408": {
            "description": "The request body arrived too slowly.",
            "x-error-codes": [
              {
                "code": "request_timeout",
                "when": "The request body did not arrive within one minute."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The request body did not arrive in time.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "request_timeout"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "413": {
            "description": "The request body is too large.",
            "x-error-codes": [
              {
                "code": "request_too_large",
                "when": "The body is over 32 MiB, or too large for the provider."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Request body is too large.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "request_too_large"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "429": {
            "description": "The account is over its rate limit or its concurrency limit. Wait the number of seconds in Retry-After, then retry.",
            "x-error-codes": [
              {
                "code": "rate_limit_exceeded",
                "when": "The account used up its requests per minute. All of the account's keys and its owner's use of the Morse app share one budget."
              },
              {
                "code": "concurrency_limit_exceeded",
                "when": "The account already has its maximum number of requests in flight. Retry-After is 1."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Rate limit reached for this account. Retry after the time in the Retry-After header.",
                    "type": "requests",
                    "param": null,
                    "code": "rate_limit_exceeded"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "502": {
            "description": "The image provider failed or refused the request.",
            "x-error-codes": [
              {
                "code": "upstream_error",
                "when": "The provider failed, returned no images, or took more than 10 minutes."
              },
              {
                "code": "upstream_unavailable",
                "when": "The provider is unavailable right now. Retry later, or choose another model."
              },
              {
                "code": "upstream_refused",
                "when": "The provider refused the request, such as when it does not serve the model to Morse right now. Retry later, or choose another model."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The upstream model server failed.",
                    "type": "upstream_error",
                    "param": null,
                    "code": "upstream_error"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "description": "Morse or the provider is busy or unavailable. Retry the request later.",
            "x-error-codes": [
              {
                "code": "service_unavailable",
                "when": "Morse could not start the request. Retry it."
              },
              {
                "code": "server_busy",
                "when": "Morse is busy. Retry-After is 1."
              },
              {
                "code": "upstream_busy",
                "when": "The provider is overloaded. Try again shortly."
              },
              {
                "code": "prompt_check_unavailable",
                "when": "Morse's prompt check could not run for a request that needs it, so nothing was made or charged. Try again shortly."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The service is temporarily unable to authorize requests. Try again shortly.",
                    "type": "server_error",
                    "param": null,
                    "code": "service_unavailable"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/search": {
      "post": {
        "operationId": "search",
        "summary": "Search the web",
        "description": "Runs up to five web searches and returns the top pages with excerpts. Each call costs 1,000 micros, a tenth of a credit. A failed call costs nothing.\n\nWeb search is not offered to API keys for now. GET /v1/models lists no such model to a key, and a key's request here returns 404 model_not_found. A Morse app login can still use it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchRequest"
              },
              "example": {
                "model": "parallel-search",
                "queries": [
                  "go 1.27 release notes"
                ],
                "objective": "What changed in the standard library?"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The result.",
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Funding": {
                "$ref": "#/components/headers/X-Funding"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResults"
                },
                "example": {
                  "object": "search.results",
                  "results": [
                    {
                      "url": "https://go.dev/doc/go1.27",
                      "title": "Go 1.27 Release Notes",
                      "published": null,
                      "excerpts": [
                        "## Standard library\n..."
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed.",
            "x-error-codes": [
              {
                "code": "invalid_request_body",
                "when": "The body is not a JSON object, a parameter has the wrong JSON type, or model is missing."
              },
              {
                "code": "invalid_parameter",
                "when": "A parameter has a value the endpoint refuses. The message names the parameter."
              },
              {
                "code": "duplicate_json_key",
                "when": "A JSON object in the body repeats a key."
              },
              {
                "code": "invalid_parameter",
                "when": "queries, a query, objective, or domains is out of range. The message names it."
              },
              {
                "code": "privacy_floor_unmet",
                "when": "The model's tier is below the API key's min_privacy. param is key.min_privacy, and the message names both tiers. GET /v1/models lists only the models the key may call. Morse refuses before it calls the model or holds any credit."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "queries must be a list of 1 to 5 strings.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_parameter"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "401": {
            "description": "The key is missing or wrong.",
            "x-error-codes": [
              {
                "code": "invalid_api_key",
                "when": "One of these is true:\n- The Authorization header is missing or not Bearer.\n- The key is unknown or revoked.\n- A token that starts with sk_ is not a whole sk_morse_ key.\n- The bearer is no Morse key or login token at all, such as another service's API key (sk-proj-...)."
              },
              {
                "code": "api_key_expired",
                "when": "The key is past the expiry set on it. Make a new key, or set a later expiry before a key expires."
              },
              {
                "code": "invalid_token",
                "when": "The bearer is shaped as a Morse login token (a JWT) but its signature fails or it has expired. An API key sends the whole sk_morse_ key."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "402": {
            "description": "The account's credits, or what the key's spend limit has left, do not cover the request.",
            "x-error-codes": [
              {
                "code": "insufficient_balance",
                "when": "The balance is below the amount the request must hold. While the balance is negative, the API refuses every metered request."
              },
              {
                "code": "key_spend_limit_reached",
                "when": "What the key's spend limit has left in its window is below the amount the request must hold. A limit that resets daily, weekly, or monthly sends Retry-After, the seconds until it resets. A limit that never resets sends none. Raise or remove the limit in the dashboard, and the next request is served."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The account balance does not cover this request. Add credits from $5 at https://console.trymorse.ai/credits?sheet=add-credits.",
                    "type": "insufficient_balance",
                    "param": null,
                    "code": "insufficient_balance"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "403": {
            "description": "The key's account may not make this request.",
            "x-error-codes": [
              {
                "code": "account_disabled",
                "when": "Morse has disabled the key's account."
              },
              {
                "code": "account_deleted",
                "when": "The key's account has been deleted."
              },
              {
                "code": "account_under_18",
                "when": "The account's owner said they are under 18."
              },
              {
                "code": "ip_not_allowed",
                "when": "The key allows requests only from its allowed IPs, and the request came from another address. The message names the address the proxy saw."
              },
              {
                "code": "sealed_required",
                "when": "The key is sealed_only, and the request came unsealed. Send it inside POST /v1/sealed, as the Morse app does."
              },
              {
                "code": "service_unavailable_in_region",
                "when": "Morse doesn't serve the place the request comes from, because of US sanctions rules and its providers' terms. Every request from there returns this, whatever the key, unless Morse has admitted your network for a time."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "This account has been disabled. Contact support.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "account_disabled"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "404": {
            "description": "The model does not exist, or it is not a model for this endpoint.",
            "x-error-codes": [
              {
                "code": "model_not_found",
                "when": "No model of this endpoint's type has that name."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The requested model does not exist.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "model_not_found"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "408": {
            "description": "The request body arrived too slowly.",
            "x-error-codes": [
              {
                "code": "request_timeout",
                "when": "The request body did not arrive within one minute."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The request body did not arrive in time.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "request_timeout"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "413": {
            "description": "The request body is too large.",
            "x-error-codes": [
              {
                "code": "request_too_large",
                "when": "The body is over 64 KiB."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Request body is too large.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "request_too_large"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "429": {
            "description": "The account is over its rate limit or its concurrency limit. Search and fetch each also allow 90 calls a minute per account. Wait the number of seconds in Retry-After, then retry.",
            "x-error-codes": [
              {
                "code": "rate_limit_exceeded",
                "when": "The account used up its requests per minute. All of the account's keys and its owner's use of the Morse app share one budget."
              },
              {
                "code": "concurrency_limit_exceeded",
                "when": "The account already has its maximum number of requests in flight. Retry-After is 1."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Rate limit reached for this account. Retry after the time in the Retry-After header.",
                    "type": "requests",
                    "param": null,
                    "code": "rate_limit_exceeded"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "502": {
            "description": "The web provider failed.",
            "x-error-codes": [
              {
                "code": "upstream_error",
                "when": "The provider failed or did not answer in time."
              },
              {
                "code": "upstream_unavailable",
                "when": "The provider is unavailable right now. Retry later, or choose another model."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The web provider failed.",
                    "type": "upstream_error",
                    "param": null,
                    "code": "upstream_error"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "description": "Morse or the provider is busy or unavailable. Retry the request later.",
            "x-error-codes": [
              {
                "code": "service_unavailable",
                "when": "Morse could not start the request. Retry it."
              },
              {
                "code": "server_busy",
                "when": "Morse is busy. Retry-After is 1."
              },
              {
                "code": "upstream_busy",
                "when": "The web provider is busy for every Morse account. Retry-After says when to retry."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The web provider is busy. Try again shortly.",
                    "type": "upstream_error",
                    "param": null,
                    "code": "upstream_busy"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/fetch": {
      "post": {
        "operationId": "fetch",
        "summary": "Read a web page",
        "description": "Reads one public web page and returns its text. Each call costs 1,000 micros, a tenth of a credit. A failed call costs nothing.\n\nPage reading is not offered to API keys for now. GET /v1/models lists no such model to a key, and a key's request here returns 404 model_not_found. A Morse app login can still use it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FetchRequest"
              },
              "example": {
                "model": "parallel-extract",
                "url": "https://go.dev/doc/go1.27"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The result.",
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Funding": {
                "$ref": "#/components/headers/X-Funding"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FetchResult"
                },
                "example": {
                  "object": "fetch.result",
                  "url": "https://go.dev/doc/go1.27",
                  "title": "Go 1.27 Release Notes",
                  "published": null,
                  "fetched": "2026-11-24",
                  "content": "# Go 1.27 Release Notes\n...",
                  "truncated": true
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed.",
            "x-error-codes": [
              {
                "code": "invalid_request_body",
                "when": "The body is not a JSON object, a parameter has the wrong JSON type, or model is missing."
              },
              {
                "code": "invalid_parameter",
                "when": "A parameter has a value the endpoint refuses. The message names the parameter."
              },
              {
                "code": "duplicate_json_key",
                "when": "A JSON object in the body repeats a key."
              },
              {
                "code": "invalid_url",
                "when": "url is missing, or not an http or https URL of at most 2,048 characters on a public server and the default port."
              },
              {
                "code": "privacy_floor_unmet",
                "when": "The model's tier is below the API key's min_privacy. param is key.min_privacy, and the message names both tiers. GET /v1/models lists only the models the key may call. Morse refuses before it calls the model or holds any credit."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "url must be an http or https URL of at most 2048 characters, without credentials, on a public host and the default port, 80, or 443.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_url"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "401": {
            "description": "The key is missing or wrong.",
            "x-error-codes": [
              {
                "code": "invalid_api_key",
                "when": "One of these is true:\n- The Authorization header is missing or not Bearer.\n- The key is unknown or revoked.\n- A token that starts with sk_ is not a whole sk_morse_ key.\n- The bearer is no Morse key or login token at all, such as another service's API key (sk-proj-...)."
              },
              {
                "code": "api_key_expired",
                "when": "The key is past the expiry set on it. Make a new key, or set a later expiry before a key expires."
              },
              {
                "code": "invalid_token",
                "when": "The bearer is shaped as a Morse login token (a JWT) but its signature fails or it has expired. An API key sends the whole sk_morse_ key."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "402": {
            "description": "The account's credits, or what the key's spend limit has left, do not cover the request.",
            "x-error-codes": [
              {
                "code": "insufficient_balance",
                "when": "The balance is below the amount the request must hold. While the balance is negative, the API refuses every metered request."
              },
              {
                "code": "key_spend_limit_reached",
                "when": "What the key's spend limit has left in its window is below the amount the request must hold. A limit that resets daily, weekly, or monthly sends Retry-After, the seconds until it resets. A limit that never resets sends none. Raise or remove the limit in the dashboard, and the next request is served."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The account balance does not cover this request. Add credits from $5 at https://console.trymorse.ai/credits?sheet=add-credits.",
                    "type": "insufficient_balance",
                    "param": null,
                    "code": "insufficient_balance"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "403": {
            "description": "The key's account may not make this request.",
            "x-error-codes": [
              {
                "code": "account_disabled",
                "when": "Morse has disabled the key's account."
              },
              {
                "code": "account_deleted",
                "when": "The key's account has been deleted."
              },
              {
                "code": "account_under_18",
                "when": "The account's owner said they are under 18."
              },
              {
                "code": "ip_not_allowed",
                "when": "The key allows requests only from its allowed IPs, and the request came from another address. The message names the address the proxy saw."
              },
              {
                "code": "sealed_required",
                "when": "The key is sealed_only, and the request came unsealed. Send it inside POST /v1/sealed, as the Morse app does."
              },
              {
                "code": "service_unavailable_in_region",
                "when": "Morse doesn't serve the place the request comes from, because of US sanctions rules and its providers' terms. Every request from there returns this, whatever the key, unless Morse has admitted your network for a time."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "This account has been disabled. Contact support.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "account_disabled"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "404": {
            "description": "The model does not exist, or it is not a model for this endpoint.",
            "x-error-codes": [
              {
                "code": "model_not_found",
                "when": "No model of this endpoint's type has that name."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The requested model does not exist.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "model_not_found"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "408": {
            "description": "The request body arrived too slowly.",
            "x-error-codes": [
              {
                "code": "request_timeout",
                "when": "The request body did not arrive within one minute."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The request body did not arrive in time.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "request_timeout"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "413": {
            "description": "The request body is too large.",
            "x-error-codes": [
              {
                "code": "request_too_large",
                "when": "The body is over 64 KiB."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Request body is too large.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "request_too_large"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "422": {
            "description": "Morse could not read the page. The call costs nothing.",
            "x-error-codes": [
              {
                "code": "fetch_failed",
                "when": "The provider returned no content for the page."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The page could not be read.",
                    "type": "upstream_error",
                    "param": null,
                    "code": "fetch_failed"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "429": {
            "description": "The account is over its rate limit or its concurrency limit. Search and fetch each also allow 90 calls a minute per account. Wait the number of seconds in Retry-After, then retry.",
            "x-error-codes": [
              {
                "code": "rate_limit_exceeded",
                "when": "The account used up its requests per minute. All of the account's keys and its owner's use of the Morse app share one budget."
              },
              {
                "code": "concurrency_limit_exceeded",
                "when": "The account already has its maximum number of requests in flight. Retry-After is 1."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Rate limit reached for this account. Retry after the time in the Retry-After header.",
                    "type": "requests",
                    "param": null,
                    "code": "rate_limit_exceeded"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "502": {
            "description": "The web provider failed.",
            "x-error-codes": [
              {
                "code": "upstream_error",
                "when": "The provider failed or did not answer in time."
              },
              {
                "code": "upstream_unavailable",
                "when": "The provider is unavailable right now. Retry later, or choose another model."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The web provider failed.",
                    "type": "upstream_error",
                    "param": null,
                    "code": "upstream_error"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "description": "Morse or the provider is busy or unavailable. Retry the request later.",
            "x-error-codes": [
              {
                "code": "service_unavailable",
                "when": "Morse could not start the request. Retry it."
              },
              {
                "code": "server_busy",
                "when": "Morse is busy. Retry-After is 1."
              },
              {
                "code": "upstream_busy",
                "when": "The web provider is busy for every Morse account. Retry-After says when to retry."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The web provider is busy. Try again shortly.",
                    "type": "upstream_error",
                    "param": null,
                    "code": "upstream_busy"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/audio/transcriptions": {
      "post": {
        "operationId": "transcribe",
        "summary": "Transcribe audio",
        "description": "Turns a recording of speech into text, with OpenAI's transcription request and response. Send the recording as a WAV file of 16-bit PCM in a multipart form, at most 5 minutes long and 10 MiB. Each call costs a flat 200 micros, a fiftieth of a credit. A failed call costs nothing. whisper-large-v3-tee runs Whisper Large v3 on NEAR's attested hardware. Morse sends the audio to it only over the TLS key its attestation report binds.\n\nTranscription is not offered to API keys for now. GET /v1/models lists no such model to a key, and a key's request here returns 404 model_not_found. A Morse app login can still use it.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TranscriptionRequest"
              },
              "example": {
                "model": "whisper-large-v3-tee",
                "file": "(the recording, as a 16-bit PCM WAV file)",
                "language": "en"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The transcript.",
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Funding": {
                "$ref": "#/components/headers/X-Funding"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transcription"
                },
                "example": {
                  "text": "And so, my fellow Americans, ask not what your country can do for you.",
                  "usage": {
                    "type": "duration",
                    "seconds": 11
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed.",
            "x-error-codes": [
              {
                "code": "invalid_parameter",
                "when": "One of these is true, and the message names it:\n- The body is not a multipart form with a model and a file.\n- A parameter is unknown or sent twice.\n- The file is not a WAV file of 16-bit PCM, mono or stereo, at 8 to 48 kHz, or holds no audio.\n- language is not a code Whisper transcribes.\n- response_format is not json."
              },
              {
                "code": "invalid_request",
                "when": "The provider could not read the audio."
              },
              {
                "code": "e2ee_unsupported_model",
                "when": "The request carries end-to-end encryption headers, which no transcription model takes. An incomplete set returns the e2ee_ code that names what is wrong with it instead."
              },
              {
                "code": "privacy_floor_unmet",
                "when": "The model's tier is below the API key's min_privacy. param is key.min_privacy, and the message names both tiers. GET /v1/models lists only the models the key may call. Morse refuses before it calls the model or holds any credit."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "file must be a WAV file of 16-bit PCM, mono or stereo, at 8 to 48 kHz.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_parameter"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "401": {
            "description": "The key is missing or wrong.",
            "x-error-codes": [
              {
                "code": "invalid_api_key",
                "when": "One of these is true:\n- The Authorization header is missing or not Bearer.\n- The key is unknown or revoked.\n- A token that starts with sk_ is not a whole sk_morse_ key.\n- The bearer is no Morse key or login token at all, such as another service's API key (sk-proj-...)."
              },
              {
                "code": "api_key_expired",
                "when": "The key is past the expiry set on it. Make a new key, or set a later expiry before a key expires."
              },
              {
                "code": "invalid_token",
                "when": "The bearer is shaped as a Morse login token (a JWT) but its signature fails or it has expired. An API key sends the whole sk_morse_ key."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "402": {
            "description": "The account's credits, or what the key's spend limit has left, do not cover the request.",
            "x-error-codes": [
              {
                "code": "insufficient_balance",
                "when": "The balance is below the amount the request must hold. While the balance is negative, the API refuses every metered request."
              },
              {
                "code": "key_spend_limit_reached",
                "when": "What the key's spend limit has left in its window is below the amount the request must hold. A limit that resets daily, weekly, or monthly sends Retry-After, the seconds until it resets. A limit that never resets sends none. Raise or remove the limit in the dashboard, and the next request is served."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The account balance does not cover this request. Add credits from $5 at https://console.trymorse.ai/credits?sheet=add-credits.",
                    "type": "insufficient_balance",
                    "param": null,
                    "code": "insufficient_balance"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "403": {
            "description": "The key's account may not make this request.",
            "x-error-codes": [
              {
                "code": "account_disabled",
                "when": "Morse has disabled the key's account."
              },
              {
                "code": "account_deleted",
                "when": "The key's account has been deleted."
              },
              {
                "code": "account_under_18",
                "when": "The account's owner said they are under 18."
              },
              {
                "code": "ip_not_allowed",
                "when": "The key allows requests only from its allowed IPs, and the request came from another address. The message names the address the proxy saw."
              },
              {
                "code": "sealed_required",
                "when": "The key is sealed_only, and the request came unsealed. Send it inside POST /v1/sealed, as the Morse app does."
              },
              {
                "code": "service_unavailable_in_region",
                "when": "Morse doesn't serve the place the request comes from, because of US sanctions rules and its providers' terms. Every request from there returns this, whatever the key, unless Morse has admitted your network for a time."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "This account has been disabled. Contact support.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "account_disabled"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "404": {
            "description": "The model does not exist, or it is not a model for this endpoint.",
            "x-error-codes": [
              {
                "code": "model_not_found",
                "when": "No model of this endpoint's type has that name."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The requested model does not exist.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "model_not_found"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "408": {
            "description": "The request body arrived too slowly.",
            "x-error-codes": [
              {
                "code": "request_timeout",
                "when": "The request body did not arrive within one minute."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The request body did not arrive in time.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "request_timeout"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "413": {
            "description": "The request body is too large.",
            "x-error-codes": [
              {
                "code": "request_too_large",
                "when": "The body is over 10 MiB, or the recording is longer than 5 minutes."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Request body is too large.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "request_too_large"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "429": {
            "description": "The account is over its rate limit or its concurrency limit. Transcription also allows 30 calls a minute per account. Wait the number of seconds in Retry-After, then retry.",
            "x-error-codes": [
              {
                "code": "rate_limit_exceeded",
                "when": "The account used up its requests per minute. All of the account's keys and its owner's use of the Morse app share one budget."
              },
              {
                "code": "concurrency_limit_exceeded",
                "when": "The account already has its maximum number of requests in flight. Retry-After is 1."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Rate limit reached for this account. Retry after the time in the Retry-After header.",
                    "type": "requests",
                    "param": null,
                    "code": "rate_limit_exceeded"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Ratelimit-Limit-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Limit-Requests"
              },
              "X-Ratelimit-Remaining-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Remaining-Requests"
              },
              "X-Ratelimit-Reset-Requests": {
                "$ref": "#/components/headers/X-Ratelimit-Reset-Requests"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "502": {
            "description": "The transcription provider failed.",
            "x-error-codes": [
              {
                "code": "upstream_error",
                "when": "The provider failed or did not answer."
              },
              {
                "code": "upstream_unavailable",
                "when": "The provider is unavailable right now. Retry later."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The transcription provider failed.",
                    "type": "upstream_error",
                    "param": null,
                    "code": "upstream_error"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              }
            }
          },
          "503": {
            "description": "Morse or the provider is busy or unavailable. Retry the request later.",
            "x-error-codes": [
              {
                "code": "service_unavailable",
                "when": "Morse could not start the request. Retry it."
              },
              {
                "code": "server_busy",
                "when": "Morse is busy. Retry-After is 1."
              },
              {
                "code": "upstream_busy",
                "when": "The transcription provider is busy for every Morse account, or busy itself. Retry later."
              },
              {
                "code": "upstream_unattested",
                "when": "Morse could not verify the attested endpoint. Try again shortly."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The transcription provider is busy. Try again shortly.",
                    "type": "upstream_error",
                    "param": null,
                    "code": "upstream_busy"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "X-Request-Id": {
                "$ref": "#/components/headers/X-Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/key": {
      "get": {
        "operationId": "getKey",
        "summary": "Get the calling key",
        "description": "Returns the API key the request is made with: its settings, what its spend limit has used, and its account's limits. A key with no spend limit also reads the account's balance. A key with one reads what it may still spend instead, so a tool given a limited key does not learn the account's balance. It is the same key object the Morse app's key list shows, and it never carries the key's secret. Only an API key reads it: it changes nothing, and a key still cannot manage its account. The call is free and needs no balance. It does not count toward the account's requests per minute. Each account may read it 60 times a minute, on every plan.",
        "responses": {
          "200": {
            "description": "The key and its account.",
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Key"
                },
                "example": {
                  "object": "key",
                  "id": "0190b2a6-7c3e-7000-8000-00000000a0b1",
                  "name": "ci",
                  "prefix": "sk_morse_4fQx9Lb2",
                  "created_at": "2026-11-01T00:00:00Z",
                  "revoked_at": null,
                  "last_used_at": "2026-11-20T10:00:00Z",
                  "expires_at": "2027-01-01T00:00:00Z",
                  "status": "active",
                  "allowed_ips": [
                    "203.0.113.0/24"
                  ],
                  "min_privacy": "private",
                  "min_tier": "private",
                  "sealed_only": false,
                  "privacy_veil": false,
                  "forward_settings": true,
                  "spend_limit": {
                    "limit_micros": 5000000,
                    "limit_credits": 500,
                    "reset": "monthly",
                    "spent_micros": 1250000,
                    "spent_credits": 125,
                    "resets_at": "2026-12-01T00:00:00Z"
                  },
                  "account": {
                    "balance_micros": 1234567,
                    "balance_credits": 123.4567,
                    "rate_limit_rpm": 600,
                    "concurrency_limit": 10
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing or wrong, or the bearer is not an API key.",
            "x-error-codes": [
              {
                "code": "invalid_api_key",
                "when": "One of these is true:\n- The Authorization header is missing or not Bearer.\n- The key is unknown or revoked.\n- A token that starts with sk_ is not a whole sk_morse_ key.\n- The bearer is no Morse key or login token at all, such as another service's API key (sk-proj-...)."
              },
              {
                "code": "api_key_expired",
                "when": "The key is past the expiry set on it. Make a new key, or set a later expiry before a key expires."
              },
              {
                "code": "invalid_token",
                "when": "The bearer is shaped as a Morse login token (a JWT) but its signature fails or it has expired. An API key sends the whole sk_morse_ key."
              },
              {
                "code": "api_key_required",
                "when": "The bearer is a Morse app login or guest token. A login lists its account's keys in the Morse app."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Incorrect API key provided.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "invalid_api_key"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "403": {
            "description": "The key's account may not make this request.",
            "x-error-codes": [
              {
                "code": "account_disabled",
                "when": "Morse has disabled the key's account."
              },
              {
                "code": "account_deleted",
                "when": "The key's account has been deleted."
              },
              {
                "code": "account_under_18",
                "when": "The account's owner said they are under 18."
              },
              {
                "code": "ip_not_allowed",
                "when": "The key allows requests only from its allowed IPs, and the request came from another address. The message names the address the proxy saw."
              },
              {
                "code": "service_unavailable_in_region",
                "when": "Morse doesn't serve the place the request comes from, because of US sanctions rules and its providers' terms. Every request from there returns this, whatever the key, unless Morse has admitted your network for a time."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "This account has been disabled. Contact support.",
                    "type": "invalid_request_error",
                    "param": null,
                    "code": "account_disabled"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            }
          },
          "429": {
            "description": "The account read its key too often. Wait the number of seconds in Retry-After, then retry.",
            "x-error-codes": [
              {
                "code": "rate_limit_exceeded",
                "when": "The account used up its 60 key reads a minute. All of the account's keys share them. Up to 7 reads can go at once, then one each second."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "Rate limit reached for this account. Retry after the time in the Retry-After header.",
                    "type": "requests",
                    "param": null,
                    "code": "rate_limit_exceeded"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          },
          "503": {
            "description": "Morse or the provider is busy or unavailable. Retry the request later.",
            "x-error-codes": [
              {
                "code": "service_unavailable",
                "when": "Morse could not start the request. Retry it."
              }
            ],
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "message": "The service is temporarily unable to authorize requests. Try again shortly.",
                    "type": "server_error",
                    "param": null,
                    "code": "service_unavailable"
                  }
                }
              }
            },
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            }
          }
        }
      }
    },
    "/v1/version": {
      "get": {
        "operationId": "getVersion",
        "summary": "Get the version",
        "description": "Returns the running build. It needs no key and costs nothing.",
        "security": [],
        "responses": {
          "200": {
            "description": "The build.",
            "headers": {
              "X-Morse-Version": {
                "$ref": "#/components/headers/X-Morse-Version"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Version"
                },
                "example": {
                  "version": "v1.4.0",
                  "pins": "pins@ed3a680"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "anthropicAPIKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "The same sk_morse_ API key, in the header the Anthropic SDKs send it in. Morse reads it when the request has no Authorization header."
      },
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "sk_morse_...",
        "description": "An API key from the Morse app. It starts with sk_morse_."
      }
    },
    "headers": {
      "X-Morse-Keys": {
        "description": "A fingerprint of the keys the enclaves now serving seal with: the first 16 hex digits of the SHA-256 of their sorted key ids. It changes whenever that set of keys changes, and it is absent when no enclave is serving. It names no API key.",
        "schema": {
          "type": "string"
        }
      },
      "X-Should-Retry": {
        "description": "false on every 400, 401, 403, 404, 413, and 422 refusal, because sending the same request again cannot succeed. The Anthropic and OpenAI SDKs and Claude Code read it.",
        "schema": {
          "type": "string",
          "const": "false"
        }
      },
      "X-Morse-Version": {
        "description": "The running build. Every response the server makes carries it. A refusal the inference door makes itself does not, such as its 404 not_found or its 401 for a request with no key.",
        "schema": {
          "type": "string"
        }
      },
      "X-Funding": {
        "description": "What pays for the request. With a key, the value is always credits. A request that Morse refuses before it bills anything has no X-Funding.",
        "schema": {
          "type": "string",
          "enum": [
            "credits",
            "included"
          ]
        }
      },
      "X-Request-Id": {
        "description": "An id for this request. Quote it when you contact support about the request. An error that arrives after the request starts carries it too. A request that Morse refuses before it bills anything has no X-Request-Id.",
        "schema": {
          "type": "string"
        }
      },
      "Retry-After": {
        "description": "Whole seconds to wait before retrying, at least 1.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "X-Ratelimit-Limit-Requests": {
        "description": "The account's requests per minute, the limit behind 429 rate_limit_exceeded. All of the account's keys and its owner's use of the Morse app share it. A response carries the three X-Ratelimit headers when the account's rate limit judged its request. That is a request a key sends that Morse bills and that this limit judged, and the 429 rate_limit_exceeded this limit returns. A request paced by the included allowance carries none, and neither does a replayed response. A 429 from a route's own allowance carries none either, such as search's 90 calls a minute. Morse has no token rate limit, so it sends no x-ratelimit-*-tokens headers.",
        "schema": {
          "type": "integer",
          "minimum": 1
        }
      },
      "X-Ratelimit-Remaining-Requests": {
        "description": "How many more requests the account could send at once, as of this response, before a 429 rate_limit_exceeded. Requests sent since, by any of its keys, lower it. The account regains one request every 60 seconds divided by its limit. It holds at most its limit divided by 10 (rounded down, at least 1) plus one at once. 0 on the 429.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "X-Ratelimit-Reset-Requests": {
        "description": "The time until the account may send its whole burst at once again. It is rounded up to a whole second and written as 1s, 45s, or 6m0s. 0s when it already may.",
        "schema": {
          "type": "string"
        }
      },
      "X-Output-Limited": {
        "description": "Set when Morse lowered the output limit so that the request fits. balance means the account's credits, and key_limit means what the key's spend limit has left.",
        "schema": {
          "enum": [
            "balance",
            "key_limit"
          ]
        }
      },
      "X-Tier": {
        "description": "The privacy tier of the endpoint that served the response. TEE is opt-in. A request on a model id is served at private or anon, at or above its provider.min_privacy and the key's minimum tier. It is served at tee only when either of those is tee, or the model has no private or anon endpoint at or above them. This header says which tier served it. It is at least the request's floor. No header names the provider or the endpoint.",
        "schema": {
          "enum": [
            "anon",
            "private",
            "tee",
            "e2ee"
          ]
        }
      },
      "X-Model-Successor": {
        "description": "Set when the request named a retired model id: the id that replaced it, which served the request. A retired id keeps working and is billed at its replacement's price. The docs list every retired id and its replacement.",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "Key": {
        "type": "object",
        "description": "An API key's settings and its account's standing, as GET /v1/key returns them.",
        "required": [
          "object",
          "id",
          "name",
          "prefix",
          "created_at",
          "revoked_at",
          "last_used_at",
          "expires_at",
          "status",
          "allowed_ips",
          "min_privacy",
          "min_tier",
          "sealed_only",
          "privacy_veil",
          "forward_settings",
          "spend_limit",
          "account"
        ],
        "properties": {
          "object": {
            "const": "key"
          },
          "id": {
            "type": "string",
            "description": "The key's id."
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string",
            "description": "The first characters of the secret, to tell keys apart. The secret itself is shown once, when the key is made."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Always null here: a revoked key is refused."
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the key stops working, or null for never."
          },
          "status": {
            "type": "string",
            "enum": [
              "active"
            ],
            "description": "active: an expired or revoked key is refused."
          },
          "allowed_ips": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The addresses and CIDR ranges the key may be used from. Empty allows any address."
          },
          "min_privacy": {
            "type": "string",
            "enum": [
              "anon",
              "private",
              "tee",
              "e2ee"
            ],
            "description": "The lowest privacy tier the key's requests may run at. A key can no longer be set to e2ee. An older key at e2ee finds no model until this is lowered."
          },
          "min_tier": {
            "type": "string",
            "enum": [
              "anon",
              "private",
              "tee",
              "e2ee"
            ],
            "description": "The same as min_privacy, under its earlier name."
          },
          "sealed_only": {
            "type": "boolean",
            "description": "True when the key may send only requests sealed to Morse's enclave, through POST /v1/sealed."
          },
          "privacy_veil": {
            "type": "boolean",
            "description": "True when every chat of the key runs with the Privacy Veil."
          },
          "forward_settings": {
            "type": "boolean",
            "description": "True when a chat's sampling settings, such as temperature, reach the model's provider."
          },
          "spend_limit": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/KeySpendLimit"
              }
            ],
            "description": "The most the key may spend, or null for no limit."
          },
          "account": {
            "$ref": "#/components/schemas/KeyAccount"
          },
          "spend_remaining": {
            "type": "object",
            "description": "What a key with a spend limit may still spend in the period: the limit less what it has spent, never below 0. Present only on such a key, which does not read the account's balance. Absent on a key with no limit.",
            "required": [
              "micros",
              "credits"
            ],
            "properties": {
              "micros": {
                "type": "integer"
              },
              "credits": {
                "type": "number"
              }
            }
          }
        }
      },
      "KeySpendLimit": {
        "type": "object",
        "required": [
          "limit_micros",
          "limit_credits",
          "reset",
          "spent_micros",
          "spent_credits",
          "resets_at"
        ],
        "properties": {
          "limit_micros": {
            "type": "integer"
          },
          "limit_credits": {
            "type": "number"
          },
          "reset": {
            "type": "string",
            "enum": [
              "never",
              "daily",
              "weekly",
              "monthly"
            ]
          },
          "spent_micros": {
            "type": "integer",
            "description": "What the key spent in the current window."
          },
          "spent_credits": {
            "type": "number"
          },
          "resets_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the window starts again, or null for a limit that never resets."
          }
        }
      },
      "KeyAccount": {
        "type": "object",
        "description": "The key's account, with the names GET /v1/account uses.",
        "required": [
          "rate_limit_rpm",
          "concurrency_limit"
        ],
        "properties": {
          "balance_micros": {
            "type": "integer",
            "description": "The account's credit balance in micro-dollars, plan and referral credits included, and never below 0. Absent on a key with a spend limit, which reads spend_remaining instead."
          },
          "balance_credits": {
            "type": "number",
            "description": "The same balance in credits, 100 to the dollar."
          },
          "rate_limit_rpm": {
            "type": "integer",
            "description": "The requests a minute the account may make across all its keys."
          },
          "concurrency_limit": {
            "type": "integer",
            "description": "The requests the account may have running at once."
          }
        }
      },
      "Error": {
        "type": "object",
        "description": "Every JSON error response has this shape. Branch on code, which is stable. The message is for people and can change.",
        "additionalProperties": false,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "message",
              "type",
              "param",
              "code"
            ],
            "properties": {
              "message": {
                "type": "string",
                "description": "A sentence that says what went wrong and what to do."
              },
              "type": {
                "type": "string",
                "description": "The error's family, such as invalid_request_error, insufficient_balance, plan, requests, upstream_error, or server_error. plan means the account's plan does not allow the model, even when credits pay for the request."
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The parameter the error is about, or null when the error is about no one parameter. A body parameter is named by its path in the request body, such as model, messages, provider.max_price, or messages[0].content[1].type. A query parameter is named as it is, such as shape. key.min_privacy and key.privacy_veil name a setting of the API key that refused the request, not a parameter of the request."
              },
              "code": {
                "type": "string",
                "description": "The specific error. Each operation lists the codes it can return."
              }
            }
          }
        }
      },
      "ChatMessage": {
        "type": "object",
        "required": [
          "role"
        ],
        "description": "One message of the conversation. Morse keeps content and tool_calls on an assistant message, content and tool_call_id on a tool message, and only content on every other role. It drops name. An assistant message's earlier reasoning is a string under reasoning_content or reasoning. Morse sends it back to an open model's provider under the key that provider reads, so a tool loop continues from its earlier reasoning. These are sent none of it: a provider that reads none, a tee chat sealed for its client, and a Claude, GPT, Gemini, or Grok model. It counts as prompt tokens where it is sent.",
        "properties": {
          "role": {
            "type": "string",
            "description": "system, developer, user, assistant, or tool. A developer message reaches an open model's provider as system, the role its chat template knows."
          },
          "content": {
            "description": "Text, or an array of content parts. Media must be inline. If an image_url, video_url, audio_url, or file_url part has a URL that does not start with data:, Morse refuses the request with remote_media. A file part may carry only file_data and filename.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ContentPart"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "The tool calls an assistant message made, as the model returned them."
          },
          "tool_call_id": {
            "type": "string",
            "description": "On a tool message, the id of the tool call it answers."
          }
        }
      },
      "ContentPart": {
        "type": "object",
        "required": [
          "type"
        ],
        "description": "A part of a message's content. Anthropic, Gemini, and OpenAI models take text parts and image_url parts. An image_url part takes a base64 JPEG, PNG, GIF, or WebP data URL, with detail set to auto, low, or high. Other part types reach only the models that read them.",
        "properties": {
          "type": {
            "type": "string",
            "description": "text, image_url, or another part type the model reads."
          },
          "text": {
            "type": "string"
          },
          "image_url": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string",
                "description": "A data: URL, such as data:image/png;base64,iVBORw0KGgo..."
              },
              "detail": {
                "type": "string",
                "enum": [
                  "auto",
                  "low",
                  "high"
                ]
              }
            }
          }
        }
      },
      "Tool": {
        "type": "object",
        "required": [
          "type",
          "function"
        ],
        "properties": {
          "type": {
            "const": "function"
          },
          "function": {
            "type": "object",
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "parameters": {
                "type": "object",
                "description": "A JSON Schema object for the function's arguments."
              }
            }
          }
        }
      },
      "ChatCompletionRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "description": "Of the parameters below, all but provider reach the model. temperature, top_p, stop, seed, n, and response_format reach it only from an API key whose forward_settings is on. That is \"Let my settings reach the model host\" on the key in the developer console, https://console.trymorse.ai/keys. A new key has it on unless POST /v1/keys sends forward_settings false or null. The console or PATCH /v1/keys/{id} turns it off or on. A key with forward_settings off is refused any of those parameters with 400 setting_not_forwarded, which names the parameter. Morse refuses it before it calls the model or holds any credit, and a null value counts as absent. A response_format of {\"type\":\"text\"} or null counts as absent.\n\nA response_format of type json_object or json_schema reaches only the providers whose Morse endpoint records that it honours that type. Morse picks one of them. When none of the model's endpoints does, it is refused with 400 unsupported_parameter, which names response_format and the type.\n\nThe sampling settings frequency_penalty, presence_penalty, repetition_penalty, top_k, min_p, and logit_bias reach the model on the same terms. They reach it only on a model with an endpoint whose provider takes the setting, and GET /v1/models lists each tier's supported_parameters. On any other model each is refused with 400 unsupported_parameter, which names it.\n\nMorse sends some parameters that change the response to no model, such as logprobs, top_logprobs, modalities, audio, prediction, verbosity, or web_search_options. Each is refused with 400 unsupported_parameter, which names it. The exception is a value that changes nothing: false, 0, null, an empty object, or modalities [\"text\"]. A models list that names more than one model is refused with 400 unsupported_parameter. Morse fails over between the providers of the one model a request names, not to another model.\n\nMorse drops every other parameter without an error, such as user, metadata, store, service_tier, safety_identifier, or prompt_cache_key. A chat from the Morse app is sent none of these parameters and is refused none of them.",
        "properties": {
          "model": {
            "type": "string",
            "minLength": 1,
            "description": "A chat model's id from GET /v1/models."
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 4096,
            "description": "The conversation, at least one message. An empty or missing messages is refused with 400 invalid_parameter naming messages, before Morse calls the model or holds any credit.",
            "items": {
              "$ref": "#/components/schemas/ChatMessage"
            }
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "Send the response as server-sent events."
          },
          "stream_options": {
            "type": "object",
            "properties": {
              "include_usage": {
                "type": "boolean",
                "default": false,
                "description": "Send a last chunk with usage and an empty choices array before [DONE]. Without it, the stream carries no usage."
              }
            }
          },
          "max_completion_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "description": "The most output tokens the model may produce. The limit is the max_output_tokens of the tier that serves the request, as GET /v1/models lists it under tiers. A model's tiers can differ. Morse lowers a value above that tier's max_output_tokens to it. When neither limit is set, the model's default applies. The account must hold credit for the most the request could cost, so a lower limit holds less credit."
          },
          "max_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "description": "The same as max_completion_tokens. When both are set, max_completion_tokens wins."
          },
          "reasoning_effort": {
            "type": "string",
            "enum": ["none", "minimal", "low", "medium", "high", "xhigh", "max"],
            "description": "How much a reasoning model reasons, such as low, medium, or high. Morse sends the nearest effort the model takes, listed as the model's reasoning_efforts in GET /v1/models. That is the lowest listed effort at or above the one asked for, or the highest listed. A model whose reasoning_efforts is empty is sent no reasoning_effort. Any value other than none, minimal, low, medium, high, xhigh, or max is refused with 400 invalid_parameter. When reasoning_effort is absent, the model's default applies."
          },
          "reasoning": {
            "type": ["object", "null"],
            "description": "OpenRouter's form of reasoning_effort. effort is one of none, minimal, low, medium, high, xhigh, or max. max_tokens is a thinking budget, read as the effort it means. enabled false asks for none, and enabled true alone for medium. exclude true leaves reasoning_content out of the response, though the model still reasons and its tokens are billed. effort beside max_tokens, or an effort other than reasoning_effort's, is refused with 400."
          },
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tool"
            }
          },
          "tool_choice": {
            "description": "auto, none, required, or one named function. Some models have no provider for the request that takes a forced call: Kimi K2.6 on Novita, and Kimi K2.7 Code. On those, required or a named function is refused with 400 unsupported_parameter naming tool_choice. A model with another provider that takes one skips the provider that refuses it.",
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "auto",
                  "none",
                  "required"
                ]
              },
              {
                "type": "object",
                "required": [
                  "type",
                  "function"
                ],
                "properties": {
                  "type": {
                    "const": "function"
                  },
                  "function": {
                    "type": "object",
                    "required": [
                      "name"
                    ],
                    "properties": {
                      "name": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            ]
          },
          "parallel_tool_calls": {
            "type": "boolean"
          },
          "temperature": {
            "type": ["number", "null"],
            "minimum": 0,
            "maximum": 2,
            "description": "Sent to the model only from an API key whose forward_settings is on. Any other key is refused with 400 setting_not_forwarded."
          },
          "top_p": {
            "type": ["number", "null"],
            "minimum": 0,
            "maximum": 1,
            "description": "Sent to the model only from an API key whose forward_settings is on. Any other key is refused with 400 setting_not_forwarded."
          },
          "stop": {
            "oneOf": [
              {"type": "string"},
              {"type": "array", "maxItems": 4, "items": {"type": "string"}},
              {"type": "null"}
            ],
            "description": "Up to 4 strings the model stops before. Sent to the model only from an API key whose forward_settings is on. Any other key is refused with 400 setting_not_forwarded."
          },
          "frequency_penalty": {
            "type": ["number", "null"],
            "description": "Sent to the model only from an API key whose forward_settings is on, and only on a model with an endpoint whose provider takes it. Any other model is refused it with 400 unsupported_parameter. From -2 to 2. 0 or null counts as absent."
          },
          "presence_penalty": {
            "type": ["number", "null"],
            "description": "Sent to the model only from an API key whose forward_settings is on, and only on a model with an endpoint whose provider takes it. Any other model is refused it with 400 unsupported_parameter. From -2 to 2. 0 or null counts as absent."
          },
          "repetition_penalty": {
            "type": ["number", "null"],
            "description": "Sent to the model only from an API key whose forward_settings is on, and only on a model with an endpoint whose provider takes it. Any other model is refused it with 400 unsupported_parameter. From 0 to 2."
          },
          "top_k": {
            "type": ["integer", "null"],
            "description": "Sent to the model only from an API key whose forward_settings is on, and only on a model with an endpoint whose provider takes it. Any other model is refused it with 400 unsupported_parameter. A whole number from 0."
          },
          "min_p": {
            "type": ["number", "null"],
            "description": "Sent to the model only from an API key whose forward_settings is on, and only on a model with an endpoint whose provider takes it. Any other model is refused it with 400 unsupported_parameter. From 0 to 1."
          },
          "logit_bias": {
            "type": ["object", "null"],
            "description": "Sent to the model only from an API key whose forward_settings is on, and only on a model with an endpoint whose provider takes it. Any other model is refused it with 400 unsupported_parameter. An object of at most 300 token ids, each a whole number, to numbers from -100 to 100. An empty object counts as absent."
          },
          "seed": {
            "type": ["integer", "null"],
            "description": "Sent to the model only from an API key whose forward_settings is on. Any other key is refused with 400 setting_not_forwarded. Whether the same seed returns the same response is up to the model's provider."
          },
          "n": {
            "type": ["integer", "null"],
            "enum": [1, null],
            "description": "1 only: Morse returns one choice. Any other value is refused with 400 invalid_parameter. 1 is sent to the model only from an API key whose forward_settings is on. Any other key is refused it with 400 setting_not_forwarded."
          },
          "response_format": {
            "type": ["object", "null"],
            "description": "JSON mode: {\"type\":\"json_object\"} or {\"type\":\"json_schema\",\"json_schema\":{...}}, sent to the model as given. {\"type\":\"text\"} or null counts as absent, and any other type is refused with 400 invalid_parameter. Sent only from an API key whose forward_settings is on, and any other key is refused it with 400 setting_not_forwarded. Morse sends it only to an endpoint that records that it honours the type, picking one among the model's endpoints. It refuses it with 400 unsupported_parameter when the model has none. Examples are a Claude, Gemini, or GPT model. How closely the response follows a schema is up to the model's provider."
          },
          "provider": {
            "type": "object",
            "additionalProperties": false,
            "description": "Conditions on the model that serves the request. Morse checks them itself and never sends this object to the model's provider. Morse chooses the provider within a privacy tier, and a response does not name it. order, sort, preferred_min_throughput, preferred_max_latency, and require_parameters are accepted after a check of their shape and have no effect. quantizations chooses among the providers by the precision each serves. only, ignore, and enforce_distillable_text are refused with 400 provider_choice_unsupported. Any other parameter is refused with 400 invalid_parameter, which names the parameter.",
            "properties": {
              "min_privacy": {
                "type": "string",
                "enum": ["anon", "private", "tee"],
                "description": "The lowest privacy tier the request may run at, from lowest to highest anon, private, and tee. TEE is opt-in. Without min_privacy, or with anon or private, a request on a model id runs at private or anon, at or above the floor. It does so where the model has an endpoint there, so set tee to require attested hardware. A model whose tier, as GET /v1/models lists it, is below it is refused with 400 privacy_floor_unmet. Morse refuses it before it calls the model or holds any credit. Any other value is refused with 400 invalid_parameter. API keys are not offered end-to-end encryption for now, so e2ee is refused with 400 privacy_floor_unmet."
              },
              "zdr": {
                "type": "boolean",
                "description": "true raises the floor to private and keeps only the endpoints that retain no data. An endpoint not marked zdr is left out. Phala and NEAR tee endpoints are marked zdr and kept, as is Tinfoil's tee endpoint for DeepSeek V4.1 Flash 1017. So a model served only by endpoints left out is refused with 400 privacy_floor_unmet. false does nothing."
              },
              "data_collection": {
                "type": "string",
                "enum": ["allow", "deny"],
                "description": "deny is the same as zdr true. allow does nothing."
              },
              "allow_fallbacks": {
                "type": "boolean",
                "description": "false keeps only the endpoints at the privacy tier of the first one the request can reach. The request is then served at that tier or fails. Retries among that tier's endpoints stay. true does nothing."
              },
              "max_price": {
                "type": "object",
                "additionalProperties": false,
                "description": "The most the request may cost per million tokens, in dollars, as a number or a string holding one. Morse drops every tier whose price to you is above a cap, and that price is list for an API key. It refuses with 400 max_price_unmet when none is left. image, audio, and request are refused with 400 unsupported_parameter.",
                "properties": {
                  "prompt": {
                    "type": ["number", "string"],
                    "description": "Dollars per million prompt tokens."
                  },
                  "completion": {
                    "type": ["number", "string"],
                    "description": "Dollars per million completion tokens."
                  }
                }
              },
              "quantizations": {
                "type": ["array", "null"],
                "minItems": 1,
                "items": {
                  "type": "string",
                  "enum": ["int4", "int8", "fp4", "mxfp4", "nvfp4", "fp6", "fp8", "mxfp8", "fp16", "bf16", "fp32", "unknown"]
                },
                "description": "The precisions a provider may serve the model at, in OpenRouter's names (https://openrouter.ai/docs/guides/routing/provider-selection, \"Quantization Levels\"). Morse keeps only the providers whose published precision the list admits, at the tiers the request already reaches. Every retry and failover stays among them. fp4 also admits mxfp4 and nvfp4, and fp8 also admits mxfp8. A provider that publishes no precision is unknown, as every provider of a closed model is. It qualifies only when the list names unknown. The filter never moves a request to another tier: when no provider qualifies, the request is refused with 400 quantization_unmet. GET /v1/models lists each tier's quantizations. An empty list, or a name not in the enum, is refused with 400 invalid_parameter, and null does nothing."
              },
              "order": {
                "type": "array",
                "items": {"type": "string"},
                "description": "Accepted and ignored. Morse chooses the provider."
              },
              "sort": {
                "type": ["string", "object"],
                "description": "Accepted and ignored. A string, or an object with by and partition."
              },
              "preferred_min_throughput": {
                "type": ["number", "object"],
                "description": "Accepted and ignored."
              },
              "preferred_max_latency": {
                "type": ["number", "object"],
                "description": "Accepted and ignored."
              },
              "require_parameters": {
                "type": "boolean",
                "description": "Accepted and ignored. Morse refuses or drops a parameter by the model's own rules and does not route around it."
              }
            }
          },
          "privacy_veil": {
            "type": ["boolean", "object", "null"],
            "description": "Asks for the Privacy Veil, which replaces personal details in the messages with placeholders before the model sees them. It puts them back in the response. true turns it on, and so does an object of these:\n- report: true lists each detail and its placeholder in the response.\n- restore: prose, the default, or none.\n- release: which tools may receive which kinds of detail.\n\nfalse, null, or absent asks for nothing. The exception is a key that requires the Veil, which refuses false with 400 privacy_veil_required. Any other value is refused with 400 invalid_parameter. A veiled response carries X-Privacy-Veil: applied. When the Veil cannot serve the chat, Morse does not send it and returns 503 privacy_veil_unavailable."
          }
        }
      },
      "Usage": {
        "type": "object",
        "required": [
          "prompt_tokens",
          "completion_tokens",
          "total_tokens"
        ],
        "properties": {
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          },
          "prompt_tokens_details": {
            "type": "object",
            "properties": {
              "cached_tokens": {
                "type": "integer"
              }
            }
          },
          "completion_tokens_details": {
            "type": "object",
            "properties": {
              "reasoning_tokens": {
                "type": "integer"
              }
            }
          },
          "unanswered": {
            "type": "boolean",
            "description": "Present, and true, only when the response reached its output limit (finish_reason length) having shown nothing. That means no text, refusal, tool call, or visible reasoning: a reasoning model thought through the whole limit. The account paid for the prompt alone, and completion_tokens still counts what the provider reported. Absent on every other response."
          },
          "cost": {
            "type": "number",
            "description": "What this request costs in US dollars, exact to the micro (0.000001), such as 0.000412. It is the provider's reported tokens, cache reads and cache writes among them, at the price your key pays for the model. It counts nothing for completion_tokens on an unanswered response. It adds the Privacy Veil's charge when the chat asked for it. Present only on a chat completion made with an API key, in the response's usage and in a stream's usage chunk. It is an estimate made as the response ends. The account's usage (GET /v1/usage, read with a login) has the charge as billed."
          }
        }
      },
      "AnthropicError": {
        "type": "object",
        "description": "Anthropic's error envelope. error.type follows the status:\n- invalid_request_error (400)\n- authentication_error (401)\n- billing_error (402)\n- permission_error (403)\n- not_found_error (404)\n- request_too_large (413)\n- rate_limit_error (429)\n- api_error (500 and 502)\n- overloaded_error (503)",
        "required": [
          "type",
          "error"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "error"
            ]
          },
          "error": {
            "type": "object",
            "required": [
              "type",
              "message"
            ],
            "properties": {
              "type": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "ChatCompletion": {
        "type": "object",
        "required": [
          "id",
          "object",
          "model",
          "choices"
        ],
        "description": "The response. id is a new chatcmpl- id, and model is the id you sent. The exception is tee models, whose response comes unchanged from the attested server.",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "chat.completion"
          },
          "created": {
            "type": "integer",
            "description": "Unix seconds."
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "index",
                "message",
                "finish_reason"
              ],
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "type": "object",
                  "required": [
                    "role"
                  ],
                  "properties": {
                    "role": {
                      "const": "assistant"
                    },
                    "content": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_content": {
                      "type": "string",
                      "description": "The model's reasoning text, when the model reasons and shows it. One name whichever provider served: Morse renames it when a provider names it reasoning. Absent when there is none."
                    },
                    "refusal": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "tool_calls": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                },
                "finish_reason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "stop, length, tool_calls, or content_filter. A response cut at its output limit inside a tool call finishes length, and the call's arguments may be incomplete."
                }
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "ChatCompletionChunk": {
        "type": "object",
        "required": [
          "id",
          "object",
          "model",
          "choices"
        ],
        "description": "One event of a streamed response. Each event also carries obfuscation, a random string of 16 to 64 letters and digits that pads the event's length. Ignore it.",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "chat.completion.chunk"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "index",
                "delta"
              ],
              "properties": {
                "index": {
                  "type": "integer"
                },
                "delta": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string"
                    },
                    "content": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_content": {
                      "type": "string",
                      "description": "The model's reasoning text, when the model reasons and shows it. One name whichever provider served: Morse renames it when a provider names it reasoning. Absent when there is none."
                    },
                    "tool_calls": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                },
                "finish_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          },
          "obfuscation": {
            "type": "string"
          }
        }
      },
      "ModelList": {
        "description": "The list in the shape GET /v1/models served: one entry per model with its tiers, or one entry per alias.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/ModelListByTier"
          },
          {
            "$ref": "#/components/schemas/ModelListByAlias"
          }
        ]
      },
      "ModelListByTier": {
        "type": "object",
        "required": [
          "object",
          "data",
          "aliases"
        ],
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "description": "One entry per model, sorted by id.",
            "items": {
              "$ref": "#/components/schemas/ModelWithTiers"
            }
          },
          "aliases": {
            "type": "array",
            "description": "The other names that reach a model, each at one tier. An alias names a tier, not a provider.",
            "items": {
              "$ref": "#/components/schemas/ModelAlias"
            }
          }
        }
      },
      "ModelListByAlias": {
        "type": "object",
        "required": [
          "object",
          "data"
        ],
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model"
            }
          }
        }
      },
      "ModelAlias": {
        "type": "object",
        "required": [
          "name",
          "model",
          "tier"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "model": {
            "type": "string",
            "description": "The id of the model the alias reaches."
          },
          "tier": {
            "type": "string",
            "enum": [
              "anon",
              "private",
              "tee",
              "e2ee"
            ]
          }
        }
      },
      "ModelWithTiers": {
        "type": "object",
        "required": [
          "id",
          "object",
          "created",
          "owned_by",
          "type",
          "tiers"
        ],
        "description": "A model, listed once. The properties at the top describe the weights. Each row of tiers is the model at one privacy tier, with the price and limits it is sold at there. A tier with no price is not listed. plan and included describe the Morse app. They do not apply to API keys, which always pay with credits.",
        "properties": {
          "id": {
            "type": "string",
            "description": "The model's id."
          },
          "object": {
            "const": "model"
          },
          "created": {
            "type": "integer",
            "description": "When Morse first listed the model, in Unix seconds. 0 when Morse has no record of that."
          },
          "owned_by": {
            "type": "string",
            "description": "Who made the model. An API key and GET /v1/catalog see the model's lab here. A Morse app login sees morse here for most open-weight models."
          },
          "type": {
            "type": "string",
            "enum": [
              "chat",
              "image",
              "video",
              "search",
              "fetch",
              "research",
              "transcription",
              "speech"
            ],
            "description": "The endpoint that serves the model, as for a model in the aliases shape."
          },
          "label": {
            "type": "string"
          },
          "uncensored": {
            "const": true,
            "description": "True on a model whose provider does not filter what it produces. Absent on every other model."
          },
          "input_modalities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Absent when the model reads text only."
          },
          "reasoning_efforts": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["none", "minimal", "low", "medium", "high", "xhigh", "max"]
            },
            "description": "On every chat model: the efforts it takes, lowest first. Empty when it takes none."
          },
          "always_reasons": {
            "const": true,
            "description": "True on a chat model that reasons on every request and takes no effort, whose reasoning_efforts is empty. Absent on every other model."
          },
          "tools": {
            "const": false,
            "description": "False on a chat model served without tools. An API key's request that lets it call a tool is refused with 400 unsupported_parameter naming tools. That is a request with tools, or with a tool_choice that calls one, other than none. Any other request reaches the provider with no tools, tool_choice, or parallel_tool_calls. Absent on every model that takes tools."
          },
          "characters": {
            "const": false,
            "description": "False on a chat model kept out of character chats. A chat that plays a character on it sends X-Character or a character's prompt. It is refused with 400 model_unsupported_for_characters before Morse calls the model or holds any credit. Absent on every model that takes character chats."
          },
          "supported_parameters": {
            "type": "array",
            "items": {"type": "string"},
            "description": "On a chat model: every parameter any of its tiers' rows lists, in the same order and names, where OpenRouter's clients read a model's own."
          },
          "tiers": {
            "type": "array",
            "description": "The tiers the model is sold at, from the least private to the most. Each tier appears once, whichever providers serve it.",
            "items": {
              "$ref": "#/components/schemas/ModelTier"
            }
          }
        }
      },
      "ModelTier": {
        "type": "object",
        "required": [
          "tier",
          "price"
        ],
        "description": "A model at one privacy tier. Its limits are those a request at the tier is held to. A backup provider with a smaller window of its own serves only the chats that fit it and never changes them. Where the tier's main providers differ, a limit is the widest of theirs. Retention is the least private of the tier's providers. A row never names a provider.",
        "properties": {
          "tier": {
            "type": "string",
            "enum": [
              "anon",
              "private",
              "tee",
              "e2ee"
            ],
            "description": "The privacy tier:\n- anon reaches the vendor without your identity.\n- private runs on a provider with zero data retention.\n- tee runs on attested hardware.\n- e2ee also encrypts the messages to that hardware. A list read with an API key never shows it."
          },
          "retention": {
            "type": "string",
            "enum": [
              "vendor",
              "zdr"
            ]
          },
          "attesters": {
            "type": "array",
            "description": "On a tee row: the vendors whose attestation proves the tier.",
            "items": {
              "type": "object",
              "required": [
                "name"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "sealed_model": {
                  "type": "string"
                }
              }
            }
          },
          "quantizations": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["int4", "int8", "fp4", "mxfp4", "nvfp4", "fp6", "fp8", "mxfp8", "fp16", "bf16", "fp32", "unknown"]
            },
            "description": "On a chat row: the precisions the tier's providers publish for the weights. They are in OpenRouter's names and order: integers, then floats, each fewest bits first, and unknown last. unknown is a provider that publishes none. The list counts every provider a chat at the tier may run on, backups included, and names none of them. provider.quantizations chooses among these."
          },
          "supported_parameters": {
            "type": "array",
            "items": {"type": "string"},
            "description": "On a chat row: the request parameters at least one of the tier's endpoints takes, in OpenRouter's names:\n- max_tokens\n- temperature, top_p, stop, and seed, where the tier's provider is sent a key's settings\n- tools and tool_choice\n- reasoning and reasoning_effort, on a model that takes an effort\n- response_format for JSON mode, and structured_outputs for a JSON schema\n- the sampling settings frequency_penalty, logit_bias, min_p, presence_penalty, repetition_penalty, and top_k\n\nA parameter the list lacks is refused with 400 unsupported_parameter. The exception is max_tokens' neighbours that Morse drops, which are ignored. Absent on a row that is no chat."
          },
          "context_tokens": {
            "type": "integer"
          },
          "max_output_tokens": {
            "type": "integer",
            "description": "The most output tokens a request served at this tier may produce. A request asking more receives this many."
          },
          "provider_limits": {
            "type": "object",
            "description": "On a chat row, present only when a provider the row names allows less than the row. It is keyed by the name in providers, and each value gives that provider's own context_tokens and max_output_tokens. The row's own two are the widest at the tier."
          },
          "compact_at_tokens": {
            "type": "integer"
          },
          "input_modalities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "What a chat at this tier reads, present only when it differs from the model's input_modalities. An example is [\"text\"] on a text-only tier of a model that reads images. A client offers the row's value when it has one, and the model's otherwise."
          },
          "reasoning_efforts": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["none", "minimal", "low", "medium", "high", "xhigh", "max"]
            },
            "description": "The efforts a chat at this tier takes, lowest first, present only when they differ from the model's reasoning_efforts. A client offers the row's value when it has one and the model's otherwise."
          },
          "default_reasoning_effort": {
            "type": "string",
            "description": "The effort a chat runs at when it sets none. Absent when the vendor chooses."
          },
          "plan": {
            "type": "string",
            "description": "The lowest plan the Morse app lists the model under."
          },
          "requires_plan": {
            "type": "string",
            "description": "The lowest plan that may call the model in the Morse app. It does not apply to API keys."
          },
          "included": {
            "type": "object",
            "description": "What plans include in the Morse app. It does not apply to API keys."
          },
          "price": {
            "type": "object",
            "description": "What you pay at this tier, in micro-dollars. 10,000 micros are one credit, which is $0.01. An API key pays the vendor's list price, and a Morse app login pays it at the model's markup. A chat model lists its prompt and completion price per million tokens. An image model lists its price per image and per reference image. A search, fetch, research, or transcription model lists its flat price per call.",
            "properties": {
              "prompt_micros_per_mtok": {
                "type": "integer"
              },
              "cached_prompt_micros_per_mtok": {
                "type": "integer",
                "description": "The price of a million prompt tokens that the model's provider reads from its cache, which usage counts in prompt_tokens_details.cached_tokens. Absent when those tokens cost nothing."
              },
              "completion_micros_per_mtok": {
                "type": "integer"
              },
              "min_hold_micros": {
                "type": "integer"
              },
              "micros_per_image": {
                "type": "integer"
              },
              "micros_per_reference": {
                "type": "integer"
              },
              "micros_per_second": {
                "type": "integer"
              },
              "micros_per_call": {
                "type": "integer"
              }
            }
          }
        }
      },
      "Message": {
        "type": "object",
        "description": "An Anthropic Message: the whole response.",
        "required": [
          "id",
          "type",
          "role",
          "model",
          "content",
          "stop_reason",
          "usage"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "message"
            ]
          },
          "role": {
            "type": "string",
            "enum": [
              "assistant"
            ]
          },
          "model": {
            "type": "string",
            "description": "The model as the request named it."
          },
          "content": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "text",
                    "thinking",
                    "tool_use"
                  ]
                }
              }
            }
          },
          "stop_reason": {
            "type": "string",
            "enum": [
              "end_turn",
              "tool_use",
              "max_tokens",
              "refusal"
            ]
          },
          "stop_sequence": {
            "type": [
              "string",
              "null"
            ]
          },
          "usage": {
            "$ref": "#/components/schemas/MessageUsage"
          }
        }
      },
      "MessageStreamEvent": {
        "type": "object",
        "description": "One Anthropic stream event: message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop, ping, or error. Each data object also carries an obfuscation string of random length.",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string"
          }
        }
      },
      "MessageUsage": {
        "type": "object",
        "description": "Tokens as Anthropic counts them: input_tokens is the prompt read neither from nor into the cache.",
        "required": [
          "input_tokens",
          "output_tokens",
          "cache_creation_input_tokens",
          "cache_read_input_tokens"
        ],
        "properties": {
          "input_tokens": {
            "type": "integer"
          },
          "output_tokens": {
            "type": "integer"
          },
          "cache_creation_input_tokens": {
            "type": "integer"
          },
          "cache_read_input_tokens": {
            "type": "integer"
          }
        }
      },
      "ResponsesRequest": {
        "type": "object",
        "description": "An OpenAI Responses request. Morse reads it as a chat completion and serves it on any chat model, with the same billing, privacy floors, and failover. Parameters Morse does not use are ignored, such as include, prompt_cache_key, service_tier, text.verbosity, user, and client_metadata.",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "A model id from GET /v1/models, named as on POST /v1/chat/completions."
          },
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            ],
            "description": "The whole conversation: a string, which is one user message, or items. A message has role user, assistant, system, or developer, which is sent as system. It takes input_text and input_image (a base64 data URL) parts from the user and text from the others. function_call, function_call_output, custom_tool_call, and custom_tool_call_output items are taken, and reasoning items are dropped. Every other item type is refused."
          },
          "instructions": {
            "type": "string",
            "description": "Sent as the first system message."
          },
          "stream": {
            "type": "boolean"
          },
          "max_output_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "The output limit, sent as max_completion_tokens."
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "function, custom, and namespace tools. Built-in tools are refused."
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "auto",
                  "none",
                  "required"
                ]
              },
              {
                "type": "object"
              }
            ],
            "description": "A mode, or a function or custom tool by name."
          },
          "parallel_tool_calls": {
            "type": "boolean"
          },
          "reasoning": {
            "type": "object",
            "properties": {
              "effort": {
                "type": "string",
                "enum": [
                  "none",
                  "minimal",
                  "low",
                  "medium",
                  "high",
                  "xhigh",
                  "max"
                ],
                "description": "Sent as reasoning_effort."
              },
              "summary": {
                "type": "string",
                "description": "Any value but none asks for the model's reasoning as a reasoning item, where the model streams it."
              }
            }
          },
          "temperature": {
            "type": "number",
            "description": "1 is dropped. Any other value needs forward_settings, as on a chat completion."
          },
          "top_p": {
            "type": "number",
            "description": "1 is dropped. Any other value needs forward_settings, as on a chat completion."
          },
          "text": {
            "type": "object",
            "description": "format asks for JSON: {\"type\":\"json_object\"} or {\"type\":\"json_schema\",\"name\":...,\"schema\":{...}}. It is sent as the chat completion's response_format. So it needs forward_settings and a model with an endpoint that honours the type, and is refused with 400 unsupported_parameter on a model with none. {\"type\":\"text\"} counts as absent. The Response echoes it."
          },
          "store": {
            "type": "boolean",
            "description": "Only false. Absent is false."
          },
          "metadata": {
            "type": "object",
            "description": "Echoed in the Response."
          },
          "provider": {
            "type": "object",
            "description": "The privacy floor and endpoint choice, as on a chat completion."
          }
        }
      },
      "Response": {
        "type": "object",
        "description": "An OpenAI Response: the whole response.",
        "required": [
          "id",
          "object",
          "created_at",
          "status",
          "model",
          "output",
          "usage"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "response"
            ]
          },
          "created_at": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "incomplete",
              "failed",
              "in_progress"
            ]
          },
          "incomplete_details": {
            "type": [
              "object",
              "null"
            ],
            "description": "Why the response is incomplete: max_output_tokens or content_filter."
          },
          "error": {
            "type": [
              "object",
              "null"
            ]
          },
          "model": {
            "type": "string",
            "description": "The model as the request named it."
          },
          "output": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "message",
                    "reasoning",
                    "function_call",
                    "custom_tool_call"
                  ]
                }
              }
            }
          },
          "store": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "usage": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ResponseUsage"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ResponseUsage": {
        "type": "object",
        "description": "Tokens as OpenAI counts them: input_tokens is the whole prompt, cached_tokens the part read from the cache.",
        "required": [
          "input_tokens",
          "input_tokens_details",
          "output_tokens",
          "output_tokens_details",
          "total_tokens"
        ],
        "properties": {
          "input_tokens": {
            "type": "integer"
          },
          "input_tokens_details": {
            "type": "object",
            "properties": {
              "cached_tokens": {
                "type": "integer"
              }
            }
          },
          "output_tokens": {
            "type": "integer"
          },
          "output_tokens_details": {
            "type": "object",
            "properties": {
              "reasoning_tokens": {
                "type": "integer"
              }
            }
          },
          "total_tokens": {
            "type": "integer"
          }
        }
      },
      "ResponseStreamEvent": {
        "type": "object",
        "description": "One Responses stream event, named by its event: line and its type. The types are:\n- response.created and response.in_progress\n- response.output_item.added and .done\n- response.content_part.added and .done\n- response.output_text.delta and .done\n- response.reasoning_summary_part.added and .done\n- response.reasoning_summary_text.delta and .done\n- response.function_call_arguments.delta and .done\n- response.custom_tool_call_input.delta and .done\n- then response.completed, response.incomplete, or response.failed\n\nEach data object also carries an obfuscation string of random length.",
        "required": [
          "type",
          "sequence_number"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "sequence_number": {
            "type": "integer"
          },
          "response": {
            "$ref": "#/components/schemas/Response"
          }
        }
      },
      "MessagesCountTokensRequest": {
        "type": "object",
        "description": "An Anthropic Messages request to count, as POST /v1/messages takes it with max_tokens left out. Morse reads it as POST /v1/messages does and refuses what that route refuses. stream, max_tokens, and the sampling parameters are read and change nothing. Parameters Morse does not use are ignored.",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "A model id from GET /v1/models. Anthropic's own id for a Claude model, such as claude-opus-5-5 or a dated id like claude-opus-5-5-20261001, also names the Morse model anthropic/claude-opus-5.5."
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "The output limit. Morse clamps it to the model's limit, as it clamps max_completion_tokens."
          },
          "messages": {
            "type": "array",
            "description": "The conversation. A user turn takes text, image (base64 source only), and tool_result blocks. A tool_result with is_error true reaches the model with its text prefixed \"Error: \". An assistant turn takes text and tool_use blocks. Morse drops thinking and redacted_thinking blocks. A message with role system is sent as a system message in its place. Morse refuses these with a 400 that names the type: document blocks, images linked by URL, images inside a tool_result, and every other block type.",
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ]
                },
                "content": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  ]
                }
              }
            }
          },
          "system": {
            "description": "The system prompt, a string or text blocks. Blocks are joined with a blank line. cache_control is ignored: Morse places its own cache breakpoints.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            ]
          },
          "stream": {
            "type": "boolean",
            "description": "Stream the response as Anthropic's named server-sent events."
          },
          "tools": {
            "type": "array",
            "description": "Custom tools (name, description, input_schema). Anthropic's server tools, such as web_search or code_execution, are refused with a 400 that names the type.",
            "items": {
              "type": "object"
            }
          },
          "tool_choice": {
            "type": "object",
            "description": "auto, any, tool (with name), or none. disable_parallel_tool_use asks for at most one tool call."
          },
          "thinking": {
            "type": "object",
            "description": "With enabled and budget_tokens, Morse sets a reasoning effort from the budget. With disabled, it asks for no reasoning, which a model that cannot turn it off runs at its lowest effort. With enabled or adaptive, it also streams the model's reasoning as thinking blocks where the model shows it. Thinking blocks carry no signature."
          },
          "output_config": {
            "type": "object",
            "description": "effort sets the reasoning effort (low, medium, high, xhigh, or max). format takes type json_schema with a schema, on a model whose providers honour json_schema. It needs an API key that lets its settings reach the provider."
          },
          "stop_sequences": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Sent as stop. An API key needs forward_settings, as for a chat completion's stop."
          },
          "temperature": {
            "type": "number",
            "description": "1, Anthropic's default, is ignored. Any other value needs forward_settings, as for a chat completion."
          },
          "top_p": {
            "type": "number",
            "description": "1 is ignored. Any other value needs forward_settings, as for a chat completion."
          }
        }
      },
      "MessageTokensCount": {
        "type": "object",
        "description": "Anthropic's token count response.",
        "required": [
          "input_tokens"
        ],
        "properties": {
          "input_tokens": {
            "type": "integer",
            "description": "The request's input tokens: the model's tokenizer count plus Morse's template allowance. Where the model has no published tokenizer, it is an upper bound from the request's size."
          }
        }
      },
      "MessagesRequest": {
        "type": "object",
        "description": "An Anthropic Messages request. Morse reads it as a chat completion and serves it on any chat model, with the same billing, privacy floors, and failover. Parameters Morse does not use, such as metadata and service_tier, are ignored.",
        "required": [
          "model",
          "max_tokens",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "A model id from GET /v1/models. Anthropic's own id for a Claude model, such as claude-opus-5-5 or a dated id like claude-opus-5-5-20261001, also names the Morse model anthropic/claude-opus-5.5."
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "The output limit. Morse clamps it to the model's limit, as it clamps max_completion_tokens."
          },
          "messages": {
            "type": "array",
            "description": "The conversation. A user turn takes text, image (base64 source only), and tool_result blocks. A tool_result with is_error true reaches the model with its text prefixed \"Error: \". An assistant turn takes text and tool_use blocks. A thinking block's text reaches an open model as the turn's earlier reasoning, as reasoning_content does on a chat completion. A redacted_thinking block is dropped. A message with role system is sent as a system message in its place. An image inside a tool_result is served, as Claude Code's Read returns for a picture. The tool message ends with a line saying the image is in the next message. The image leads the user message that follows the turn's tool messages, under a line that names its call. document blocks, images linked by URL, and every other block type are refused with a 400 that names the type.",
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ]
                },
                "content": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  ]
                }
              }
            }
          },
          "system": {
            "description": "The system prompt, a string or text blocks. Blocks are joined with a blank line. cache_control is ignored: Morse places its own cache breakpoints.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            ]
          },
          "stream": {
            "type": "boolean",
            "description": "Stream the response as Anthropic's named server-sent events."
          },
          "tools": {
            "type": "array",
            "description": "Custom tools (name, description, input_schema). Anthropic's server tools, such as web_search or code_execution, are refused with a 400 that names the type.",
            "items": {
              "type": "object"
            }
          },
          "tool_choice": {
            "type": "object",
            "description": "auto, any, tool (with name), or none. disable_parallel_tool_use asks for at most one tool call."
          },
          "thinking": {
            "type": "object",
            "description": "With enabled and budget_tokens, Morse sets a reasoning effort from the budget. With disabled, it asks for no reasoning, which a model that cannot turn it off runs at its lowest effort. With enabled or adaptive, it also streams the model's reasoning as thinking blocks where the model shows it. Thinking blocks carry no signature."
          },
          "output_config": {
            "type": "object",
            "description": "effort sets the reasoning effort (low, medium, high, xhigh, or max). format takes type json_schema with a schema, on a model whose providers honour json_schema. It needs an API key that lets its settings reach the provider."
          },
          "stop_sequences": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Sent as stop. An API key needs forward_settings, as for a chat completion's stop."
          },
          "temperature": {
            "type": "number",
            "description": "1, Anthropic's default, is ignored. Any other value needs forward_settings, as for a chat completion."
          },
          "top_p": {
            "type": "number",
            "description": "1 is ignored. Any other value needs forward_settings, as for a chat completion."
          },
          "provider": {
            "type": "object",
            "description": "Morse's per-request privacy floor, as on POST /v1/chat/completions."
          },
          "privacy_veil": {
            "description": "Morse's Privacy Veil ask, as on POST /v1/chat/completions."
          }
        }
      },
      "Model": {
        "type": "object",
        "required": [
          "id",
          "object",
          "created",
          "owned_by",
          "tier",
          "type",
          "plan"
        ],
        "description": "A model in the aliases shape, which lists one entry per name. The list sorts models by id. included describes what each plan includes in the Morse app. It does not apply to API keys, which always pay with credits.",
        "properties": {
          "id": {
            "type": "string",
            "description": "The name to send as model."
          },
          "object": {
            "const": "model"
          },
          "created": {
            "type": "integer",
            "description": "When Morse first listed the model, in Unix seconds. 0 when Morse has no record of that."
          },
          "owned_by": {
            "type": "string",
            "description": "Who made the model. An API key and GET /v1/catalog see the model's lab here. A Morse app login sees morse here for most open-weight models."
          },
          "tier": {
            "type": "string",
            "enum": [
              "anon",
              "private",
              "tee",
              "e2ee"
            ],
            "description": "The privacy tier:\n- anon reaches the vendor without your identity.\n- private runs on a provider with zero data retention.\n- tee runs on attested hardware.\n- e2ee also encrypts the messages to that hardware. A list read with an API key never shows it."
          },
          "type": {
            "type": "string",
            "enum": [
              "chat",
              "image",
              "video",
              "search",
              "fetch",
              "research",
              "transcription",
              "speech"
            ],
            "description": "The endpoint that serves the model:\n- chat models run on /v1/chat/completions\n- image models on /v1/images/generations\n- search models on /v1/search\n- fetch models on /v1/fetch\n- transcription models on /v1/audio/transcriptions\n- speech models on /v1/audio/speech"
          },
          "label": {
            "type": "string"
          },
          "uncensored": {
            "const": true,
            "description": "True on a model whose provider does not filter what it produces. Absent on every other model."
          },
          "retention": {
            "type": "string",
            "enum": [
              "vendor",
              "zdr"
            ]
          },
          "attester": {
            "type": "string"
          },
          "fallback_attesters": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pick": {
            "const": true,
            "description": "True on a model Morse picks for its app's menu at this entry's tier. Absent on every other entry."
          },
          "input_modalities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Absent when the model reads text only."
          },
          "reasoning_efforts": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["none", "minimal", "low", "medium", "high", "xhigh", "max"]
            },
            "description": "On every chat model: the efforts it takes, lowest first. Empty when it takes none."
          },
          "always_reasons": {
            "const": true,
            "description": "True on a chat model that reasons on every request and takes no effort, whose reasoning_efforts is empty. Absent on every other model."
          },
          "tools": {
            "const": false,
            "description": "False on a chat model served without tools. An API key's request that lets it call a tool is refused with 400 unsupported_parameter naming tools. That is a request with tools, or with a tool_choice that calls one, other than none. Any other request reaches the provider with no tools, tool_choice, or parallel_tool_calls. Absent on every model that takes tools."
          },
          "characters": {
            "const": false,
            "description": "False on a chat model kept out of character chats. A chat that plays a character on it sends X-Character or a character's prompt. It is refused with 400 model_unsupported_for_characters before Morse calls the model or holds any credit. Absent on every model that takes character chats."
          },
          "quantizations": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["int4", "int8", "fp4", "mxfp4", "nvfp4", "fp6", "fp8", "mxfp8", "fp16", "bf16", "fp32", "unknown"]
            },
            "description": "On a chat model: the precisions the providers of the model publish at this entry's tier. Its tier row in the tiers shape lists the same."
          },
          "supported_parameters": {
            "type": "array",
            "items": {"type": "string"},
            "description": "On a chat row: the request parameters at least one of the tier's endpoints takes, in OpenRouter's names:\n- max_tokens\n- temperature, top_p, stop, and seed, where the tier's provider is sent a key's settings\n- tools and tool_choice\n- reasoning and reasoning_effort, on a model that takes an effort\n- response_format for JSON mode, and structured_outputs for a JSON schema\n- the sampling settings frequency_penalty, logit_bias, min_p, presence_penalty, repetition_penalty, and top_k\n\nA parameter the list lacks is refused with 400 unsupported_parameter. The exception is max_tokens' neighbours that Morse drops, which are ignored. Absent on a row that is no chat."
          },
          "context_tokens": {
            "type": "integer"
          },
          "max_output_tokens": {
            "type": "integer"
          },
          "compact_at_tokens": {
            "type": "integer"
          },
          "plan": {
            "type": "string",
            "description": "The lowest plan the Morse app lists the model under."
          },
          "included": {
            "type": "object",
            "description": "What plans include in the Morse app. It does not apply to API keys."
          },
          "price": {
            "type": "object",
            "description": "What you pay, in micro-dollars. 10,000 micros are one credit, which is $0.01. Search, fetch, and transcription models list no price, because each call costs a flat fee. That is 1,000 micros for a search or fetch, and 200 for a transcription.",
            "properties": {
              "prompt_micros_per_mtok": {
                "type": "integer"
              },
              "cached_prompt_micros_per_mtok": {
                "type": "integer",
                "description": "The price of a million prompt tokens that the model's provider reads from its cache, which usage counts in prompt_tokens_details.cached_tokens. Absent when those tokens cost nothing."
              },
              "completion_micros_per_mtok": {
                "type": "integer"
              },
              "min_hold_micros": {
                "type": "integer"
              },
              "micros_per_image": {
                "type": "integer"
              },
              "micros_per_reference": {
                "type": "integer"
              },
              "micros_per_second": {
                "type": "integer"
              }
            }
          },
          "unsealed": {
            "type": "object",
            "description": "Legacy TEE metadata on a model id, in the aliases shape of an API key's list when its min_privacy is tee or lower. It says a request on this id can run at tier tee, at the model's price, and holds what a plain chat holds. It is not a promise that Morse encrypts anything for you.",
            "properties": {
              "tier": {
                "type": "string",
                "enum": [
                  "tee"
                ]
              },
              "min_hold_micros": {
                "type": "integer"
              }
            }
          }
        }
      },
      "ImageRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "additionalProperties": false,
        "description": "Morse refuses any parameter not listed here, such as size, style, or user, with invalid_parameter.",
        "properties": {
          "model": {
            "type": "string",
            "description": "An image model's id from GET /v1/models."
          },
          "prompt": {
            "type": "string",
            "minLength": 1
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4,
            "default": 1
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "1:1",
              "16:9",
              "9:16",
              "4:3",
              "3:4",
              "3:2",
              "2:3"
            ],
            "description": "Defaults to 1:1. With reference images, it defaults to the ratio nearest the first reference image's."
          },
          "resolution": {
            "type": "string",
            "enum": [
              "1k",
              "2k"
            ],
            "default": "1k",
            "description": "Some models take 1k only."
          },
          "quality": {
            "type": "string",
            "description": "Applies only to models with a quality setting. Values include low, medium, and high."
          },
          "response_format": {
            "const": "b64_json",
            "description": "Images always come back inline."
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Reference images, as base64 data URLs of PNG, JPEG, or WebP images. Each model sets its own maximum, and some models take none. Each reference image adds to the price of every image."
          },
          "prompt_check": {
            "type": "boolean",
            "description": "When true, Morse's prompt check reads the prompt's words, never its images, before any model does, on any model and whatever the check's rollout. The Morse app sets it for an outfit typed into Swap outfit. A refused prompt gets 400 content_filter, and a check that cannot run gets 503 prompt_check_unavailable; neither makes or charges anything."
          }
        }
      },
      "ImageResponse": {
        "type": "object",
        "required": [
          "created",
          "data"
        ],
        "properties": {
          "created": {
            "type": "integer",
            "description": "Unix seconds."
          },
          "data": {
            "type": "array",
            "description": "The images. If the provider returned fewer than n, data holds fewer, and you pay only for the images delivered.",
            "items": {
              "type": "object",
              "required": [
                "b64_json",
                "mime_type"
              ],
              "properties": {
                "b64_json": {
                  "type": "string",
                  "description": "The image, base64-encoded, with its metadata stripped. An image that carries a C2PA manifest (Content Credentials) comes back exactly as the model's provider made it, so its signature still verifies."
                },
                "mime_type": {
                  "type": "string",
                  "enum": [
                    "image/png",
                    "image/jpeg",
                    "image/webp"
                  ]
                }
              }
            }
          }
        }
      },
      "SearchRequest": {
        "type": "object",
        "required": [
          "model",
          "queries"
        ],
        "additionalProperties": false,
        "properties": {
          "model": {
            "type": "string",
            "description": "A search model's id, such as parallel-search."
          },
          "queries": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          "objective": {
            "type": "string",
            "maxLength": 500,
            "description": "What you want to learn. The search uses it to choose the excerpts."
          },
          "domains": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 253
            },
            "description": "Sites to keep the results to, each a public domain name such as example.com. Leave it out to search the whole web."
          }
        }
      },
      "SearchResults": {
        "type": "object",
        "required": [
          "object",
          "results"
        ],
        "properties": {
          "object": {
            "const": "search.results"
          },
          "results": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "type": "object",
              "required": [
                "url",
                "title",
                "published",
                "excerpts"
              ],
              "properties": {
                "url": {
                  "type": "string"
                },
                "title": {
                  "type": "string",
                  "description": "Empty when the page has none."
                },
                "published": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "YYYY-MM-DD, or null when unknown."
                },
                "excerpts": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "The excerpts of all results together hold at most 8,000 characters."
                }
              }
            }
          }
        }
      },
      "FetchRequest": {
        "type": "object",
        "required": [
          "model",
          "url"
        ],
        "additionalProperties": false,
        "properties": {
          "model": {
            "type": "string",
            "description": "A fetch model's id, such as parallel-extract."
          },
          "url": {
            "type": "string",
            "maxLength": 2048,
            "description": "An http or https URL on a public server and the default port, 80 or 443, without credentials. The fragment is dropped."
          },
          "objective": {
            "type": "string",
            "maxLength": 500,
            "description": "Optional: what the caller is looking for. The result is then the passages of the page that answer it, at most 6,000 characters, instead of the page from its start. A page with no such passage fails as fetch_failed."
          }
        }
      },
      "FetchResult": {
        "type": "object",
        "required": [
          "object",
          "url",
          "title",
          "published",
          "fetched",
          "content",
          "truncated"
        ],
        "properties": {
          "object": {
            "const": "fetch.result"
          },
          "url": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "published": {
            "type": [
              "string",
              "null"
            ],
            "description": "YYYY-MM-DD, or null when unknown."
          },
          "fetched": {
            "type": [
              "string",
              "null"
            ],
            "description": "The day the copy of the page that was read was fetched, YYYY-MM-DD in UTC, or null when unknown. A copy over a day old is fetched again first. So an older day means the page could not be reached, and an earlier copy answered."
          },
          "content": {
            "type": "string",
            "description": "The page's text, often Markdown, at most 12,000 characters."
          },
          "truncated": {
            "type": "boolean",
            "description": "Whether the content was cut at 12,000 characters."
          }
        }
      },
      "TranscriptionRequest": {
        "type": "object",
        "required": [
          "model",
          "file"
        ],
        "additionalProperties": false,
        "properties": {
          "model": {
            "type": "string",
            "description": "A transcription model's id, such as whisper-large-v3-tee."
          },
          "file": {
            "type": "string",
            "format": "binary",
            "description": "The recording, as a WAV file of 16-bit PCM, mono or stereo, at 8 to 48 kHz. Morse reads it from its bytes, whatever its file name or Content-Type. At most 5 minutes long, and 10 MiB with the other parameters."
          },
          "language": {
            "type": "string",
            "description": "The spoken language as an ISO-639-1 code Whisper transcribes, such as en. Without it, Whisper detects the language."
          },
          "response_format": {
            "const": "json",
            "description": "Only json, the default."
          }
        }
      },
      "Transcription": {
        "type": "object",
        "required": [
          "text",
          "usage"
        ],
        "additionalProperties": false,
        "properties": {
          "text": {
            "type": "string",
            "description": "The transcript, without surrounding whitespace."
          },
          "usage": {
            "type": "object",
            "required": [
              "type",
              "seconds"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "const": "duration"
              },
              "seconds": {
                "type": "integer",
                "description": "The length of the audio, rounded up to a whole second. A flat price per call does not depend on it."
              }
            }
          }
        }
      },
      "Version": {
        "type": "object",
        "required": [
          "version"
        ],
        "additionalProperties": false,
        "properties": {
          "version": {
            "type": "string",
            "description": "The running build, the same value as the X-Morse-Version header."
          },
          "pins": {
            "type": "string",
            "description": "The revision of the attestation data this build checks enclaves against. Absent when the build has none."
          },
          "privacy_veil": {
            "const": "on",
            "description": "on while the Privacy Veil can serve someone, so a client can stop before it asks for the Veil. Absent while the Veil is off for everyone."
          },
          "vendor_pins": {
            "type": "string",
            "enum": [
              "off",
              "log",
              "enforce"
            ],
            "description": "What the answering instance's enclave does with a newer signed set of vendor pins. off fetches none, log verifies and logs it, and enforce takes it. Absent behind a worker that runs no vendor pins loader. Also absent until the relay first reads the mode from its worker."
          }
        }
      }
    }
  }
}
