Latency & cold starts
Time to first token includes waiting for capacity, starting an idle model, and processing your prompt. Model size, hardware, prompt length, and current demand all affect it.
Cold starts
| Model state | What to expect |
|---|---|
| Already running | Requests can join available capacity without starting the model again. |
| Idle | The first request needs capacity and model preparation. Allow more time than for a running model. |
| At capacity | The request may wait for a GPU, even if the model is already running. Requests wait up to three minutes before refusal. |
Reduce waiting
| Use | Benefit and tradeoff |
|---|---|
| Streaming | Show tokens as they arrive. This improves perceived response time but does not remove a cold start. |
| Longer idle hold | Bridge short gaps between requests on your deployment. Holding GPUs costs money even when no request is running. |
| Reserved capacity | Keep GPUs allocated to your organization. It bills while idle and does not keep every model loaded. |
| Conversation caching | Reuse repeated prompt prefixes when available. A conversation key helps routing but does not guarantee a cache hit. |
Configure hold and capacity on your deployments. For a dataset that can wait, use batch inference.
Client timeouts
If your workflow can wait through the full capacity window, set a timeout above three minutes. For an interactive app, choose a deadline that fits your user experience and handle timeout errors. A timeout does not prove that no work was billed.
Stream and reuse conversation prefixes
With the OpenAI SDK installed, use your app’s server-side key and replace support-agent with your model. Reuse prompt_cache_key for turns of the same conversation and send the conversation history on every request. The key does not store that history for you.
from openai import OpenAI
client = OpenAI(
base_url="https://api.boardwalk.cloud/v1",
api_key="your-api-key",
timeout=240,
max_retries=0,
)
with client.chat.completions.create(
model="support-agent",
messages=[{"role": "user", "content": "Explain prefix caching."}],
prompt_cache_key="conversation-8421",
max_completion_tokens=256,
stream=True,
) as stream:
for chunk in stream:
if chunk.choices:
print(chunk.choices[0].delta.content or "", end="", flush=True)
print()Interruptions can leave partial output and no final usage event in the stream. Avoid replaying tool calls or displaying a retry as a continuation. See stream failures and retries.
Long context
Prompt and output share the context window, including reasoning. Trim unnecessary history and use tokenization to check the prompt size. Keep reusable instructions at the start of the prompt to help prefix caching.
Measure your workload
Compare first-token and total latency in the console and request receipts. Measure realistic prompts and traffic, including requests after idle periods. For your own deployment, separate capacity wait from cold-start time before changing settings.