{
  "openapi": "3.1.0",
  "info": {
    "title": "Punica API",
    "version": "1",
    "description": "Language, speech and media models for Tunisian Arabic, behind one HTTP API. Generated from the reference at https://punica.tn/docs; the same reference as Markdown is at https://punica.tn/docs.md."
  },
  "servers": [
    {
      "url": "https://punica.tn/api/v1"
    }
  ],
  "externalDocs": {
    "description": "API reference",
    "url": "https://punica.tn/docs"
  },
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Models",
      "description": "Language and speech models, Punica Live, plus image and video generation.",
      "externalDocs": {
        "url": "https://punica.tn/docs#models"
      }
    },
    {
      "name": "Chat completions",
      "description": "Chat in Derja with Hannibal, or code with Hannibal XL.",
      "externalDocs": {
        "url": "https://punica.tn/docs#chat-completions"
      }
    },
    {
      "name": "Punica Live",
      "description": "Spoken conversations in Tunisian Derja, on one persistent connection.",
      "externalDocs": {
        "url": "https://punica.tn/docs#punica-live"
      }
    },
    {
      "name": "Transcriptions",
      "description": "Tunisian speech in, Tunisian text out.",
      "externalDocs": {
        "url": "https://punica.tn/docs#audio-transcriptions"
      }
    },
    {
      "name": "Speech",
      "description": "Text in, a voice out. Six Arabic dialects plus English, French, German and Italian, built-in voices at 24 kHz, or one of your own.",
      "externalDocs": {
        "url": "https://punica.tn/docs#audio-speech"
      }
    },
    {
      "name": "Voices",
      "description": "The built-in voices, plus any you clone from recordings you have the right to use.",
      "externalDocs": {
        "url": "https://punica.tn/docs#voices"
      }
    },
    {
      "name": "Images",
      "description": "Generate images from a prompt, or edit your own photos.",
      "externalDocs": {
        "url": "https://punica.tn/docs#images"
      }
    },
    {
      "name": "Videos",
      "description": "Generate videos with sound from text, keyframes or references, and avatars driven by an actual audio take.",
      "externalDocs": {
        "url": "https://punica.tn/docs#videos"
      }
    }
  ],
  "paths": {
    "/models": {
      "get": {
        "operationId": "getModels",
        "summary": "Models",
        "description": "`GET /api/v1/models` returns the same catalogue. Models still in training are listed with `\"status\": \"in_training\"` and decline requests with [503 `model_not_available`](https://punica.tn/docs#errors) until they ship.",
        "tags": [
          "Models"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#models"
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "id": "hannibal",
                      "object": "model",
                      "created": 1751328000,
                      "owned_by": "punica",
                      "capabilities": [
                        "chat"
                      ],
                      "status": "available",
                      "description": "Hannibal, a 27B model for chat, translation and writing in Derja, with image and video understanding and client function tools.",
                      "parameters": "27B"
                    },
                    {
                      "id": "dido",
                      "object": "model",
                      "created": 1754870400,
                      "owned_by": "punica",
                      "capabilities": [
                        "speech"
                      ],
                      "status": "available",
                      "description": "Dido, a 613M model for Derja speech and zero-shot voice cloning.",
                      "parameters": "613M"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/chat/completions": {
      "post": {
        "operationId": "postChatCompletions",
        "summary": "Chat completions",
        "description": "Creates a model response for a conversation. The shapes are OpenAI's, so the `openai` client libraries work unchanged.",
        "tags": [
          "Chat completions"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#chat-completions"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "`hannibal` for conversation, translation and writing in Derja, or `hannibal-xl` for coding."
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "role"
                      ],
                      "properties": {
                        "role": {
                          "type": "string"
                        },
                        "content": {
                          "oneOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "object"
                              }
                            }
                          ]
                        }
                      }
                    },
                    "description": "Objects with `role` (`system`, `user` or `assistant`) and `content`, a string or an array of `{type: \"text\", text}` parts. At least one `user` message is required. The latest user message may add up to four `{type: \"image_url\", image_url: {url: \"data:image/jpeg;base64,...\"}}` parts (PNG, JPEG, WebP or GIF data URLs, 6 MiB each). Limits: **2,048 messages** and **32,000 characters** (413 `request_too_large`). The last **24 turns** are kept as context."
                  },
                  "stream": {
                    "type": "boolean",
                    "description": "Default `false`. When `true`, the response is [server-sent events](https://punica.tn/docs#chat-streaming). Must be a boolean."
                  },
                  "stream_options": {
                    "type": "object",
                    "description": "Only with `stream: true`. `include_usage: true` adds a [usage chunk](https://punica.tn/docs#chat-usage-chunk) before `[DONE]`."
                  },
                  "max_tokens": {
                    "type": "integer",
                    "description": "Cap on the reply length, counted in streamed deltas (roughly one word each). A cut reply ends with `finish_reason: \"length\"`."
                  },
                  "temperature": {
                    "type": "number",
                    "description": "Sampling temperature from 0 to 2. Defaults to the model's own."
                  },
                  "tools": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "type",
                        "function"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "function"
                        },
                        "function": {
                          "type": "object",
                          "required": [
                            "name"
                          ],
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "description": {
                              "type": "string"
                            },
                            "parameters": {
                              "type": "object",
                              "description": "JSON Schema for the arguments."
                            }
                          }
                        }
                      }
                    },
                    "description": "Up to 32 function definitions: `{\"type\": \"function\", \"function\": {\"name\", \"description\", \"parameters\"}}`, with `parameters` as JSON Schema. See [Function tools](https://punica.tn/docs#chat-tools)."
                  },
                  "tool_choice": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object"
                      }
                    ],
                    "description": "`auto` (default), `none`, `required`, or `{\"type\": \"function\", \"function\": {\"name\": …}}` to force one tool."
                  }
                },
                "required": [
                  "model",
                  "messages"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/live/sessions": {
      "post": {
        "operationId": "postLiveSessions",
        "summary": "Punica Live",
        "description": "Create a session on your server using your Punica API key. Send JSON with `model: punica-live` and, for browser clients, `origin` set to your exact application origin. The response contains a WebSocket `url` and a single-use `client_secret.value`, valid for 60 seconds. Give the browser this credential; keep your API key on your server.",
        "tags": [
          "Punica Live"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#punica-live"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "`punica-live`."
                  },
                  "origin": {
                    "type": "string",
                    "description": "For browser clients: the exact origin of your application, such as `https://app.example.com`. The credential then only works from that origin."
                  }
                },
                "required": [
                  "model"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/audio/transcriptions": {
      "post": {
        "operationId": "postAudioTranscriptions",
        "summary": "Transcriptions",
        "description": "Transcribes spoken Derja with Fennec (581M). Send `multipart/form-data`.",
        "tags": [
          "Transcriptions"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#audio-transcriptions"
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The audio, up to **8 MiB**, any container and sample rate. The filename extension (`.mp3`, `.wav`, `.webm`, `.m4a`, `.ogg`) is the container hint; without one it is treated as `.webm`."
                  },
                  "model": {
                    "type": "string",
                    "description": "`fennec`."
                  },
                  "response_format": {
                    "type": "string",
                    "description": "`json` (default) or `verbose_json`. Anything else is a 400."
                  }
                },
                "required": [
                  "file",
                  "model"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "text": "شنوا رايك نعملو طلة على السوق الجديد؟"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/audio/speech": {
      "post": {
        "operationId": "postAudioSpeech",
        "summary": "Speech",
        "description": "Renders text as audio with [Dido](https://punica.tn/playground?mode=tts), our 613M speech model. One model speaks Tunisian, Moroccan, Algerian, Libyan, Egyptian and Saudi; `language` picks which. English, French, German and Italian are spoken by built-in voices made for each language. The response body is the audio bytes.",
        "tags": [
          "Speech"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#audio-speech"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Always `dido`."
                  },
                  "input": {
                    "type": "string",
                    "description": "The text to speak, at most **5,000 characters**. Arabic script, Tunizi and French are accepted."
                  },
                  "voice": {
                    "type": "string",
                    "description": "A built-in voice name, or the id of one of your cloned voices (`vc_…`). The built-in set changes, so read it from [GET /api/v1/voices](https://punica.tn/docs#voices-list). See [Voices](https://punica.tn/docs#voices) to clone one."
                  },
                  "language": {
                    "type": "string",
                    "description": "The dialect or language to speak, as an ISO 639-3 id: `aeb` Tunisian, `ary` Moroccan, `arq` Algerian, `ayl` Libyan, `arz` Egyptian, `ars` Saudi, `eng` English, `fra` French, `deu` German, `ita` Italian. Omitted, Arabic text is read as Tunisian. Write the text in the dialect you name; the id conditions pronunciation and rhythm, it does not translate. A built-in voice that carries its own dialect model ignores it. For `eng`, `fra`, `deu` and `ita`, pick a built-in voice whose `dialect` is that language."
                  },
                  "style": {
                    "type": "string",
                    "description": "A delivery style the engine understands: `natural` (no instruction at all), `whisper` (soft, breathy), `low` (deeper), `high` (brighter), `elderly` (an older voice). Omitted, each voice keeps its tuned delivery."
                  },
                  "speed": {
                    "type": "number",
                    "description": "Speaking rate as a multiplier of the voice's own pace, 0.5 to 2. Omitted, each voice keeps its tuned pace."
                  },
                  "steps": {
                    "type": "integer",
                    "description": "Refinement steps, 8 to 64. More steps sound cleaner and take longer; most voices use 32. Omitted, each voice keeps its own."
                  },
                  "guidance": {
                    "type": "number",
                    "description": "How closely the voice follows its reference, 0.5 to 4. Higher is closer to the voice and more careful; lower is looser. Most voices use 1.5."
                  },
                  "temperature": {
                    "type": "number",
                    "description": "Variation in delivery, 0 to 1. `0` reads the same way every time; higher values sound livelier and differ between renders."
                  },
                  "duration": {
                    "type": "number",
                    "description": "Target length of the audio in seconds, 0.5 to 120. Dido paces the text to fit. Send either `duration` or `speed`, not both."
                  },
                  "response_format": {
                    "type": "string",
                    "description": "`wav` (24 kHz, mono, 16-bit PCM), `mp3` or `opus`. Check the response `Content-Type`."
                  }
                },
                "required": [
                  "model",
                  "input"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "audio/*": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/voices": {
      "get": {
        "operationId": "getVoices",
        "summary": "List voices",
        "description": "The built-in voices and this account's cloned voices. The built-in set changes, so read it rather than hard-coding names.",
        "tags": [
          "Voices"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#voices-list"
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "id": "female",
                      "object": "voice",
                      "name": "Female",
                      "kind": "builtin",
                      "status": "ready",
                      "created": null,
                      "preview_url": null
                    },
                    {
                      "id": "vc_97e9a9dc0da8bd91",
                      "object": "voice",
                      "name": "صوت عليّ",
                      "kind": "cloned",
                      "status": "ready",
                      "created": 1787157437,
                      "preview_url": null
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "postVoices",
        "summary": "Create a voice",
        "description": "Send `multipart/form-data`. The build takes a second or two and the response is the finished voice, `\"status\": \"ready\"`.",
        "tags": [
          "Voices"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#voices-create"
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Up to **60 characters**, Arabic script included."
                  },
                  "sample": {
                    "type": "string",
                    "format": "binary",
                    "description": "**One recording**, under **10 MB**: `wav`, `mp3`, `m4a`, `webm`, `ogg`, `flac`."
                  },
                  "consent": {
                    "type": "string",
                    "description": "`true`, affirming you have the right to clone this voice."
                  }
                },
                "required": [
                  "name",
                  "sample",
                  "consent"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/voices/{voice_id}": {
      "get": {
        "operationId": "getVoicesVoiceId",
        "summary": "Get one voice",
        "description": "One voice, by id. `status` is `ready`, `processing` or `failed`; a failed voice carries an `error`. A voice not on this account answers `404 voice_not_found`.",
        "tags": [
          "Voices"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#voices-get"
        },
        "parameters": [
          {
            "name": "voice_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "delete": {
        "operationId": "deleteVoicesVoiceId",
        "summary": "Delete a voice",
        "description": "Deletes the voice and its reference audio permanently before responding.",
        "tags": [
          "Voices"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#voices-delete"
        },
        "parameters": [
          {
            "name": "voice_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/images/generations": {
      "post": {
        "operationId": "postImagesGenerations",
        "summary": "Images",
        "description": "Images come back as base64. There is no `model` field.",
        "tags": [
          "Images"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#images"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "At most **1000 characters**. For a fresh image, a plain description; it is expanded server-side into the detailed caption the model works from. With `images`, a short instruction naming only the change: `Show only the teapot on a plain white background`."
                  },
                  "aspect_ratio": {
                    "type": "string",
                    "description": "`1:1` (default), `16:9`, `9:16`, `4:3`, `3:4`, `3:2`, `2:3` or `21:9`."
                  },
                  "n": {
                    "type": "integer",
                    "description": "Variants of the same request, `1` to `4`. Default `1`."
                  },
                  "images": {
                    "type": "array",
                    "description": "Up to **4** base64 data URLs (`data:image/png;base64,…`, PNG, JPEG or WebP, 6 MiB each) to edit or take a subject from. Remote URLs are not fetched."
                  },
                  "requests": {
                    "type": "array",
                    "description": "A batch: **1 to 8** objects, each with its own `prompt`, `aspect_ratio` and `images`. Send either `requests` or a single `prompt` (with `n`), not both. A batch is rendered together, so eight product shots cost one wait rather than eight."
                  }
                },
                "required": [
                  "prompt"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "created": 1792627200,
                  "data": [
                    {
                      "b64_json": "iVBORw0KGgoAAAANSUhEUgAA…",
                      "mime_type": "image/png"
                    },
                    {
                      "error": {
                        "message": "The image model could not produce this image. Retry shortly.",
                        "code": "upstream_error"
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/videos": {
      "post": {
        "operationId": "postVideos",
        "summary": "Videos",
        "description": "Answers **202** with a video object. Poll [GET /api/v1/videos/{id}](https://punica.tn/docs#videos-status) until `status` is `completed`, then download the mp4 from [/content](https://punica.tn/docs#videos-content). There is no `model` field.",
        "tags": [
          "Videos"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#videos"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "The scene, at most **2000 characters**. Describe motion and camera as well as subject."
                  },
                  "aspect_ratio": {
                    "type": "string",
                    "description": "`16:9` (default), `9:16` or `1:1`."
                  },
                  "duration_seconds": {
                    "type": "number",
                    "description": "Length of the clip. The allowed range comes from the video model and is checked on every request; today it is **5 to 15 seconds**. A value outside it is a 400 whose message gives the current range. Omit it for the model's default, or to follow the full recording in avatar mode. Native frame rounding can add less than 0.71 seconds; speech is never cut."
                  },
                  "seed": {
                    "type": "integer",
                    "description": "`0` to `2147483647`. The same seed and inputs give a similar clip. Random when omitted, and returned on the video object either way."
                  },
                  "enhance_prompt": {
                    "type": "boolean",
                    "description": "Default `true`: the prompt is rewritten into the detailed shot description the model works best from. `false` sends your words as they are."
                  },
                  "image": {
                    "type": "string",
                    "description": "A base64 data URL (PNG, JPEG or WebP, 6 MiB) to use as the first frame. Turns a photo into a moving shot."
                  },
                  "end_image": {
                    "type": "string",
                    "description": "A data URL for the last frame. Needs `image`."
                  },
                  "mode": {
                    "type": "string",
                    "description": "auto (default), t2v, i2v, fl2v, ref2va or avatar. Inputs must match the mode."
                  },
                  "audio": {
                    "type": "string",
                    "description": "Audio data URL: the actual performance. Activates frozen-audio avatar generation; the complete track is preserved. Pair with image for a talking person. Omit duration_seconds to follow the recording. Up to 12 MiB and the live audio-duration limit."
                  },
                  "references": {
                    "type": "array",
                    "description": "Ordered [{type: image|video|audio, data: base64 data URL}] entries, instead of the singular reference fields. Up to 9 images, 3 videos, 3 audio and 12 total; combined encoded media is limited to 192 MiB. Audio needs a visual reference. Picture/Video/Audio labels count within each type in list order."
                  },
                  "reference_image": {
                    "type": "string",
                    "description": "PNG/JPEG/WebP data URL for subject guidance (up to 6 MiB). Excludes image, end_image and audio."
                  },
                  "reference_video": {
                    "type": "string",
                    "description": "Video data URL for visual/motion guidance, up to 64 MiB, 1080p and 15 seconds. Can accompany reference_image and reference_audio."
                  },
                  "reference_audio": {
                    "type": "string",
                    "description": "Audio data URL for voice/sound conditioning (up to 12 MiB and 15 seconds). Requires reference_image or reference_video. Generates new audio; does not preserve the words or timing. For an exact performance use audio."
                  }
                },
                "required": [
                  "prompt"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "6f1c2b9e4d7a4c0e9b8f3a215d6e7c40",
                  "object": "video",
                  "status": "completed",
                  "created_at": 1792627200,
                  "seed": 184467021,
                  "duration_seconds": 8.04
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/videos/{id}": {
      "get": {
        "operationId": "getVideosId",
        "summary": "Polling a clip",
        "description": "Returns the video object. Every ten seconds is plenty; a clip usually takes a few minutes. A `404 not_found` means no clip with that id belongs to this key's account. Each poll counts toward your [rate limit](https://punica.tn/docs#rate-limits).",
        "tags": [
          "Videos"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#videos-status"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/videos/{id}/content": {
      "get": {
        "operationId": "getVideosIdContent",
        "summary": "Downloading the mp4",
        "description": "The finished clip as `video/mp4`. A completed clip is also saved to your account's media library, so it stays downloadable here after the job itself is gone. Before it completes this answers `404 not_found`.",
        "tags": [
          "Videos"
        ],
        "externalDocs": {
          "url": "https://punica.tn/docs#videos-content"
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "video/mp4": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A Punica API key, sent as `Authorization: Bearer <key>`. See https://punica.tn/docs#authentication."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "message",
              "type"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Any failure. One envelope for every error: https://punica.tn/docs#errors.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "message": "The model 'gpt-4' does not exist. List models at GET /api/v1/models.",
                "type": "invalid_request_error",
                "code": "model_not_found",
                "param": "model"
              }
            }
          }
        }
      }
    }
  }
}