{
  "openapi": "3.1.0",
  "info": {
    "title": "Unbound AI API",
    "version": "0.3.0",
    "summary": "OpenAI-compatible access to the models on Unbound AI.",
    "description": "Requests are authenticated with a bearer key and billed from the same balance as the app. A hold is placed before a request runs, actual usage is charged when it finishes, and the remainder is released. Failed requests are not charged.",
    "contact": {
      "name": "Unbound AI",
      "url": "https://useunbound.ai/contact"
    }
  },
  "servers": [
    {
      "url": "https://api.useunbound.ai/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Models",
      "description": "Discover what your key can call."
    },
    {
      "name": "Chat",
      "description": "Text generation in the OpenAI chat format."
    },
    {
      "name": "Images",
      "description": "Image generation."
    }
  ],
  "paths": {
    "/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List models",
        "description": "Returns the models this key can call. A model appears only when it has a provider route that is authorized for API resale, configured, tested and priced, so this list can be shorter than the one in the app. Prices are per one million tokens, as decimal strings.",
        "tags": [
          "Models"
        ],
        "responses": {
          "200": {
            "description": "The models available to this key.",
            "headers": {
              "x-request-id": {
                "description": "Identifier of this request. It matches the entry in your usage history; quote it when contacting support.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelList"
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "id": "<model-id>",
                      "object": "model",
                      "created": 1795500000,
                      "owned_by": "<developer>",
                      "name": "<display name>",
                      "type": "text",
                      "context_length": 128000,
                      "max_output_tokens": 8192,
                      "input_modalities": [
                        "text"
                      ],
                      "output_modalities": [
                        "text"
                      ],
                      "capabilities": {
                        "tools": true,
                        "streaming": true
                      },
                      "privacy": "anonymized",
                      "pricing": {
                        "currency": "USD",
                        "unit": "per_1m_tokens",
                        "input": "0.50",
                        "output": "1.50",
                        "cached_input": null,
                        "characters": null,
                        "audio_minute": null
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for this key. Retry after the number of seconds in the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl",
            "source": "curl https://api.useunbound.ai/v1/models \\\n  -H \"Authorization: Bearer $UNBOUND_API_KEY\""
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "from openai import OpenAI\n\nclient = OpenAI(base_url=\"https://api.useunbound.ai/v1\", api_key=\"<your Unbound key>\")\n\nfor model in client.models.list():\n    print(model.id)"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "import OpenAI from \"openai\";\n\nconst client = new OpenAI({ baseURL: \"https://api.useunbound.ai/v1\", apiKey: process.env.UNBOUND_API_KEY });\n\nfor await (const model of client.models.list()) {\n  console.log(model.id);\n}"
          }
        ]
      }
    },
    "/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "summary": "Create a chat completion",
        "description": "Generates a model response for a conversation. With `stream: true` the response is a server-sent event stream of `chat.completion.chunk` objects ending in `data: [DONE]`. Before the request is sent upstream, enough credit is held to cover the prompt plus `max_tokens` of output; the real usage is charged when it finishes. Closing the connection early stops generation and you are charged only for what was produced.",
        "tags": [
          "Chat"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              },
              "example": {
                "model": "<model-id>",
                "messages": [
                  {
                    "role": "system",
                    "content": "You are a concise assistant."
                  },
                  {
                    "role": "user",
                    "content": "Give me three names for a sailing boat."
                  }
                ],
                "max_tokens": 200
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A chat completion, or an event stream when `stream` is true.",
            "headers": {
              "x-request-id": {
                "description": "Identifier of this request. It matches the entry in your usage history; quote it when contacting support.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletion"
                },
                "example": {
                  "id": "chatcmpl-9f2c1d0e7a6b4c3d",
                  "object": "chat.completion",
                  "created": 1795500000,
                  "model": "<model-id>",
                  "choices": [
                    {
                      "index": 0,
                      "message": {
                        "role": "assistant",
                        "content": "Windward, Second Tide, Quiet Reach."
                      },
                      "finish_reason": "stop"
                    }
                  ],
                  "usage": {
                    "prompt_tokens": 24,
                    "completion_tokens": 11,
                    "total_tokens": 35,
                    "prompt_tokens_details": {
                      "cached_tokens": 0
                    },
                    "completion_tokens_details": {
                      "reasoning_tokens": 0
                    }
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Lines of `data: <chat.completion.chunk JSON>` terminated by `data: [DONE]`."
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed, or a parameter is not supported by the model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credit, or the key reached its spending limit. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The model does not exist or is not available through the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than 4 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for this key. Retry after the number of seconds in the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider failed. The hold was released; you were not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl",
            "source": "curl https://api.useunbound.ai/v1/chat/completions \\\n  -H \"Authorization: Bearer $UNBOUND_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"<model-id>\",\n    \"messages\": [{ \"role\": \"user\", \"content\": \"Give me three names for a sailing boat.\" }],\n    \"max_tokens\": 200\n  }'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "from openai import OpenAI\n\nclient = OpenAI(base_url=\"https://api.useunbound.ai/v1\", api_key=\"<your Unbound key>\")\n\nstream = client.chat.completions.create(\n    model=\"<model-id>\",\n    messages=[{\"role\": \"user\", \"content\": \"Give me three names for a sailing boat.\"}],\n    max_tokens=200,\n    stream=True,\n)\nfor chunk in stream:\n    if chunk.choices:\n        print(chunk.choices[0].delta.content or \"\", end=\"\")"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "import OpenAI from \"openai\";\n\nconst client = new OpenAI({ baseURL: \"https://api.useunbound.ai/v1\", apiKey: process.env.UNBOUND_API_KEY });\n\nconst stream = await client.chat.completions.create({\n  model: \"<model-id>\",\n  messages: [{ role: \"user\", content: \"Give me three names for a sailing boat.\" }],\n  max_tokens: 200,\n  stream: true,\n});\nfor await (const chunk of stream) {\n  process.stdout.write(chunk.choices[0]?.delta?.content ?? \"\");\n}"
          }
        ]
      }
    },
    "/images/generations": {
      "post": {
        "operationId": "createImage",
        "summary": "Create an image",
        "description": "Generates one or more images from a prompt. The exact price is held before generation; if fewer images are delivered than requested only those are charged, and a failed generation is not charged. A parameter the model does not support is rejected with 400, never silently ignored. The call waits for the result and returns it in the same response.",
        "tags": [
          "Images"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string up to 200 characters. Repeating a request with the same key returns the same images and is charged once.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageGenerationRequest"
              },
              "example": {
                "model": "<image-model-id>",
                "prompt": "A lighthouse at dusk, long exposure",
                "n": 1,
                "aspect_ratio": "16:9",
                "response_format": "url"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The generated images.",
            "headers": {
              "x-request-id": {
                "description": "Identifier of this request. It matches the entry in your usage history; quote it when contacting support.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageList"
                },
                "example": {
                  "created": 1795500000,
                  "data": [
                    {
                      "url": "https://api.useunbound.ai/api/assets/<asset-id>?expires=1795503600&signature=<signature>"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed, or a parameter is not supported by the model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credit, or the key reached its spending limit. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The model does not exist or is not available through the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The generation was cancelled before it finished. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for this key. Retry after the number of seconds in the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider failed. The hold was released; you were not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl",
            "source": "curl https://api.useunbound.ai/v1/images/generations \\\n  -H \"Authorization: Bearer $UNBOUND_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: 7c1f0d3a-lighthouse-1\" \\\n  -d '{\n    \"model\": \"<image-model-id>\",\n    \"prompt\": \"A lighthouse at dusk, long exposure\",\n    \"aspect_ratio\": \"16:9\",\n    \"response_format\": \"url\"\n  }'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import base64\nfrom openai import OpenAI\n\nclient = OpenAI(base_url=\"https://api.useunbound.ai/v1\", api_key=\"<your Unbound key>\")\n\nresult = client.images.generate(\n    model=\"<image-model-id>\",\n    prompt=\"A lighthouse at dusk, long exposure\",\n    size=\"1024x1024\",\n)\nwith open(\"lighthouse.png\", \"wb\") as f:\n    f.write(base64.b64decode(result.data[0].b64_json))"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "import fs from \"node:fs\";\nimport OpenAI from \"openai\";\n\nconst client = new OpenAI({ baseURL: \"https://api.useunbound.ai/v1\", apiKey: process.env.UNBOUND_API_KEY });\n\nconst result = await client.images.generate({\n  model: \"<image-model-id>\",\n  prompt: \"A lighthouse at dusk, long exposure\",\n  size: \"1024x1024\",\n});\nfs.writeFileSync(\"lighthouse.png\", Buffer.from(result.data[0].b64_json, \"base64\"));"
          }
        ]
      }
    },
    "/embeddings": {
      "post": {
        "operationId": "createEmbeddings",
        "summary": "Create embeddings",
        "description": "Turns one or more texts into vectors. Priced by input tokens: the worst case is held before the call and only the tokens the model counted are charged. At most 256 texts and 512 KB in one request.",
        "tags": [
          "Embeddings"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string up to 200 characters. A repeat of a call that is running or has run is refused with 409 instead of being charged twice.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingRequest"
              },
              "example": {
                "model": "<embedding-model-id>",
                "input": [
                  "a lighthouse at dusk",
                  "a sailing boat"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One vector for each text, in the same order.",
            "headers": {
              "x-request-id": {
                "description": "Identifier of this request. It matches the entry in your usage history; quote it when contacting support.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbeddingList"
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "object": "embedding",
                      "index": 0,
                      "embedding": [
                        0.0123,
                        -0.0456,
                        0.0789
                      ]
                    },
                    {
                      "object": "embedding",
                      "index": 1,
                      "embedding": [
                        0.0321,
                        -0.0654,
                        0.0987
                      ]
                    }
                  ],
                  "model": "<embedding-model-id>",
                  "usage": {
                    "prompt_tokens": 9,
                    "total_tokens": 9
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed, or a parameter is not supported by the model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credit, or the key reached its spending limit. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The model does not exist or is not available through the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "This Idempotency-Key was already used.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than 1 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for this key. Retry after the number of seconds in the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider failed. The hold was released; you were not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl",
            "source": "curl https://api.useunbound.ai/v1/embeddings \\\n  -H \"Authorization: Bearer $UNBOUND_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"<embedding-model-id>\",\n    \"input\": [\"a lighthouse at dusk\", \"a sailing boat\"]\n  }'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "from openai import OpenAI\n\nclient = OpenAI(base_url=\"https://api.useunbound.ai/v1\", api_key=\"<your Unbound key>\")\n\nresult = client.embeddings.create(model=\"<embedding-model-id>\", input=[\"a lighthouse at dusk\", \"a sailing boat\"])\nprint(len(result.data[0].embedding))"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "import OpenAI from \"openai\";\n\nconst client = new OpenAI({ baseURL: \"https://api.useunbound.ai/v1\", apiKey: process.env.UNBOUND_API_KEY });\n\nconst result = await client.embeddings.create({ model: \"<embedding-model-id>\", input: [\"a lighthouse at dusk\", \"a sailing boat\"] });\nconsole.log(result.data[0].embedding.length);"
          }
        ]
      }
    },
    "/decisions": {
      "post": {
        "operationId": "createDecision",
        "summary": "Create a decision",
        "description": "Answers typed questions about a state with probabilities instead of text: yes or no (`noul`), one of several options (`choice`), or a place on an ordered scale (`score`). Every question is answered on its own against the same state. Priced by tokens: the most it can cost is held before the call and only what the model counted is charged. At most 64 questions and 256 KB in one request.",
        "tags": [
          "Decisions"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string up to 200 characters. A repeat of a call that is running or has run is refused with 409 instead of being charged twice.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecisionRequest"
              },
              "example": {
                "model": "<decision-model-id>",
                "state": "My payouts have failed for three days. Please help.",
                "questions": {
                  "urgent": {
                    "type": "noul",
                    "instructions": "Does this need attention today?"
                  },
                  "team": {
                    "type": "choice",
                    "instructions": "Who should answer?",
                    "criteria": {
                      "billing": "Payments and refunds",
                      "technical": "Bugs and outages"
                    }
                  },
                  "upset": {
                    "type": "score",
                    "instructions": "How upset is the person?",
                    "criteria": [
                      "Calm",
                      "Frustrated",
                      "Very angry"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One answer for each question, under the same name.",
            "headers": {
              "x-request-id": {
                "description": "Identifier of this request. It matches the entry in your usage history; quote it when contacting support.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Decision"
                },
                "example": {
                  "model": "<decision-model-id>",
                  "answers": {
                    "urgent": {
                      "type": "noul",
                      "noul": 0.95
                    },
                    "team": {
                      "type": "choice",
                      "choice": "billing",
                      "probabilities": {
                        "billing": 0.94,
                        "technical": 0.06
                      },
                      "confidence": 0.91
                    },
                    "upset": {
                      "type": "score",
                      "score": 1.27,
                      "legend": {
                        "0": "Calm",
                        "1": "Frustrated",
                        "2": "Very angry"
                      },
                      "probabilities": {
                        "0": 0,
                        "1": 0.73,
                        "2": 0.27
                      },
                      "confidence": 0.6
                    }
                  },
                  "usage": {
                    "input_tokens": 429,
                    "output_tokens": 73
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed, or a parameter is not supported by the model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credit, or the key reached its spending limit. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The model does not exist or is not available through the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "This Idempotency-Key was already used.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than 1 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for this key. Retry after the number of seconds in the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider failed. The hold was released; you were not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl",
            "source": "curl https://api.useunbound.ai/v1/decisions \\\n  -H \"Authorization: Bearer $UNBOUND_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"<decision-model-id>\",\n    \"state\": \"My payouts have failed for three days. Please help.\",\n    \"questions\": {\n      \"urgent\": { \"type\": \"noul\", \"instructions\": \"Does this need attention today?\" },\n      \"team\": { \"type\": \"choice\", \"instructions\": \"Who should answer?\", \"criteria\": { \"billing\": \"Payments and refunds\", \"technical\": \"Bugs and outages\" } }\n    }\n  }'"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os\nimport httpx\n\nresult = httpx.post(\n    \"https://api.useunbound.ai/v1/decisions\",\n    headers={\"Authorization\": f\"Bearer {os.environ['UNBOUND_API_KEY']}\"},\n    json={\n        \"model\": \"<decision-model-id>\",\n        \"state\": \"My payouts have failed for three days. Please help.\",\n        \"questions\": {\"urgent\": {\"type\": \"noul\", \"instructions\": \"Does this need attention today?\"}},\n    },\n).json()\nprint(result[\"answers\"][\"urgent\"][\"noul\"])"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "const response = await fetch(\"https://api.useunbound.ai/v1/decisions\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.UNBOUND_API_KEY}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    model: \"<decision-model-id>\",\n    state: \"My payouts have failed for three days. Please help.\",\n    questions: { urgent: { type: \"noul\", instructions: \"Does this need attention today?\" } },\n  }),\n});\nconst result = await response.json();\nconsole.log(result.answers.urgent.noul);"
          }
        ]
      }
    },
    "/audio/speech": {
      "post": {
        "operationId": "createSpeech",
        "summary": "Create speech",
        "description": "Says a text aloud and answers with the sound as MP3. Priced by the characters of the text, or by the seconds it makes for a model with a price per minute of sound: the price, or the most it can be, is held before it is made and charged only if it is delivered. The sound is also kept in your Library. A parameter that cannot be honoured is rejected with 400.",
        "tags": [
          "Audio"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string up to 180 characters. Repeating a request with the same key returns the same sound and is charged once.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpeechRequest"
              },
              "example": {
                "model": "<speech-model-id>",
                "input": "The kettle clicked off and the kitchen went quiet again.",
                "voice": "<voice>"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The sound.",
            "headers": {
              "x-request-id": {
                "description": "Identifier of this request. It matches the entry in your usage history; quote it when contacting support.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "description": "The bytes of the MP3 file."
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed, or a parameter is not supported by the model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credit, or the key reached its spending limit. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The model does not exist or is not available through the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The request was cancelled before it finished. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than 1 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for this key. Retry after the number of seconds in the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider failed. The hold was released; you were not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl",
            "source": "curl https://api.useunbound.ai/v1/audio/speech \\\n  -H \"Authorization: Bearer $UNBOUND_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"<speech-model-id>\",\n    \"input\": \"The kettle clicked off and the kitchen went quiet again.\",\n    \"voice\": \"<voice>\"\n  }' \\\n  --output speech.mp3"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "from openai import OpenAI\n\nclient = OpenAI(base_url=\"https://api.useunbound.ai/v1\", api_key=\"<your Unbound key>\")\n\nwith client.audio.speech.with_streaming_response.create(\n    model=\"<speech-model-id>\",\n    voice=\"<voice>\",\n    input=\"The kettle clicked off and the kitchen went quiet again.\",\n) as response:\n    response.stream_to_file(\"speech.mp3\")"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "import fs from \"node:fs\";\nimport OpenAI from \"openai\";\n\nconst client = new OpenAI({ baseURL: \"https://api.useunbound.ai/v1\", apiKey: process.env.UNBOUND_API_KEY });\n\nconst speech = await client.audio.speech.create({\n  model: \"<speech-model-id>\",\n  voice: \"<voice>\",\n  input: \"The kettle clicked off and the kitchen went quiet again.\",\n});\nfs.writeFileSync(\"speech.mp3\", Buffer.from(await speech.arrayBuffer()));"
          }
        ]
      }
    },
    "/audio/transcriptions": {
      "post": {
        "operationId": "createTranscription",
        "summary": "Transcribe a recording",
        "description": "Turns a recording into text. Priced by its length, measured from the file itself. Neither the recording nor its text is kept. MP3, WAV, M4A, OGG or FLAC, at most 24 MB and three hours.",
        "tags": [
          "Audio"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string up to 200 characters. A repeat of a call that is running or has run is refused with 409 instead of being charged twice.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/TranscriptionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The text, as JSON or as plain text.",
            "headers": {
              "x-request-id": {
                "description": "Identifier of this request. It matches the entry in your usage history; quote it when contacting support.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transcription"
                },
                "example": {
                  "text": "The kettle clicked off and the kitchen went quiet again."
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string",
                  "description": "The text alone, when `response_format` is `text`."
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed, or a parameter is not supported by the model.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credit, or the key reached its spending limit. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key does not have the scope this endpoint needs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "The model does not exist or is not available through the API.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "This Idempotency-Key was already used.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The recording is larger than 24 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for this key. Retry after the number of seconds in the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The upstream provider failed. The hold was released; you were not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl",
            "source": "curl https://api.useunbound.ai/v1/audio/transcriptions \\\n  -H \"Authorization: Bearer $UNBOUND_API_KEY\" \\\n  -F model=\"<transcription-model-id>\" \\\n  -F file=@recording.mp3"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "from openai import OpenAI\n\nclient = OpenAI(base_url=\"https://api.useunbound.ai/v1\", api_key=\"<your Unbound key>\")\n\nwith open(\"recording.mp3\", \"rb\") as f:\n    result = client.audio.transcriptions.create(model=\"<transcription-model-id>\", file=f)\nprint(result.text)"
          },
          {
            "lang": "javascript",
            "label": "JavaScript",
            "source": "import fs from \"node:fs\";\nimport OpenAI from \"openai\";\n\nconst client = new OpenAI({ baseURL: \"https://api.useunbound.ai/v1\", apiKey: process.env.UNBOUND_API_KEY });\n\nconst result = await client.audio.transcriptions.create({\n  model: \"<transcription-model-id>\",\n  file: fs.createReadStream(\"recording.mp3\"),\n});\nconsole.log(result.text);"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An Unbound API key, sent as `Authorization: Bearer <key>`. Create keys in Settings → API."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "The OpenAI error envelope.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "message",
              "type",
              "code"
            ],
            "properties": {
              "message": {
                "type": "string",
                "description": "What went wrong, in plain language."
              },
              "type": {
                "type": "string",
                "description": "The error family.",
                "enum": [
                  "invalid_request_error",
                  "authentication_error",
                  "insufficient_quota",
                  "permission_error",
                  "model_not_found",
                  "rate_limit_error",
                  "server_error"
                ]
              },
              "code": {
                "type": "string",
                "description": "A more specific machine-readable code, for example `invalid_api_key` or `insufficient_credits`."
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Always null today."
              }
            }
          }
        }
      },
      "Model": {
        "type": "object",
        "required": [
          "id",
          "object",
          "created",
          "owned_by"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The id to send as `model`."
          },
          "object": {
            "type": "string",
            "enum": [
              "model"
            ]
          },
          "created": {
            "type": "integer",
            "description": "Unix time the model was added."
          },
          "owned_by": {
            "type": "string",
            "description": "The lab that develops the model."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "type": {
            "type": "string",
            "description": "Model category.",
            "enum": [
              "text",
              "image",
              "video",
              "tts",
              "stt",
              "music",
              "sfx",
              "embedding",
              "decision"
            ]
          },
          "context_length": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Context window in tokens, when verified."
          },
          "max_output_tokens": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Largest output the model can produce, when verified."
          },
          "input_modalities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "output_modalities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "capabilities": {
            "type": "object",
            "description": "Verified capabilities, for example tools, vision or reasoning.",
            "additionalProperties": true
          },
          "privacy": {
            "type": "string",
            "description": "The privacy level its route can substantiate.",
            "enum": [
              "anonymized",
              "private",
              "e2ee"
            ]
          },
          "simulated": {
            "type": "boolean",
            "description": "Present and true only for development models that call no real provider."
          },
          "pricing": {
            "type": "object",
            "description": "Prices in USD as decimal strings. Null when the model is not priced by that meter.",
            "properties": {
              "currency": {
                "type": "string",
                "enum": [
                  "USD"
                ]
              },
              "unit": {
                "type": "string",
                "enum": [
                  "per_1m_tokens"
                ]
              },
              "input": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Per one million tokens."
              },
              "output": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Per one million tokens."
              },
              "cached_input": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Per one million tokens."
              },
              "characters": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Per one million characters said."
              },
              "audio_minute": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Per minute of sound."
              }
            }
          }
        }
      },
      "ModelList": {
        "type": "object",
        "required": [
          "object",
          "data"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model"
            }
          }
        }
      },
      "ChatMessage": {
        "type": "object",
        "required": [
          "role"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "developer",
              "user",
              "assistant",
              "tool"
            ],
            "description": "`developer` is treated as `system`."
          },
          "content": {
            "description": "Text, or an array of content parts.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string"
          },
          "tool_calls": {
            "type": "array",
            "description": "Tool calls made by the assistant in an earlier turn.",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_call_id": {
            "type": "string",
            "description": "For `tool` messages: the call this message answers."
          }
        }
      },
      "ChatCompletionRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "An id from `GET /v1/models`."
          },
          "messages": {
            "type": "array",
            "description": "The conversation so far. Must not be empty.",
            "items": {
              "$ref": "#/components/schemas/ChatMessage"
            }
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "Send the response as server-sent events."
          },
          "stream_options": {
            "type": "object",
            "description": "Streaming options.",
            "properties": {
              "include_usage": {
                "type": "boolean",
                "description": "Add a final chunk carrying token usage."
              }
            }
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "Caps the output and the amount of credit held. Also accepted as `max_completion_tokens`."
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2,
            "description": "Sampling temperature."
          },
          "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Nucleus sampling."
          },
          "stop": {
            "description": "One or more sequences where generation stops. Forwarded when the model supports it.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "seed": {
            "type": "integer",
            "description": "Forwarded when the model supports it."
          },
          "tools": {
            "type": "array",
            "description": "Function definitions, for models that support tools.",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "tool_choice": {
            "description": "How the model may use tools.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "additionalProperties": true
              }
            ]
          },
          "response_format": {
            "type": "object",
            "description": "JSON mode or a JSON schema, for models that support it.",
            "additionalProperties": true
          },
          "reasoning_effort": {
            "type": "string",
            "enum": [
              "minimal",
              "low",
              "medium",
              "high"
            ],
            "description": "For reasoning models."
          }
        }
      },
      "Usage": {
        "type": "object",
        "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"
              }
            }
          }
        }
      },
      "ChatCompletion": {
        "type": "object",
        "required": [
          "id",
          "object",
          "created",
          "model",
          "choices",
          "usage"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string",
            "enum": [
              "chat.completion"
            ]
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "enum": [
                        "assistant"
                      ]
                    },
                    "content": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reasoning_content": {
                      "type": "string",
                      "description": "Present when the model returned reasoning text."
                    },
                    "tool_calls": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                },
                "finish_reason": {
                  "type": "string",
                  "description": "Why generation ended, for example `stop`, `length` or `tool_calls`."
                }
              }
            }
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          }
        }
      },
      "ImageGenerationRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "An image model id from `GET /v1/models`."
          },
          "prompt": {
            "type": "string",
            "description": "What to generate."
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "description": "Number of images, up to the model limit."
          },
          "size": {
            "type": "string",
            "description": "OpenAI-style size such as `1024x1024`. Mapped to the nearest aspect ratio and resolution."
          },
          "aspect_ratio": {
            "type": "string",
            "description": "Unbound field, for example `16:9`. Takes precedence over `size`."
          },
          "resolution": {
            "type": "string",
            "description": "Unbound field, for example `2k`. Takes precedence over `size`."
          },
          "quality": {
            "type": "string",
            "description": "Only for models that declare quality levels."
          },
          "seed": {
            "type": "integer",
            "description": "Only for models that support a seed."
          },
          "negative_prompt": {
            "type": "string",
            "description": "Only for models that support it."
          },
          "response_format": {
            "type": "string",
            "enum": [
              "b64_json",
              "url"
            ],
            "default": "b64_json",
            "description": "Base64 in the response, or signed links that expire after one hour."
          }
        }
      },
      "ImageList": {
        "type": "object",
        "required": [
          "created",
          "data"
        ],
        "properties": {
          "created": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "b64_json": {
                  "type": "string",
                  "description": "Base64 image data, when `response_format` is `b64_json`."
                },
                "mime_type": {
                  "type": "string",
                  "description": "Sent with `b64_json`."
                },
                "url": {
                  "type": "string",
                  "description": "A signed link, when `response_format` is `url`."
                }
              }
            }
          }
        }
      },
      "EmbeddingRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "An id from `GET /v1/models` with `\"type\": \"embedding\"`."
          },
          "input": {
            "description": "A text, or a list of texts.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "dimensions": {
            "type": "integer",
            "minimum": 1,
            "description": "Length of each vector, for models that can shorten it."
          },
          "encoding_format": {
            "type": "string",
            "enum": [
              "float",
              "base64"
            ],
            "default": "float",
            "description": "Numbers, or little-endian 32-bit floats in base64."
          }
        }
      },
      "EmbeddingList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "model",
          "usage"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "object": {
                  "type": "string",
                  "enum": [
                    "embedding"
                  ]
                },
                "index": {
                  "type": "integer",
                  "description": "Position of the text in `input`."
                },
                "embedding": {
                  "description": "The vector.",
                  "oneOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "number"
                      }
                    },
                    {
                      "type": "string"
                    }
                  ]
                }
              }
            }
          },
          "model": {
            "type": "string"
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            }
          }
        }
      },
      "SpeechRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "An id from `GET /v1/models` with `\"type\": \"tts\"`."
          },
          "input": {
            "type": "string",
            "description": "The text to say, up to the limit of the model."
          },
          "voice": {
            "type": "string",
            "description": "A voice of the model. Without it, its first one."
          },
          "response_format": {
            "type": "string",
            "enum": [
              "mp3"
            ],
            "default": "mp3",
            "description": "Only MP3 today."
          }
        }
      },
      "TranscriptionRequest": {
        "type": "object",
        "required": [
          "model",
          "file"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "An id from `GET /v1/models` with `\"type\": \"stt\"`."
          },
          "file": {
            "type": "string",
            "description": "The recording: MP3, WAV, M4A, OGG or FLAC, at most 24 MB."
          },
          "language": {
            "type": "string",
            "description": "Its language as a code such as `en` or `es`. Without it, the model decides."
          },
          "response_format": {
            "type": "string",
            "enum": [
              "json",
              "text"
            ],
            "default": "json",
            "description": "JSON, or the text alone."
          }
        }
      },
      "DecisionQuestion": {
        "type": "object",
        "required": [
          "type",
          "instructions"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "noul",
              "choice",
              "score"
            ],
            "description": "`noul`: yes or no, as a probability. `choice`: one of several options. `score`: a place on an ordered scale."
          },
          "instructions": {
            "description": "What to judge about the state.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "array",
                "items": {}
              }
            ]
          },
          "criteria": {
            "description": "`choice`: an object with each option and what it means, or null. `score`: the levels as a list of texts, the lowest first. `noul`: optional, what `true` and `false` mean.",
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          }
        }
      },
      "DecisionRequest": {
        "type": "object",
        "required": [
          "model",
          "state",
          "questions"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "The id of a decision model from `GET /v1/models`."
          },
          "state": {
            "description": "What the questions are about: a text, an object or a list.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "array",
                "items": {}
              }
            ]
          },
          "questions": {
            "type": "object",
            "description": "Each question under a name you choose, which the model never sees. From 1 to 64.",
            "additionalProperties": {
              "$ref": "#/components/schemas/DecisionQuestion"
            }
          }
        }
      },
      "DecisionAnswer": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "noul",
              "choice",
              "score"
            ]
          },
          "noul": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "`noul`: the probability of yes."
          },
          "choice": {
            "type": "string",
            "description": "`choice`: the option chosen."
          },
          "score": {
            "type": "number",
            "description": "`score`: the place on the scale, weighed by probability, so it can fall between two levels. The first level is 0."
          },
          "legend": {
            "type": "object",
            "description": "`score`: the levels by their number.",
            "additionalProperties": {
              "type": "string"
            }
          },
          "probabilities": {
            "type": "object",
            "description": "`choice` and `score`: the probability of each option or level, when the model gives it.",
            "additionalProperties": {
              "type": "number"
            }
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "`choice` and `score`: how sure the model is, when it says."
          }
        }
      },
      "Decision": {
        "type": "object",
        "required": [
          "model",
          "answers",
          "usage"
        ],
        "properties": {
          "model": {
            "type": "string"
          },
          "answers": {
            "type": "object",
            "description": "One answer for each question, under the same name and of the same type.",
            "additionalProperties": {
              "$ref": "#/components/schemas/DecisionAnswer"
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "input_tokens": {
                "type": "integer"
              },
              "output_tokens": {
                "type": "integer"
              }
            }
          }
        }
      },
      "Transcription": {
        "type": "object",
        "required": [
          "text"
        ],
        "properties": {
          "text": {
            "type": "string",
            "description": "What was said."
          }
        }
      }
    }
  }
}