{"article":{"title":"Endpoints","breadcrumb":["Getting started","Endpoints"],"body":"**What this solves**: Look up endpoint paths, request fields, and response fields by task when you integrate Tare, all in one place.\n\nIf this is your first integration, you don't have to read all of it. Find the endpoint you need in the task table below, then jump to the matching section.\n\n### Find endpoints by task\n\n| What you want to do | Which endpoints to look at | Which key to use |\n|---|---|---|\n| Run a model chat | `POST /v1/chat/completions` | Inference key or Child key |\n| Create embeddings | `POST /v1/embeddings` | Inference key or Child key |\n| Generate images | `POST /v1/images` or `/v1/images/generations` | Inference key or Child key |\n| Submit a video task | `POST /v1/videos/generations` | Inference key or Child key |\n| Classify a text (yes/no, choice, score) | `POST /v1/decisions` (also `/v1/systemone`); see [Decisions](decisions) | Inference key or Child key |\n| Check available models | `GET /v1/models` | May omit the key; with a key, returns the catalog available to that key |\n| Check the cost of one call | `GET /v1/generation?id=gen-...` | The key that made the call |\n| Issue child keys | `/v1/keys/*` | Provisioning key |\n| Machine reconciliation | `/v1/integration/*` | Reconciliation key |\n\n### Two response formats\n\nThe model endpoints, key management, `/v1/models`, `/v1/generation`, and similar endpoints follow a format close to OpenAI / OpenRouter.\n`/v1/integration/*` and `/v1/mocks/*` use the ApiResponse envelope (the result is wrapped in one uniform outer structure).\nWhen you write a client, do not assume every endpoint uses the same error body.\n\n### The images endpoint in particular\n\nA `/v1/images` response may contain both `b64_json` and `url`. `b64_json` stays valid indefinitely; `url` is a hosted address that expires after 24 hours. If you need to keep an image long term, save the `b64_json` or copy the bytes to your own object storage.\n\n### Details\n\nBase URL: `https://tare.jamerly.ai`\n\n#### Model traffic\n\n| Method | Path | Purpose |\n|---|---|---|\n| POST | `/v1/chat/completions` | Model call. OpenAI format, streaming supported |\n| POST | `/v1/embeddings` | Text to vectors. OpenAI format, no streaming |\n| POST | `/v1/images` | Image generation. No streaming |\n| POST | `/v1/images/generations` | Compatibility path for the same endpoint |\n| POST | `/v1/videos/generations` | Submit a video generation task. Asynchronous, see below |\n| GET | `/v1/videos/generations/{id}` | Check the status and result of a video task |\n| POST | `/v1/decisions` | Decisions: one text and a set of questions, a probability for each answer. No streaming; see [Decisions](decisions) |\n| POST | `/v1/systemone` | Compatibility path for the same endpoint (the TypeSafe Jev / Microsoft Foundry name) |\n| GET | `/v1/models` | Models available to this account, with prices |\n| GET | `/v1/generation?id=gen-…` | Look up the cost of one call after the fact |\n\n##### `POST /v1/embeddings`: text to vectors\n\nOpenAI format. The request body is forwarded to the upstream as-is, with the same two exceptions as chat: `models` and `provider`.\nThe response is the upstream's original body plus one `usage.cost` field:\n\n```json\n{\"model\":\"text-embedding-3-small\",\"input\":\"hello\"}\n```\n\nHow it differs from chat:\n\n> [!WARNING]\n> **Model names are not mapped.** For chat you send the platform-side model name (the `id` from `GET /v1/models`),\n> but here you send the **upstream's own name**. Embeddings do not go through the model routing table, so there is no\n> mapping layer, and the model name in the response is not rewritten either.\n>\n> **A channel must be explicitly configured before it can do embeddings.** Only when you fill in an embeddings\n> address for a channel on the Channels page does it count as offering this endpoint; leave it empty and it does not\n> offer it. **The platform does not infer this from the Dialect**: \"the chat endpoint uses the\n> OpenAI format\" and \"there is an embeddings endpoint\" are two different things. Plenty of relay services, aggregator\n> gateways, and self-hosted inference services only offer chat, and the inferred address does not exist on them.\n\n- **Candidate order: your own channels first, platform channels as the fallback.** Every channel where you have\n  configured an embeddings address becomes a candidate, in ascending channel id order; only when you have configured\n  none does the platform channel that specifically offers embeddings come into play.\n- **Your own channels fail over among themselves.** Configure several and they are tried in order; when the first\n  one is unreachable, the next is used automatically, and each handoff is visible individually in\n  [Call Traces](content-retention).\n- **When every candidate is taken out of rotation (automatically and temporarily disabled by the platform) you get a\n  `503`, not the `404` for an unpriced model.** The two mean different things and have different fixes (wait and\n  retry, versus go configure a price). Reporting works the same as chat and images: one incident of type\n  `UPSTREAM_ALL_DOWN`, visible on the model's health timeline.\n- **`models` and `provider` also work here, but `models` does not mean exactly the same thing as it does in chat.**\n  Embeddings have no routing table to map through, so a name in `models` is another **raw upstream model name**,\n  not a platform-side name. The outer layer swaps model names along that chain, and each swap re-tries all of your\n  channels; only after that one model name has failed on every channel does it move to the next. `provider` behaves\n  exactly as in chat: it only reorders or filters **your own** channels and never pulls platform channels in.\n  For the full field reference see [Routing](routing).\n\n> [!WARNING]\n> **There is no fallback from your own channels to platform channels.** The two are billed differently: your own\n> channels are only recorded, not charged, while platform channels deduct from your balance at the sale price.\n> A silent fallback would amount to **starting to charge you without consent**, and all you would see is \"the call\n> succeeded\". When all your own channels are unavailable, the call fails outright rather than being replaced by a\n> platform channel.\n>\n> **Models without a price on platform channels are rejected, not given away for free.** Platform channel tokens are\n> bought by the platform from the upstream, and when that row is missing from the price list the price computes to 0.\n> Failing clearly is better than silently serving for free.\n> This case returns 404 with the reason; switch to your own channel, or contact us to price that model.\n\nNo streaming. The `gen-` number still comes back in a response header, and `/v1/generation` can look it up.\n\n> [!WARNING]\n> **Embedding models do not appear in `GET /v1/models`.** That catalog comes from the upstream's model catalog,\n> and the upstream catalog has no embedding models in it (measured: 421 models, 0 embedding models). Fill in the model name\n> from the upstream's documentation; you cannot pick it from the platform catalog.\n\n> [!NOTE]\n> **Embedding calls share the [same retention switch](content-retention) as chat.** With the switch\n> on, the request body and the upstream response are both retained and can be expanded in Call Traces; with it off,\n> not a single byte is written to the database.\n\n> [!NOTE]\n> This endpoint used to retain nothing regardless of the switch, on the grounds that \"the input is often a whole\n> document\". The price was that Call Traces showed nothing at all for it. A successful embedding call and a record\n> that never finished looked exactly alike. Whether to retain is now your decision, not a decision made by the\n> endpoint type.\n\n##### `POST /v1/images`: image generation\n\n```json\n{\"model\":\"google/gemini-3-pro-image\",\"prompt\":\"a red fox in the snow\"}\n```\n\n**Request**\n\n| Field | |\n|---|---|\n| `model` | **Required.** A model you configured on the Routing page, or a platform default model. As with chat, use `models` for the fallback chain and `provider` for the per-request routing preference, see [Routing](routing) |\n| `prompt` | **Required.** The image description |\n| Other fields | **Forwarded to the upstream as-is**: `size`, `aspect_ratio`, `n`, `input_references`, and each provider's own parameters. Which ones are supported depends on the model; when you pass a field the upstream does not support, you get the **upstream's** error, not the platform's. `models` and `provider` are the exceptions: as with chat, these two are consumed and not forwarded to the upstream |\n\n`POST /v1/images/generations` is the same endpoint, with an identical request and response.\n\n**Response**\n\n```json\n{\n  \"id\": \"gen-c9d21c16eec04f968fc9bbcd08e140f9\",\n  \"created\": 1787820572,\n  \"model\": \"google/gemini-3-pro-image\",\n  \"data\": [\n    {\n      \"b64_json\": \"iVBORw0KGgo…\",\n      \"media_type\": \"image/png\",\n      \"url\": \"https://s.jamerly.ai/img/36/b21a5d9fa79b4135993282e1baf34999.png\",\n      \"expires_at\": 1787906972\n    }\n  ],\n  \"usage\": {\"prompt_tokens\": 7, \"completion_tokens\": 4175, \"total_tokens\": 4182, \"cost\": 0.000900}\n}\n```\n\n| Field | |\n|---|---|\n| `id` | The number for this call, the same value as the `X-Generation-Id` response header; use it to query [`/v1/generation`](endpoints) |\n| `model` | **The model name used in the request**, not the upstream's model name |\n| `data[].b64_json` | The image bytes, base64. **This field stays valid indefinitely** |\n| `data[].media_type` | `image/png`, `image/jpeg`, … |\n| `data[].url` | A hosted address for the same bytes. **Expires 24 hours after the call** |\n| `data[].expires_at` | Unix seconds, the moment this URL expires; treat this as authoritative |\n| `text` | Text the model returned alongside the image. **The field is omitted when empty.** A standard images response has no field for carrying text, so this is a field the platform adds, and the standard fields are unchanged |\n| `finish_reason` | The upstream's finish reason. **When `data` is empty, read this field first**: `content_filter` means the upstream did generate an image but its own content policy blocked it |\n| `usage` | Token counts, plus `cost` = **the cost of this call**. Images are billed by token, so `completion_tokens` is large |\n\n> [!WARNING]\n> **`data` may be an empty array, and that is not an error.** The upstream returned normally and simply gave no\n> image, for example because the model only returned text this time, or because the image was blocked by the\n> upstream's content policy. The platform <b>does not treat this as a failure</b>:\n> the HTTP status is still 200, and the specific reason is in the `finish_reason` and `text` fields.\n\n> [!WARNING]\n> **Do not persist `url` to a database.** The link stops working the next day, and before it expires it cannot be\n> told apart from a permanent link. When you need to keep the image, save the `b64_json` or copy the bytes to your own\n> storage.\n> The purpose of this URL is to hand the image to other systems without transferring several MB of bytes.\n\n![Images endpoint · the URL expires after 24 hours](diagram:en-endpoints-image-expiry)\n\n**Behavior**\n\n- **Routed by model**, just like `/v1/chat/completions`: whichever channel you point\n  `google/gemini-3-pro-image` at on the Routing page is the channel this call takes. Image models differ in price by\n  more than an order of magnitude, so the model choice has a large effect on cost.\n- **Failover works as in chat**: when a model has more than one route configured, a failure moves to the next\n  candidate instead of failing the call outright. The second candidate may be billed differently (one is your own\n  channel, one is a platform channel), so the balance check looks at **every candidate along the whole chain**, not\n  just the first.\n- **Billing, quotas, and call records are exactly as in chat**: the same three checks for balance / budget / child key\n  limit, the same records in [Call Traces](content-retention) (including the prompt), and the same\n  billing definition. Every endpoint uses the same accounting.\n- **No streaming.**\n\n##### Generating images inside a chat call: `modalities`\n\nThis approach is supported too: pass `modalities` to `/v1/chat/completions` and the images come back in\n`message.images`. Use it when a single call must return both text and images; when you need images only, use\n`/v1/images`.\n\n```json\n{\"model\":\"…\",\"messages\":[{\"role\":\"user\",\"content\":\"a red fox\"}],\n \"modalities\":[\"image\",\"text\"]}\n```\n\nThe request body is **forwarded to the upstream as-is**, and the response is **the upstream's original body** (only `model` and `id` are rewritten). Three things to note:\n\n> [!WARNING]\n> **Routing looks only at the input modality, not at the output modality of the request.** When one model name has\n> several candidates and only some of them can produce images, failover may land on one that cannot, showing up as\n> \"the same request sometimes returns an image and sometimes only text\".\n> **Avoid this in configuration**: give image-capable models their own model name, or configure only one channel for\n> them. Selecting candidates by output modality is on the roadmap.\n\n- **Pricing is by token plus the upstream's self-reported cost**. `pricing.image` in `GET /v1/models` **is always 0,\n  which does not mean free** (there is no \"per image\" tier). For the cost of one image, read `usage.cost` from the\n  response.\n- Whether an image comes back as base64 or as a URL **is decided by the upstream**; the platform does not rewrite it.\n\n##### `POST /v1/videos/generations`: video generation\n\nVideo tasks routinely run for minutes, not seconds, so the format is \"submit, then poll\" rather than request-response:\n\n```json\n{\"model\":\"…\",\"prompt\":\"a red fox running through snow\",\n \"duration_seconds\":5,\"aspect_ratio\":\"16:9\"}\n```\n\n**Request**\n\n| Field | |\n|---|---|\n| `model` | **Required.** Supports the `models` fallback model chain and the `provider` per-request channel preference, see [Routing](routing) |\n| `prompt` | **Required** |\n| `duration_seconds`, `aspect_ratio` | Optional; which values a model accepts depends on the model itself |\n| `reference_image_url`, `reference_video_url` | Optional reference inputs, for models that support image-to-video / video-to-video |\n| `callback_url` | Accepted and stored. **It is not delivered at present** — it is not called when the task finishes — so poll instead |\n| Other fields | Forwarded to the upstream as-is, with the same rules as `/v1/images` |\n\nThe three gates for balance / budget / child key limit are checked at submit time, as in chat. A task over the limit cannot be created at all.\n\n> [!WARNING]\n> **There is no cross-channel failover here, unlike in chat, embeddings, and images.** A submit hits **one** candidate\n> only, the highest-priority one after `provider` filtering. If that channel's own submit call fails, the task fails\n> outright and is not moved to the next channel you configured. `models` can only catch the case where \"this model has\n> no route configured at all\"; when the model does have a route but that one channel rejects the submit request,\n> `models` cannot help. If you configure a fallback channel for a video model and expect it to fail over\n> automatically like chat, that fallback channel will not be used unless the primary channel has no route at all.\n\nIf the first candidate happens to be out of rotation already, a submit with more than one candidate configured will at least\nskip to one that is not. That is the \"pick a candidate\" step looking at circuit breaker state, not the failure retry\ndescribed above. If every candidate is out of rotation, the submit is rejected outright rather than forcing a call to\na channel known to be parked, and as with chat and images, an incident of type `UPSTREAM_ALL_DOWN` is recorded here\ntoo.\n\n**Response** (the submit endpoint and every poll return this format)\n\n```json\n{\"id\":\"gen-…\",\"status\":\"pending\",\"model\":\"…\",\"created\":1700000000}\n```\n\n| `status` | Meaning |\n|---|---|\n| `pending` | Accepted, the upstream has not started yet |\n| `running` | The upstream is generating |\n| `succeeded` | `result.video_url` (plus `result.video_urls` when the upstream returns more than one), `usage.video_tokens`, `completed` |\n| `failed` | `error.message` |\n| `expired` | Gave up waiting for the upstream. Treat it as `failed` |\n\nThe diagram below helps you understand the states; when polling, go by the `status` in the response and do not rely on a fixed order of state transitions.\n\n![Video generation · the five values of status](diagram:en-endpoints-video-status)\n\n> [!NOTE]\n> **Polling `GET /v1/videos/generations/{id}` never hits your upstream provider.** It reads the platform's own task\n> table; the polling rhythm that actually hits the upstream is controlled centrally by Tare. Poll as often as you\n> like: it adds no extra calls to the provider and does not make the task run faster.\n\n> [!WARNING]\n> chat, embeddings, and images have two things this endpoint does not have right now: `usage_label` is accepted but\n> not read (silently, it just becomes a field the upstream does not recognize and ignores), and the prompt and the\n> result are **never** written to [Call Traces](content-retention), regardless of the account's\n> retention switch. Neither of these can be turned on right now:\n> video generation calls have no attribution label for the moment and no queryable history, unlike the other three\n> endpoints.\n\n#### Request headers\n\n> [!WARNING]\n> **Unrecognized request headers are ignored: the request is not rejected because of them, and they are not forwarded\n> to the upstream.** The platform rebuilds the headers it sends upstream (credentials, `Content-Type`, and the\n> several headers that each provider's Dialect requires), so **headers your client sends do not appear on the\n> upstream side**.\n\nThe attribution headers `HTTP-Referer` / `X-Title` are in this category: sending them has no side effects (they do not\naffect routing, billing, or rate limits), but they do not reach the upstream. For attribution, use these two methods:\n\n| Need | Method |\n|---|---|\n| Mark which business a call belongs to | `usage_label` in the request body, recorded as-is in the usage record. **Only chat, embeddings, and images support it**; video generation does not read this field at present, so passing it does nothing (and raises no error, because unrecognized fields are forwarded to the upstream as-is) |\n| Mark which end user a call belongs to | Create a separate child key for that user, see [Provisioning key](provisioning) |\n\n> [!NOTE]\n> **CORS is not enabled.** When connecting directly from a browser, these two custom headers are stopped by the\n> browser during the preflight, and the request is never sent at all. Server-side calls are unaffected, and you\n> should always call from the server anyway: putting an inference key in a browser is the same as publishing it.\n\n#### The `gen-` number\n\nEvery call returns a `gen-xxxxx`, **generated by the platform**, not by the upstream. Use it to look up cost, or as an\nidempotency key for your own accounting.\n\nThe prefix is a hard requirement: plenty of clients check whether a call has a number with `id.startsWith(\"gen-\")`,\nand changing the prefix makes that check fail and leaves the reconciliation pipeline spinning.\n\n#### Key management (provisioning key)\n\nLets platform customers issue child keys to end users and call with the provisioning key, **without depending on a\nlogin session**. See [Provisioning key](provisioning).\n\n| Method | Path | Purpose |\n|---|---|---|\n| POST | `/v1/keys` | Create a child key (idempotent when `external_id` is supplied) |\n| GET | `/v1/keys` | List child keys under this account, cursor pagination, including disabled ones |\n| GET | `/v1/keys/{hash}` | Check a child key's limit and usage |\n| PATCH | `/v1/keys/{hash}` | Change the limit / disable / rename |\n| GET | `/v1/keys/external/{externalId}` | Same as above, located by **external id** |\n| PATCH | `/v1/keys/external/{externalId}` | Same as above, located by **external id** |\n| POST | `/v1/keys/{hash}/reset` | Reset the limit now (`/v1/keys/external/{externalId}/reset` by external id) |\n| GET | `/v1/keys/usage/daily` | Daily usage of every child key under the account |\n| GET | `/v1/keys/{hash}/usage/daily` | Daily usage of one child key |\n| GET | `/v1/keys/external/{externalId}/usage/daily` | Same as above, located by **external id** |\n\n#### Console and reconciliation\n\nThe console (channels, routing, statements, alerts) is a separate interface that uses a login session. Machine-to-machine reconciliation has dedicated, key-authenticated endpoints, see [Reconciliation API](integration-api).\n\n> [!NOTE]\n> The three key types have non-overlapping permissions: an inference key can only call models, a reconciliation key\n> can only read reports, and a provisioning key can only manage keys.\n> Using the wrong type returns an explicit refusal, not a vague 401.\n\n#### `GET /v1/models`: fields and what they mean\n\n> [!NOTE]\n> **Send your inference key and the catalog includes the models you configured yourself**: the ones on your own\n> channels ∪ the platform's, with your own entry winning on a name collision, exactly matching how routing behaves on\n> a real call.\n> **Without a key** you get the platform catalog (this path is always kept, so a client can pull the catalog without\n> any request headers).\n>\n> **Either an inference key or a provisioning key works.** A provisioning key has no Router bound, so it gets the\n> catalog for the **account's default routing**; to see which models a child key bound to a different Router can use,\n> call with that child key.\n\n> [!WARNING]\n> When a key is supplied but is invalid or expired, you get **401** (it does not silently return a catalog missing\n> your own models);\n> a reconciliation key gets **403**: a reconciliation key has no access to model-related endpoints.\n>\n> **For models on your own channels, `pricing.prompt` / `completion` are `0`**: those tokens are paid by you directly\n> to the upstream and do not go through the platform price list. Read the real cost from `usage.cost` in the response.\n\n```json\n{\"data\":[{\"id\":\"GLM 5.1\",\"name\":\"GLM 5.1\",\"description\":\"…\",\"context_length\":128000,\n  \"architecture\":{\"modality\":\"text->text\",\"input_modalities\":[\"text\"],\"output_modalities\":[\"text\"]},\n  \"reasoning\":{\"mandatory\":false,\"default_enabled\":true,\n    \"supported_efforts\":[\"low\",\"medium\",\"high\"],\"default_effort\":\"medium\"},\n  \"pricing\":{\"prompt\":\"0.0000006\",\"completion\":\"0.0000022\",\n    \"input_cache_read\":\"0.00000006\",\"input_cache_write\":\"0.00000075\",\n    \"request\":\"0\",\"image\":\"0\"}}]}\n```\n\n| Field | Meaning |\n|---|---|\n| `id` | **The platform-side model name**, use it to make calls |\n| `pricing.prompt` / `completion` | **Per token** (not per million), a string |\n| `pricing.input_cache_read` / `input_cache_write` | The two cache tiers, also per token |\n| `pricing.request` / `image` | **Always `0`**, see the warning below |\n| Currency | **US dollars**; conversion to other currencies is not offered for now |\n| `description` | The model description from the upstream catalog; **the field is absent** when unavailable |\n| `context_length` | From the upstream catalog; **the field is absent** when unavailable (do not treat it as 0) |\n| `max_completion_tokens` | This model's own output length limit; when unavailable it is absent, the same rule as `context_length` |\n| `architecture` | What you set for the model on Routing, otherwise the upstream catalog, otherwise Tare's model reference; **absent** when none of them has it |\n| `reasoning` | Thinking capability, from the upstream catalog; when unavailable **the field is absent and no default is given** |\n\nFor the three fields `description`, `context_length`, and `max_completion_tokens`, an upstream catalog that does not\nsupply them does not mean there is nothing to say: Tare maintains its own baseline data for common models, and when\nthe upstream does not supply them it checks that baseline first before deciding whether to leave them empty. For\nself-hosted and uncommon models it still invents nothing. This baseline only helps models that the upstream catalog\nhappens not to cover.\n\n> [!WARNING]\n> `pricing.image` **is always `0`, but images are not free**. The price list has only the four token tiers (input /\n> output / cache read / cache write) and no \"per image\" tier; calls with images are priced by the tokens and the cost that the\n> upstream reports.\n> **Do not use this field to estimate image cost**; read `usage.cost` from the response.\n\n##### `reasoning`: thinking capability\n\n```json\n{\"mandatory\":false,\"default_enabled\":true,\n \"supported_efforts\":[\"low\",\"medium\",\"high\"],\"default_effort\":\"medium\"}\n```\n\nUse it to decide whether to show a \"thinking effort\" selector, and which tiers to show:\n\n- **The values of `supported_efforts` are decided by the upstream** and are not limited to these three (some\n  upstreams also offer `minimal` / `xhigh` / `none`). **Render based on the field; do not hard-code it in the client**.\n- **`mandatory: true` means it cannot be turned off**, so do not render a toggle in that case.\n\n> [!WARNING]\n> **A missing `reasoning` means unknown, not \"thinking not supported\".** Self-hosted and local models have no catalog\n> entry, so the field is absent for them; treating absence as unsupported would make the selector disappear for those\n> models. There is no fallback here: inventing a default amounts to making an unconfirmed promise on the upstream's\n> behalf, and a user who picks an effort the upstream does not accept gets a 400 that looks like a model failure.\n\n**How to get the thinking content from the response**: if the model actually produced a reasoning process, it appears\nin `message.reasoning_content` (streaming: `delta.reasoning_content`), a field separate from `content`. Different\nupstreams give different formats, for example Anthropic's `thinking` content blocks, in both complete and streaming\nform, all translated into this one field, so the client only has to read one place and does not care which provider is\nanswering.\n\n> [!NOTE]\n> **There is currently no separate flag for tool-calling capability**, so this catalog cannot tell you whether a model supports tool calls.\n\n#### `usage.cost`: the cost of this call\n\nIn US dollars:\n\n- Platform models: equal to the platform sale price;\n- **BYOK: the upstream cost price + a governance fee**. With BYOK you pay the provider for the tokens directly, and\n  putting 0 here would make the cost report show millions of tokens used for free this month. The governance fee floor\n  is `0.0001`. A higher rate follows the trial or contract.\n- For channels where the upstream reports its own cost in the response, **that reported value is used**, and you get\n  it even without recording a cost price.\n\n> [!WARNING]\n> **When it cannot be computed, the field is absent** rather than 0: a fake 0 would be taken at face value.\n> \"This model is not priced yet\" also counts as not computable, so **a `0` that appears is a real 0**.\n>\n> **The final frame of a stream also carries `cost`** (only the final frame has usage).\n>\n> **A platform model's response has no `usage.cost_details`**: that field is the fee the upstream charges the\n> platform. It is kept under BYOK, where the value comes from your own upstream statement and is exactly what cost\n> attribution needs.\n> `upstream_inference_cost` in `GET /v1/generation` works the same way and only BYOK calls have that field.\n\n> [!WARNING]\n> Self-hosted and local models, and relays whose model list carries only ids, usually have no `architecture`.\n> Apps that filter models by `input_modalities` drop them. Set the capabilities on the console's **Routing** page\n> (open the model and click **Capabilities**): the dialog fills in what the upstream says, and what you save is what\n> `/v1/models` reports from then on.\n\n#### `GET /v1/generation?id=`: when the data becomes queryable\n\nThe data comes from the usage record, and **the usage record is written after the response**, so querying the number immediately returns 404.\n\n> [!WARNING]\n> A 404 has two meanings and **they currently share one code**: not yet written (you should retry) and a call that is\n> not yours (you should give up). Tell them apart by time: **a 404 within 60 seconds of receiving the number is\n> always treated as not yet written**, and beyond that as the latter. Not telling them apart is deliberate, because\n> telling them apart amounts to providing a probe endpoint for \"does this number exist\".\n\n- **Non-streaming**: usually queryable within 1 second of the response.\n- **Streaming**: written after the final frame, so go by **the end of the stream**.\n- **A 404 is a normal path**, treat it as \"try again later\" and retry with a few seconds of backoff.\n\n> [!WARNING]\n> **For a streaming call that was cut off midway**, the cost has to be back-queried from the upstream afterwards and\n> recorded late, which can take up to minutes.\n\n##### Timing fields\n\n| Field | Meaning |\n|---|---|\n| `generation_time` | The time spent by the provider that actually answered (milliseconds). Equal to `latency` when there was no handoff |\n| `latency` | Total time: `generation_time` plus the time of each failed attempt before the handoff |\n| `routing_overhead_ms` | `latency` minus `generation_time`. **Appears only when a channel handoff actually happened**; with no handoff this cell is not given, rather than 0 |\n| `time_to_first_token_ms` | Time until the first byte arrived. **Only streaming calls have it** |\n\nThe field names and the way `latency` / `generation_time` are split are copied from OpenRouter's own generation\nstats. `routing_overhead_ms` is one it does not have. OpenRouter does not expose its own retries to the caller, and\nTare can because each attempt is accounted for separately to begin with; see the explanation of \"how can one call try\nmore than one provider\" in [Routing](routing).\n\n> [!NOTE]\n> These four fields do not appear on usage records written before the feature shipped. If it is missing, it is missing; no guessed value is filled in.\n\n#### Streaming: `stream_options.include_usage` is forced on\n\nWithout usage there is no way to bill, so this option **overrides what is in the request** (the platform replaces the whole `stream_options` block). The resulting format differences:\n\n| Upstream Dialect | Final frame format |\n|---|---|\n| OpenAI-compatible | The upstream's final frame is **forwarded as-is**: `choices` is an **empty array**, with `usage` |\n| Anthropic | Translated by the platform: `choices` has one item, `delta` is empty, with `finish_reason` and `usage` |\n\n> [!WARNING]\n> **The final frame formats of the two Dialects are not consistent.** When the frontend renders frame by frame, writing the\n> test as \"`choices` is empty **or** `delta` has no content → skip rendering and just take `usage`\" covers both\n> formats. The Anthropic one is not padded into an empty `choices` frame, because that would add an extra frame.\n\n![Streaming final frame · two formats](diagram:en-endpoints-streaming-final-frame)\n\n#### OpenAPI / JSON Schema\n\nThe public endpoints (`/v1/chat/completions`, `/v1/keys`, `/v1/models`, `/v1/generation`, `/v1/integration/*`) have a\n**hand-maintained OpenAPI 3.1 description file**, updated in step with this document:\n\n| | |\n|---|---|\n| [**View online**](/openapi/tare.html) | A single page, **works offline**, no external dependencies |\n| [**Download openapi.yaml**](/openapi/tare.yaml) | Use it to generate clients, or import into Postman / Insomnia |\n\n> [!NOTE]\n> The automatically generated description is not provided: it would also expose the console, health checks, and other\n> endpoints not aimed at callers, and those are not a stable contract and are not exposed on the gateway either. The\n> scope of the hand-written one is exactly **the endpoints that appear in this document**.\n\n> [!NOTE]\n> The description file only covers **field structure** and does not repeat the reasoning here (why an exhausted limit\n> is a 403, why the streaming final frame formats differ between the two Dialects, and so on). Read both together when you\n> integrate.\n\n#### Console and admin endpoints\n\nEverything above covers model calls — the set of endpoints your application will hit. The console itself, and the people who want to\nscript directly against their logged-in session, sit in front of a much larger endpoint surface. None of these need\nan API key; what they need is a login session. Below is one row per area, without listing paths one by one; see the\nmatching document for what each one does:\n\n| Area | Root path | Covered in |\n|---|---|---|\n| API Key (the account owner's full view: provisioning keys, inference keys, and child keys are all in here) | `/v1/api-keys` | [API Key](auth) |\n| Provisioning keys managing the child keys they issued | `/v1/keys` | [Provisioning key](provisioning), this group **can** be called with a provisioning key |\n| Channels | `/v1/providers` | [Channels](channels), [Cost prices](cost-prices) |\n| Local Node | `/v1/node` | [Local Node](local-nodes) |\n| Default routing | `/v1/routing` | [Routing](routing) |\n| Named Router | `/v1/routers` | [Routing](routing) |\n| Alert rules and channels | `/v1/alerts` | [Alerts](alerts) |\n| Drill scenarios | `/v1/mocks` | [Mock](mock), this group **can** also be called with an inference key |\n| Content retention and viewing authorization | `/v1/content-settings` | [Call Traces](content-retention) |\n| Audit log | `/v1/audit` | [Audit log](audit-trail) |\n| DLP policies and skip settings | `/v1/dlp` | [Data protection](security) |\n| Channels, routing and DLP with a management key | `/v1/manage` | [Management keys](management-key), this group can **only** be called with a management key |\n| Model and channel health | `/v1/health` | [Routing](routing), [Channels](channels) |\n| Billing center, statements, invoices | `/v1/billing` | [Statements and invoices](statements) |\n| Usage analytics and charts | `/v1/analytics`, `/usage` | [Cost attribution](attribution) |\n\n### Next steps\n\n- Just want to get your first request working: read [Quickstart](quickstart).\n- Want to connect your own provider: read [Channels](channels), [Cost prices](cost-prices).\n- Want to configure model routing: read [Routing](routing).\n- Want to know what the error codes mean: read [Error codes](errors).\n- Want machine reconciliation: read [Reconciliation API](integration-api).\n"},"diagrams":{"en-endpoints-image-expiry":"<svg viewBox=\"0 0 717 245\" width=\"717\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\">\n  <title>Image API: the URL expires in 24 hours</title>\n  <desc>Each image in data[] has both b64_json and url. b64_json stays valid. url is a hosted address that expires in 24 hours. To keep the image, store b64_json or copy it to your own storage.</desc>\n  <style>\n    text { font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif; }\n  </style>\n\n  <!-- 浅色画布 -->\n  <rect x=\"0\" y=\"0\" width=\"717\" height=\"245\" fill=\"#ffffff\"/>\n\n  <!-- 版式算术：\n       两列并排，左列宽 336、右列宽 312，间距 25（383-358=25）。\n       左列 x=22，中心=190；右列 x=383，中心=539。内容边界 22..695，中心=358.5。\n       viewBox 宽 = 695+22×2 = 739 → 修正为 717（右边界=717-22=695）✓\n       框高 108，顶边 60，底边 168。\n       标题 y=34，脚注 y=205/220，viewBox h=245（底部边距≈22px）。 -->\n\n  <!-- 标题 -->\n  <text x=\"358.5\" y=\"34\" font-size=\"16\" fill=\"#1e293b\" text-anchor=\"middle\">Image API: the URL expires in 24 hours</text>\n\n  <!-- 左列：b64_json（绿色） -->\n  <rect x=\"22\" y=\"60\" width=\"336\" height=\"108\" rx=\"6\" fill=\"#d1fae5\" stroke=\"#22c55e\"/>\n  <text x=\"190\" y=\"88\" font-size=\"12\" fill=\"#166534\" text-anchor=\"middle\">b64_json</text>\n  <text x=\"190\" y=\"103\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">Image bytes, base64</text>\n  <text x=\"190\" y=\"118\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">Stays valid</text>\n  <text x=\"190\" y=\"133\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">Store it in your database</text>\n  <text x=\"190\" y=\"148\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">Or copy it to your own storage</text>\n\n  <!-- 右列：url（粉色） -->\n  <rect x=\"383\" y=\"60\" width=\"312\" height=\"108\" rx=\"6\" fill=\"#fce7f3\" stroke=\"#ec4899\"/>\n  <text x=\"539\" y=\"88\" font-size=\"12\" fill=\"#9d174d\" text-anchor=\"middle\">url</text>\n  <text x=\"539\" y=\"103\" font-size=\"10\" fill=\"#9d174d\" text-anchor=\"middle\">Hosted address</text>\n  <text x=\"539\" y=\"118\" font-size=\"10\" fill=\"#9d174d\" text-anchor=\"middle\">Expires in 24 hours</text>\n  <text x=\"539\" y=\"133\" font-size=\"10\" fill=\"#9d174d\" text-anchor=\"middle\">Use it to pass the image</text>\n  <text x=\"539\" y=\"148\" font-size=\"10\" fill=\"#9d174d\" text-anchor=\"middle\">Skip moving multi-MB bytes</text>\n\n  <!-- 脚注（两行，居中 358.5） -->\n  <text x=\"358.5\" y=\"205\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">These fields sit on each image in data[], not at the top: { b64_json, url, expires_at }</text>\n  <text x=\"358.5\" y=\"220\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">Do not store url in a database. To keep the image, save b64_json or copy it.</text>\n</svg>\n","en-endpoints-video-status":"<svg viewBox=\"0 0 700 321\" width=\"700\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\">\n  <title>Video generation: five status values</title>\n  <desc>After a video task is accepted, status is pending, running, succeeded, failed, or expired. Polling GET /v1/videos/generations/{id} reads the platform task table and never calls the upstream. Submit tries one candidate and does not fail over.</desc>\n  <style>\n    text { font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif; }\n  </style>\n  <defs>\n    <marker id=\"arrow-blue\" markerWidth=\"8\" markerHeight=\"8\" refX=\"2\" refY=\"4\" orient=\"auto\" markerUnits=\"userSpaceOnUse\">\n      <path d=\"M0,0 L8,4 L0,8 L2,4 z\" fill=\"#3b82f6\"/>\n    </marker>\n    <marker id=\"arrow-green\" markerWidth=\"8\" markerHeight=\"8\" refX=\"2\" refY=\"4\" orient=\"auto\" markerUnits=\"userSpaceOnUse\">\n      <path d=\"M0,0 L8,4 L0,8 L2,4 z\" fill=\"#22c55e\"/>\n    </marker>\n  </defs>\n\n  <!-- 浅色画布 -->\n  <rect x=\"0\" y=\"0\" width=\"700\" height=\"321\" fill=\"#ffffff\"/>\n\n  <!-- 版式算术在任何坐标落笔之前就定死了。\n       上行两格：宽 156、间距 28，于是 22..178 / 206..362（中心 100 / 284）。\n       下行是「终态」这一组：虚线容器横跨整行 22..678，容器内三格\n       先减掉两个 28px 列间距再等分：678 − 22 − 15×2 = 626，626 − 56 = 570，三格各 190，\n       于是 37..227 / 255..445 / 473..663（中心 132 / 350 / 578）。\n       容器顶部 25px 被组名占掉，内框从 y = 142 + 25 = 167 起排，高 54，容器底 = 221 + 15 = 236。\n       行间距：上行底 114 → 容器顶 142 = 28。\n       内容左右边界 22..678，中心 350；viewBox 宽 = 656 + 两侧各 22 = 700。\n       标题与三条脚注都落在 350。\n       高度 = 脚注末行基线 296 + 下伸 2.5 + 22px 边距 = 320.5，取整 321。 -->\n\n  <!-- 标题落在内容中心 350。y = 22 + 16 x 0.75 -->\n  <text x=\"350\" y=\"34\" font-size=\"16\" fill=\"#1e293b\" text-anchor=\"middle\">Video generation: five status values</text>\n\n  <!-- 第 0 层：终态组框，必须排在连线之前画——\n       它的填充是不透明的，否则会盖住落向它顶边的那条竖直箭头。 -->\n  <rect x=\"22\" y=\"142\" width=\"656\" height=\"94\" rx=\"10\" fill=\"#f8fafc\" stroke=\"#94a3b8\" stroke-dasharray=\"6,4\"/>\n  <text x=\"32\" y=\"156\" font-size=\"11\" fill=\"#64748b\" text-anchor=\"start\">Final</text>\n\n  <!-- 第 1 层：连线（先于框绘制）。\n       pending → running：水平，起点 = 源框右沿 + 5，终点 = 目标框左沿 − 11。\n       running → 终态组：竖直，起点 = 上行框底 114 + 5 = 119，终点 = 容器顶 142 − 11 = 131。\n       线色跟着它离开的那个框的描边色。 -->\n  <path d=\"M183,87 L 195,87\" fill=\"none\" stroke=\"#3b82f6\" stroke-width=\"1.5\" marker-end=\"url(#arrow-blue)\"/>\n  <path d=\"M284,119 L 284,131\" fill=\"none\" stroke=\"#3b82f6\" stroke-width=\"1.5\" marker-end=\"url(#arrow-blue)\"/>\n\n  <!-- 第 2 层：方框和文字，盖住线头。\n       两行框的基线 = 框心 + 12 x 0.35 再上下各让 9px：\n       上行框心 87，落在 80 / 98；容器内框心 194，落在 187 / 205。\n       蓝是「进行中」那一组，绿与粉是「终态」那一组里成与不成。 -->\n  <rect x=\"22\" y=\"60\" width=\"156\" height=\"54\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"100\" y=\"82\" font-size=\"12\" fill=\"#1e40af\" text-anchor=\"middle\">pending</text>\n  <text x=\"100\" y=\"100\" font-size=\"10\" fill=\"#1e40af\" text-anchor=\"middle\">Accepted, not started</text>\n\n  <rect x=\"206\" y=\"60\" width=\"156\" height=\"54\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"284\" y=\"82\" font-size=\"12\" fill=\"#1e40af\" text-anchor=\"middle\">running</text>\n  <text x=\"284\" y=\"100\" font-size=\"10\" fill=\"#1e40af\" text-anchor=\"middle\">Upstream is generating</text>\n\n  <rect x=\"37\" y=\"167\" width=\"190\" height=\"54\" rx=\"6\" fill=\"#d1fae5\" stroke=\"#22c55e\"/>\n  <text x=\"132\" y=\"189\" font-size=\"12\" fill=\"#166534\" text-anchor=\"middle\">succeeded</text>\n  <text x=\"132\" y=\"207\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">result.video_url</text>\n\n  <rect x=\"255\" y=\"167\" width=\"190\" height=\"54\" rx=\"6\" fill=\"#fce7f3\" stroke=\"#ec4899\"/>\n  <text x=\"350\" y=\"189\" font-size=\"12\" fill=\"#9d174d\" text-anchor=\"middle\">failed</text>\n  <text x=\"350\" y=\"207\" font-size=\"10\" fill=\"#9d174d\" text-anchor=\"middle\">error.message</text>\n\n  <rect x=\"473\" y=\"167\" width=\"190\" height=\"54\" rx=\"6\" fill=\"#fce7f3\" stroke=\"#ec4899\"/>\n  <text x=\"568\" y=\"189\" font-size=\"12\" fill=\"#9d174d\" text-anchor=\"middle\">expired</text>\n  <text x=\"568\" y=\"207\" font-size=\"10\" fill=\"#9d174d\" text-anchor=\"middle\">Treat as failed</text>\n\n  <!-- 第 3 层：脚注三行，同为 10px、行距 15px，居中 350。 -->\n  <text x=\"350\" y=\"266\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">Polling GET /v1/videos/generations/{id} never hits upstream. It reads the platform task table.</text>\n  <text x=\"350\" y=\"281\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">Trust status in the response, not a fixed order. The two rows are in progress and final.</text>\n  <text x=\"350\" y=\"296\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">Shown after a successful submit. Submit tries one candidate. A refusal fails the task, with no failover.</text>\n</svg>\n","en-endpoints-streaming-final-frame":"<svg viewBox=\"0 0 713 370\" width=\"713\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\">\n  <title>Streaming final frame: two shapes</title>\n  <desc>The final streaming frame has two shapes. OpenAI-compatible: choices is empty and usage is present. Anthropic: choices has one item, delta is empty, with finish_reason and usage. Treat empty choices or an empty delta as usage only, and do not render it.</desc>\n  <style>\n    text { font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif; }\n  </style>\n  <defs>\n    <marker id=\"arrow-blue\" markerWidth=\"8\" markerHeight=\"8\" refX=\"2\" refY=\"4\" orient=\"auto\" markerUnits=\"userSpaceOnUse\">\n      <path d=\"M0,0 L8,4 L0,8 L2,4 z\" fill=\"#3b82f6\"/>\n    </marker>\n  </defs>\n\n  <!-- 浅色画布 -->\n  <rect x=\"0\" y=\"0\" width=\"713\" height=\"370\" fill=\"#ffffff\"/>\n\n  <!-- 版式算术：所有坐标在任何一笔之前定死。\n       根框横跨整行：x=22, w=669, h=54, y=60 → 22..691，中心 x=356.5。\n       下行两列要**先减掉列间距再等分**：669 − 28 = 641，于是\n         左列 22..342（w=320，中心 x=182），右列 370..691（w=321，中心 x=530.5）。\n       两列之间唯一正确的关系是「净距 28px」——\n         旧版写成 22..358 与 357..693：两列重叠 1px，右列还比根框宽出 2px。\n         一旦两个框重叠，block-spacing 会把这一对直接跳过（方向净距为 null），\n         svg-lint 于是静默放过——这条只能靠算，指望不上 lint。\n       行间距：根框底 114 → 列框顶 142 = 28；列框底 250 → 判据框顶 275 = 25。\n       判据框居中：x=158, w=397, h=50, y=275，中心 x=356.5，与根框同轴。\n       左右边距各 22（左 22，右 713−691）；标题 y=34，脚注 y=345，viewBox h=370。 -->\n  <text x=\"356.5\" y=\"34\" font-size=\"16\" fill=\"#1e293b\" text-anchor=\"middle\">Streaming final frame: two shapes</text>\n\n  <!-- 连线：根框 → 左右两列，竖直同轴用 L，各自落在列框中轴上。\n       起点 = 根框底边 114 + 5 = 119，终点 = 列框顶边 142 − 11 = 131，\n       留 12px 可见线给箭头，箭头尖端正好落在框沿外 11px 处。 -->\n  <path d=\"M182,119 L 182,131\" fill=\"none\" stroke=\"#3b82f6\" stroke-width=\"1.5\" marker-end=\"url(#arrow-blue)\"/>\n  <path d=\"M530.5,119 L 530.5,131\" fill=\"none\" stroke=\"#3b82f6\" stroke-width=\"1.5\" marker-end=\"url(#arrow-blue)\"/>\n\n  <!-- 上行根框：这一次流式调用的末帧。画在连线之后，框体才能盖住线头。\n       两行基线 81.8 / 99.8：块的光学中心 = 框 y + h/2 + 12 × 0.35 = 91.2，\n       两行各让 9px → 82.2 / 100.2，按 lint 口径落到 81.8 / 99.8。 -->\n  <rect x=\"22\" y=\"60\" width=\"669\" height=\"54\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"356.5\" y=\"81.8\" font-size=\"12\" fill=\"#1e40af\" text-anchor=\"middle\">The final frame of this stream</text>\n  <text x=\"356.5\" y=\"99.8\" font-size=\"10\" fill=\"#1e40af\" text-anchor=\"middle\">Its shape depends on which upstream answered</text>\n\n  <!-- 左列：OpenAI 兼容格式（绿色）。框心 y=196，五行中点落 200。 -->\n  <rect x=\"22\" y=\"142\" width=\"320\" height=\"108\" rx=\"6\" fill=\"#d1fae5\" stroke=\"#22c55e\"/>\n  <text x=\"182\" y=\"170\" font-size=\"12\" fill=\"#166534\" text-anchor=\"middle\">OpenAI-compatible</text>\n  <text x=\"182\" y=\"185\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">choices is an empty array</text>\n  <text x=\"182\" y=\"200\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">Includes a usage field</text>\n  <text x=\"182\" y=\"215\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">Forwarded as the upstream sent it</text>\n  <text x=\"182\" y=\"230\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">Do not render it. Still read usage.</text>\n\n  <!-- 右列：Anthropic 格式（橙色），与左列同为 5 行、同基线。 -->\n  <rect x=\"370\" y=\"142\" width=\"321\" height=\"108\" rx=\"6\" fill=\"#fef3c7\" stroke=\"#f59e0b\"/>\n  <text x=\"530.5\" y=\"170\" font-size=\"12\" fill=\"#b45309\" text-anchor=\"middle\">Anthropic</text>\n  <text x=\"530.5\" y=\"185\" font-size=\"10\" fill=\"#b45309\" text-anchor=\"middle\">choices has one item</text>\n  <text x=\"530.5\" y=\"200\" font-size=\"10\" fill=\"#b45309\" text-anchor=\"middle\">delta is empty</text>\n  <text x=\"530.5\" y=\"215\" font-size=\"10\" fill=\"#b45309\" text-anchor=\"middle\">Includes finish_reason</text>\n  <text x=\"530.5\" y=\"230\" font-size=\"10\" fill=\"#b45309\" text-anchor=\"middle\">Includes usage</text>\n\n  <!-- 判据框（粉色，居中），与根框同轴 356.5。 -->\n  <rect x=\"158\" y=\"275\" width=\"397\" height=\"50\" rx=\"6\" fill=\"#fce7f3\" stroke=\"#ec4899\"/>\n  <text x=\"356.5\" y=\"296\" font-size=\"11\" fill=\"#9d174d\" text-anchor=\"middle\">Rule: empty choices or empty delta, skip render, read usage</text>\n  <text x=\"356.5\" y=\"311\" font-size=\"10\" fill=\"#9d174d\" text-anchor=\"middle\">Anthropic is not rewritten into an empty choices frame</text>\n\n  <!-- 脚注 -->\n  <text x=\"356.5\" y=\"345\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">That would add a frame and change how you render.</text>\n</svg>\n"}}