> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tulipai.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat with a model

> Select a Tulip model, fund an inference permit, and send a metered request.

Tulip's Chat interface uses the Gateway's OpenAI-compatible endpoint. You pay the selected provider in the model's canonical credits.

<img src="https://mintcdn.com/tulip-deb4c703/nT1XruOdz2fXLJp_/images/app/inference-chat.png?fit=max&auto=format&n=nT1XruOdz2fXLJp_&q=85&s=4afd018b0ec21d6c2d380c5fed7760db" alt="Chat with a gateway-active model" width="2076" height="1313" data-path="images/app/inference-chat.png" />

*Choose a gateway-active model and review its provider market before sending a request.*

## Use the frontend

<Steps>
  <Step title="Hold credits">
    Buy or receive the canonical credit for the model you want to use.
  </Step>

  <Step title="Fund a permit">
    Open **Credits**, select the market, and deposit enough credit to cover your expected requests. Leave provider selection open unless you require one specific offer.
  </Step>

  <Step title="Select the model">
    Open **Chat** and use the model picker. In version 1, review the pinned Hugging Face model link and available provider count.
  </Step>

  <Step title="Send a message">
    Choose the funded permit, enter your prompt, and submit. A sleeping endpoint may take longer and may add the provider's published wake fee.
  </Step>

  <Step title="Inspect the result">
    The response is returned in the upstream OpenAI-compatible format. Tulip response headers identify the request, quote, provider offer, tariff version, and non-streaming credit charge.
  </Step>
</Steps>

## Request headers

| Header                    | Required  | Purpose                                          |
| ------------------------- | --------- | ------------------------------------------------ |
| `Authorization: Bearer …` | Yes       | Authenticates the Tulip API client.              |
| `X-Tulip-Permit`          | Yes       | Selects the model-bound escrow permit.           |
| `X-Tulip-Quote`           | No        | Reuses a valid quote for the exact same request. |
| `Idempotency-Key`         | Supported | Identifies a client request across retries.      |

## Streaming

Set `stream: true` to receive server-sent events. The upstream stream must include terminal usage. If usage is missing or the client disconnects before completion, Tulip marks the request failed and releases the reservation rather than estimating a charge.

## Common failures

<AccordionGroup>
  <Accordion title="No eligible provider offer">
    No active verified endpoint can currently serve the request. The model credit can continue trading even when inference is temporarily unavailable.
  </Accordion>

  <Accordion title="Insufficient credits">
    The permit's unreserved balance is lower than the maximum quoted charge. Top up the permit or reduce the maximum completion tokens.
  </Accordion>

  <Accordion title="Offer mismatch">
    The quote selected an offer different from the one pinned by the permit.
  </Accordion>

  <Accordion title="Quote conflict or expiry">
    Quotes expire after 60 seconds and are bound to the exact request body. Request a new quote after changing messages or generation settings.
  </Accordion>
</AccordionGroup>
