{
 "openapi": "3.1.0",
 "info": {
  "title": "XAB AI API",
  "version": "1.0 beta",
  "description": "XAB AI is an **OpenAI-compatible** AI API, prepaid in Tunisian dinars. If your code works with OpenAI, it works with XAB AI: change the address, the key and the model name. **Beta service**: models, prices and limits may still change, we tell clients before any change.\n\n## Start in one minute\n1. Buy a pack (50 TND minimum, by bank transfer or bank deposit). We open your account in the client area.\n2. In **Client area, IA**, create a key. It starts with `xab-` and is shown once.\n3. Call the API:\n\n```bash\ncurl https://cloud.xab.tn/v1/chat/completions \\\n  -H \"Authorization: Bearer $XAB_AI_KEY\" -H \"Content-Type: application/json\" \\\n  -d '{\"model\": \"qwen/qwen3-30b-a3b-instruct-2507\", \"messages\": [{\"role\": \"user\", \"content\": \"Hello\"}]}'\n```\n\nWith the OpenAI library: `OpenAI(base_url=\"https://cloud.xab.tn/v1\", api_key=...)`. The **Test Request** button on each route lets you try with your key.\n\n## Keys and security\nSend the key in `Authorization: Bearer xab-...`, always from your server, never in a mobile app or website code. Up to 10 keys per account. Each key can have a **monthly budget**, **allowed models**, **allowed IPs** and an **expiry date**. A revoked key stops working at once.\n\n## Credit and prices\nPrice of a request = input tokens × input price + output tokens × output price of the model (VAT included, per million tokens), rounded up to the millime. Before each request we hold the maximum cost (from `max_tokens`) and bill only the real cost. At zero, requests are refused (402): never a surprise bill. Credit is valid 12 months after the last purchase. Price of every model: `GET /pricing` or the [XAB AI](https://xab.tn/en/api-ia/) page.\n\n## Cache at half price\nWhen requests start with the same text (instructions, catalog, document, history), tokens read back from the cache are billed **at half price** (tokens written to the cache, when the model asks for it, 25% more once). Automatic on GPT, DeepSeek and Gemini: put the fixed part first. On Claude and some Qwen models, add `\"cache_control\": {\"type\": \"ephemeral\"}` on the block to keep. Send the same `session_id` for every request of a conversation. Cached tokens are in `usage.prompt_tokens_details.cached_tokens`.\n\n## Agents and tools\nDescribe your functions in `tools`: the model answers with `tool_calls`, your code runs the function and sends the result back in a `role: \"tool\"` message. `response_format` with `json_schema` forces JSON in an exact format. `reasoning: {\"effort\": \"low\" | \"medium\" | \"high\"}` sets the thinking of reasoning models (counted as output: allow enough `max_tokens`). Images: `image_url` parts (https link or base64) on models that read images.\n\n## Fallback models\n`\"models\": [...]` with up to 3 models from our catalog: if the first is down, the next one answers. You pay for the model that answered.\n\n## From Ollama\nReplace the Ollama address with `https://cloud.xab.tn/v1` and add the key. Common Ollama names are accepted: `qwen2.5:7b`, `qwen3:30b`, `qwen3:32b`, `llama3.1:8b`, `llama3.3:70b`, `gemma3:27b`, `gpt-oss:20b`, `gpt-oss:120b`, `mistral-small`.\n\n## Integrations\nAny tool that accepts OpenAI with a custom address: **n8n** (OpenAI credentials, Base URL), **Flowise** (ChatOpenAI, Base Path), **LangChain** (`ChatOpenAI(base_url=...)`), **LlamaIndex** (`OpenAILike(api_base=...)`), **Vercel AI SDK** (`createOpenAI({ baseURL })`), **Open WebUI** (OpenAI API connection), **Continue** (`provider: openai`, `apiBase`). Import this OpenAPI file into Postman or Insomnia: [openapi.json](https://xab.tn/api-ia/openapi.en.json).\n\n## Limits\n60 requests per minute per key, 4 in parallel per account, 16,384 answer tokens, 8 MB per request. Need more: write to us.\n\n## Privacy\nWe keep neither your requests nor the answers: only date, model, tokens, price and duration. Illegal content, spam and fraud are forbidden: a key used that way is suspended.\n\n## Support\nWhatsApp +216 54 166 821, contact@xab.tn.\n\n\n## Models and prices\nPrices including VAT, per million tokens.\n\n| Model | Id | Input TND | Output TND |\n|---|---|---|---|\n| Qwen3.7 Flash | `qwen/qwen3.7-flash` | 0.500 | 1.700 |\n| Qwen 2.5 7B | `qwen/qwen-2.5-7b-instruct` | 1.300 | 2.600 |\n| GPT-OSS 20B | `openai/gpt-oss-20b` | 0.500 | 1.700 |\n| Mistral Small 3.2 | `mistralai/mistral-small-3.2-24b-instruct` | 1.000 | 2.600 |\n| Llama 3.1 8B | `meta-llama/llama-3.1-8b-instruct` | 0.700 | 1.100 |\n| Qwen3 30B A3B | `qwen/qwen3-30b-a3b-instruct-2507` | 1.200 | 3.400 |\n| DeepSeek V4 Flash | `deepseek/deepseek-v4-flash` | 1.100 | 2.100 |\n| Gemini 2.5 Flash Lite | `google/gemini-2.5-flash-lite` | 1.200 | 4.500 |\n| Gemma 3 27B | `google/gemma-3-27b-it` | 0.900 | 4.000 |\n| Qwen3 32B | `qwen/qwen3-32b` | 0.900 | 3.200 |\n| GPT-OSS 120B | `openai/gpt-oss-120b` | 1.500 | 5.800 |\n| Llama 3.3 70B | `meta-llama/llama-3.3-70b-instruct` | 2.000 | 5.000 |\n| Qwen3 235B | `qwen/qwen3-235b-a22b-2507` | 0.900 | 5.300 |\n| DeepSeek V3.2 | `deepseek/deepseek-v3.2` | 2.500 | 3.700 |\n| Claude Haiku 5.5 | `anthropic/claude-haiku-5.5` | 0.800 | 4.000 |\n| GPT-5 mini | `openai/gpt-5-mini` | 2.000 | 16.000 |\n| Gemini 2.5 Flash | `google/gemini-2.5-flash` | 2.400 | 20.000 |\n| GPT-6 Luna | `openai/gpt-6-luna` | 0.800 | 4.000 |\n| GPT-5.4 mini | `openai/gpt-5.4-mini` | 6.100 | 36.000 |\n| Claude Sonnet 5.5 | `anthropic/claude-sonnet-5.5` | 16.000 | 80.000 |\n| Gemini 3.1 Pro | `google/gemini-3.1-pro-preview` | 16.000 | 97.000 |\n| Qwen3 Embedding 8B | `qwen/qwen3-embedding-8b` | 0.200 | · |\n| BGE-M3 | `baai/bge-m3` | 0.200 | · |\n| OpenAI Embedding 3 Small | `openai/text-embedding-3-small` | 0.300 | · |\n| OpenAI Embedding 3 Large | `openai/text-embedding-3-large` | 1.500 | · |\n| Mistral Embed | `mistralai/mistral-embed-2312` | 1.200 | · |\n",
  "contact": {
   "name": "XAB Solutions",
   "email": "contact@xab.tn",
   "url": "https://xab.tn/"
  }
 },
 "servers": [
  {
   "url": "https://cloud.xab.tn/v1"
  }
 ],
 "security": [
  {
   "bearer": []
  }
 ],
 "tags": [
  {
   "name": "Generation",
   "description": "Text generation, tools, JSON and images."
  },
  {
   "name": "Embeddings",
   "description": "Search by meaning."
  },
  {
   "name": "Account",
   "description": "Models, balance and usage."
  }
 ],
 "paths": {
  "/chat/completions": {
   "post": {
    "summary": "Chat",
    "description": "A model answer to a conversation. Same format as OpenAI: tools, JSON, images, streaming.",
    "tags": [
     "Generation"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "id": {
           "type": "string"
          },
          "object": {
           "type": "string",
           "example": "chat.completion"
          },
          "created": {
           "type": "integer"
          },
          "model": {
           "type": "string"
          },
          "choices": {
           "type": "array",
           "items": {
            "type": "object",
            "properties": {
             "index": {
              "type": "integer"
             },
             "finish_reason": {
              "type": "string"
             },
             "message": {
              "type": "object",
              "properties": {
               "role": {
                "type": "string"
               },
               "content": {
                "type": "string"
               },
               "tool_calls": {
                "type": "array",
                "items": {
                 "type": "object"
                }
               }
              }
             }
            }
           }
          },
          "usage": {
           "$ref": "#/components/schemas/Usage"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "402": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "502": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "model",
         "messages"
        ],
        "properties": {
         "model": {
          "type": "string",
          "description": "A model id from the catalog (or a common Ollama name).",
          "enum": [
           "qwen/qwen3.7-flash",
           "qwen/qwen-2.5-7b-instruct",
           "openai/gpt-oss-20b",
           "mistralai/mistral-small-3.2-24b-instruct",
           "meta-llama/llama-3.1-8b-instruct",
           "qwen/qwen3-30b-a3b-instruct-2507",
           "deepseek/deepseek-v4-flash",
           "google/gemini-2.5-flash-lite",
           "google/gemma-3-27b-it",
           "qwen/qwen3-32b",
           "openai/gpt-oss-120b",
           "meta-llama/llama-3.3-70b-instruct",
           "qwen/qwen3-235b-a22b-2507",
           "deepseek/deepseek-v3.2",
           "anthropic/claude-haiku-5.5",
           "openai/gpt-5-mini",
           "google/gemini-2.5-flash",
           "openai/gpt-6-luna",
           "openai/gpt-5.4-mini",
           "anthropic/claude-sonnet-5.5",
           "google/gemini-3.1-pro-preview"
          ],
          "example": "qwen/qwen3-30b-a3b-instruct-2507"
         },
         "messages": {
          "type": "array",
          "items": {
           "$ref": "#/components/schemas/Message"
          },
          "description": "Conversation: system, user, assistant, tool roles."
         },
         "max_tokens": {
          "type": "integer",
          "minimum": 1,
          "maximum": 16384,
          "description": "Maximum answer tokens (16,384 at most). Also used to hold credit."
         },
         "temperature": {
          "type": "number",
          "minimum": 0,
          "maximum": 2
         },
         "top_p": {
          "type": "number"
         },
         "stop": {
          "oneOf": [
           {
            "type": "string"
           },
           {
            "type": "array",
            "items": {
             "type": "string"
            }
           }
          ]
         },
         "seed": {
          "type": "integer"
         },
         "stream": {
          "type": "boolean",
          "description": "Stream the answer (Server-Sent Events). The last chunk carries usage."
         },
         "tools": {
          "type": "array",
          "items": {
           "type": "object"
          }
         },
         "tool_choice": {
          "oneOf": [
           {
            "type": "string"
           },
           {
            "type": "object"
           }
          ]
         },
         "response_format": {
          "type": "object",
          "description": "json_object, json_schema"
         },
         "reasoning": {
          "type": "object",
          "properties": {
           "effort": {
            "type": "string",
            "enum": [
             "low",
             "medium",
             "high"
            ]
           }
          }
         },
         "models": {
          "type": "array",
          "maxItems": 3,
          "items": {
           "type": "string"
          },
          "description": "Up to 3 fallback models from our catalog."
         },
         "session_id": {
          "type": "string",
          "description": "Same value for a whole conversation: keeps the cache."
         }
        }
       },
       "example": {
        "model": "qwen/qwen3-30b-a3b-instruct-2507",
        "messages": [
         {
          "role": "user",
          "content": "Give three name ideas for a pastry shop in Sousse."
         }
        ],
        "max_tokens": 300
       }
      }
     }
    }
   }
  },
  "/responses": {
   "post": {
    "summary": "Responses API",
    "description": "OpenAI's newer format used by agent SDKs. Same billing as chat.",
    "tags": [
     "Generation"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "402": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "502": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "model",
         "input"
        ],
        "properties": {
         "model": {
          "type": "string",
          "enum": [
           "qwen/qwen3.7-flash",
           "qwen/qwen-2.5-7b-instruct",
           "openai/gpt-oss-20b",
           "mistralai/mistral-small-3.2-24b-instruct",
           "meta-llama/llama-3.1-8b-instruct",
           "qwen/qwen3-30b-a3b-instruct-2507",
           "deepseek/deepseek-v4-flash",
           "google/gemini-2.5-flash-lite",
           "google/gemma-3-27b-it",
           "qwen/qwen3-32b",
           "openai/gpt-oss-120b",
           "meta-llama/llama-3.3-70b-instruct",
           "qwen/qwen3-235b-a22b-2507",
           "deepseek/deepseek-v3.2",
           "anthropic/claude-haiku-5.5",
           "openai/gpt-5-mini",
           "google/gemini-2.5-flash",
           "openai/gpt-6-luna",
           "openai/gpt-5.4-mini",
           "anthropic/claude-sonnet-5.5",
           "google/gemini-3.1-pro-preview"
          ]
         },
         "input": {
          "oneOf": [
           {
            "type": "string"
           },
           {
            "type": "array",
            "items": {
             "type": "object"
            }
           }
          ]
         },
         "instructions": {
          "type": "string"
         },
         "max_output_tokens": {
          "type": "integer"
         },
         "tools": {
          "type": "array",
          "items": {
           "type": "object"
          }
         },
         "stream": {
          "type": "boolean"
         }
        }
       },
       "example": {
        "model": "qwen/qwen3-30b-a3b-instruct-2507",
        "input": "Give three name ideas for a pastry shop in Sousse."
       }
      }
     }
    }
   }
  },
  "/embeddings": {
   "post": {
    "summary": "Embeddings",
    "description": "Vectors to search your documents (RAG). Only input tokens are billed.",
    "tags": [
     "Embeddings"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "402": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "502": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "model",
         "input"
        ],
        "properties": {
         "model": {
          "type": "string",
          "enum": [
           "qwen/qwen3-embedding-8b",
           "baai/bge-m3",
           "openai/text-embedding-3-small",
           "openai/text-embedding-3-large",
           "mistralai/mistral-embed-2312"
          ],
          "example": "baai/bge-m3"
         },
         "input": {
          "oneOf": [
           {
            "type": "string"
           },
           {
            "type": "array",
            "items": {
             "type": "string"
            }
           }
          ]
         }
        }
       },
       "example": {
        "model": "baai/bge-m3",
        "input": [
         "Livraison à Sfax",
         "Délai de remboursement"
        ]
       }
      }
     }
    }
   }
  },
  "/models": {
   "get": {
    "summary": "Models",
    "description": "Models available to your key, with their price.",
    "tags": [
     "Account"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "402": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "502": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/balance": {
   "get": {
    "summary": "Balance",
    "description": "Credit left, end date and month spending.",
    "tags": [
     "Account"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "currency": {
           "type": "string"
          },
          "balance": {
           "type": "number"
          },
          "expires_at": {
           "type": "string"
          },
          "month_spent": {
           "type": "number"
          },
          "month_requests": {
           "type": "integer"
          },
          "key": {
           "type": "object"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "402": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "502": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    }
   }
  },
  "/usage": {
   "get": {
    "summary": "Usage",
    "description": "Usage per day and per model.",
    "tags": [
     "Account"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "401": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "402": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "403": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "429": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     },
     "502": {
      "description": "OpenAI-style error. The type field gives the exact cause.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      }
     }
    },
    "parameters": [
     {
      "name": "days",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 30
      },
      "description": "Number of days (1 to 366)."
     }
    ]
   }
  },
  "/pricing": {
   "get": {
    "summary": "Prices",
    "description": "Public list of models, prices and packs. No key needed.",
    "tags": [
     "Account"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    },
    "security": []
   }
  }
 },
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer",
    "description": "xab-..."
   }
  },
  "schemas": {
   "Message": {
    "type": "object",
    "required": [
     "role",
     "content"
    ],
    "properties": {
     "role": {
      "type": "string",
      "enum": [
       "system",
       "user",
       "assistant",
       "tool"
      ]
     },
     "content": {
      "description": "Text, or a list of text / image_url parts",
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "object"
        }
       }
      ]
     },
     "tool_call_id": {
      "type": "string"
     }
    }
   },
   "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"
       }
      }
     }
    }
   },
   "Error": {
    "type": "object",
    "properties": {
     "error": {
      "type": "object",
      "properties": {
       "message": {
        "type": "string"
       },
       "type": {
        "type": "string"
       },
       "code": {
        "type": "integer"
       }
      }
     }
    }
   }
  }
 }
}