{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"What this solves"}]},{"type":"text","value":": How to send your first successful model request with Tare."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If you don't have an account or key yet, read "},{"type":"element","tagName":"a","properties":{"href":"before-key"},"children":[{"type":"text","value":"Before you start"}]},{"type":"text","value":" first. If you already have an Inference key, just follow the steps below."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"What you need to prepare"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"A working Tare account."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"An "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Inference key"}]},{"type":"text","value":". Be careful not to use a Provisioning key or a Reconciliation key; the three key types have different permissions, and the wrong type gets rejected outright."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"A working model name, such as one visible in the console or in "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"GET /v1/models"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Your server can reach "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"https://tare.jamerly.ai"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{"data-alert":"note"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The full key plaintext "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"is shown only once, at creation time"}]},{"type":"text","value":"; the platform stores only a hash, and the list then shows only a mask like "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"ak-…3f2a"}]},{"type":"text","value":". Save it in your server-side secret management system, not in browser frontend code."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"1. Create an Inference key"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Console path:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"Console → Tare → API Keys → Create\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Choose "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Inference"}]},{"type":"text","value":" as the type. Write the name so its purpose is clear, for example "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"support-bot-production"}]},{"type":"text","value":". After creating it you'll see the full key; copy and save it."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"2. Change two configs, send a request"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Any OpenAI-compatible client works by changing these two configs:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"table","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"thead","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Config"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Value"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"base_url"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"https://tare.jamerly.ai/v1"}]}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"api_key"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Your Inference key"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"curl"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"curl https://tare.jamerly.ai/v1/chat/completions \\\n  -H \"Authorization: Bearer $TARE_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"GLM 5.1\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"hello\"}]\n  }'\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"Python (OpenAI SDK)"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-python"]},"children":[{"type":"text","value":"import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https://tare.jamerly.ai/v1\",\n    api_key=os.environ[\"TARE_API_KEY\"],\n)\n\nresp = client.chat.completions.create(\n    model=\"GLM 5.1\",\n    messages=[{\"role\": \"user\", \"content\": \"hello\"}],\n)\nprint(resp.choices[0].message.content)\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"Which name to put in "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"model"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Put the "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"platform-side model name"}]},{"type":"text","value":", not the name on the upstream provider's side. Tare is responsible for mapping between the two."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{"data-alert":"note"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The response always carries the name you requested. Even if a failover switches the upstream mid-flight, you never receive a model name you didn't request."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"3. How to tell you're connected"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"HTTP returns 200."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"The model produced content."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"The response headers include "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"X-Generation-Id"}]},{"type":"text","value":", or the response contains a "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"gen-..."}]},{"type":"text","value":" ID."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Later you can use "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"GET /v1/generation?id=gen-..."}]},{"type":"text","value":" to check this call's cost and latency."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{"data-alert":"note"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Querying "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"immediately"}]},{"type":"text","value":" after getting the ID may return 404, because the usage record is written after the response. "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Treat any 404 within 60 seconds of receiving the ID as \"not written yet, check again later\"."}]}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"4. Streaming calls"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Pass "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"stream: true"}]},{"type":"text","value":" in the request; it returns an SSE stream ending with "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"data: [DONE]"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Two kinds of upstream API don't natively send this terminator: Anthropic and OpenAI's own Responses API. Tare adds it for you in both cases."}]},{"type":"text","value":" Without it, a client that hand-parses SSE (rather than a standard SDK that recognizes each vendor's own end-of-stream signal) will keep waiting after the last frame of real content."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{"data-alert":"tip"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Usage is in the "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"last frame"}]},{"type":"text","value":". Tare forces "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"stream_options.include_usage"}]},{"type":"text","value":" on and overrides your setting, because without usage there's no billing or attribution."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{"data-alert":"warning"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Before the first byte, you may receive several SSE comments (lines starting with "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":"}]},{"type":"text","value":")."}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"For calls with large inputs, the upstream has to finish reading the prompt before it starts generating, so the first byte can take tens of seconds (in measurements, a good number beyond the median exceed 10 seconds, with the slowest approaching 80 seconds). During this time there are no bytes on the connection, and the client and proxies along the way will treat it as a dead connection and kill it. After about 5 seconds of silence, Tare starts sending an SSE comment every few seconds, so every hop knows the connection is still alive."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The SSE spec requires parsers to "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"ignore"}]},{"type":"text","value":" lines starting with "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":"}]},{"type":"text","value":", so standard SDKs need to do nothing. "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Only hand-written parsing clients need to pay attention"}]},{"type":"text","value":": don't treat comment lines as data frames to JSON-parse. The last frame may also contain only usage, with no renderable text."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"img","properties":{"src":"diagram:en-quickstart-sse-sequence","alt":"Streaming calls: the silence before the first byte, and why Tare sends comments for the upstream","data-block":"true"},"children":[]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"Common issues"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"table","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"thead","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Symptom"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Common cause"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"What to do"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"401"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Key doesn't exist, is disabled, or has expired"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Reconfirm the key plaintext and its state"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"403"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Wrong key type, or a quota / budget / source IP / DLP block"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"First confirm it's an Inference key, then check "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"metadata.refusal_reason"}]}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"404"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"No route configured for the model name, or the record isn't written yet"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Check "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"GET /v1/models"}]},{"type":"text","value":"; generation queries can be retried within 60 seconds"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"429"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Rate limit triggered"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Retry per "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"Retry-After"}]}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Streaming stalls"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Hand-written parser doesn't ignore comment lines, or a proxy timeout"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Ignore lines starting with "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":"}]},{"type":"text","value":"; check the proxy's SSE config"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"Next steps"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"To use Tare from coding tools such as Claude Code, Codex or Cursor: read "},{"type":"element","tagName":"a","properties":{"href":"coding-tools"},"children":[{"type":"text","value":"Coding tools"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"To connect your own provider: read "},{"type":"element","tagName":"a","properties":{"href":"channels"},"children":[{"type":"text","value":"Channels"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"To make a given model go through a chosen channel: read "},{"type":"element","tagName":"a","properties":{"href":"routing"},"children":[{"type":"text","value":"Routing"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"To break down cost by customer or business line: read "},{"type":"element","tagName":"a","properties":{"href":"attribution"},"children":[{"type":"text","value":"Cost attribution"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"}]}]}