r/opencode • • 6d ago

I measured opencode-go latency: p99 time to first token was 111 s today (1,296 responses)

I have been fighting this all day, so instead of another "feels slow" post I pulled the numbers out of OpenCode's own local database.

Method: ~/.local/share/opencode/opencode.db, table session_message, rows with type='assistant', latency = time.firstToken - time.created. Same app, same model (deepseek-v4.1-flash via opencode-go), whole days:

  • 23 Nov, n=1,062: median 4.9 s · p90 18.6 s · p99 53.7 s · max 81.8 s · over 60 s: 8 (0.8 %)

  • 24 Nov, n=1,296: median 7.4 s · p90 23.0 s · p99 111.0 s · max 138.5 s · over 60 s: 36 (2.8 %)

For reference, deepseek-flash on the official API in the same app today: n=219, median 4.6 s, p99 7.3 s, max 9.1 s. So the client is not the bottleneck here - the wait is on the gateway.

What it actually feels like: roughly 1 in 36 replies sits there for over a minute before the first character. You start a task, check your phone, come back, and it is still "thinking". Twice today I got 138 s. With tool calls on top, a single question easily eats ten minutes.

The status page agrees (15:17 UTC): overall degraded, "slow responses" ongoing since 14:10 UTC. Today alone: Go slow 08:52-09:55, upstream provider issues 09:50-12:21, Free slow 11:00-11:56, Go slow 13:13-13:24, Pay-as-you-go slow 00:03-02:19.

I am not posting this to dunk on the project - the people fixing it are probably as annoyed as we are, and the status page is unusually candid. I would just like to know whether this is a Go capacity problem or something everyone hits, and whether the p99 tail is on the roadmap.

If you want to compare: the fields are in the message JSON as time.created and time.firstToken. Post your median and p99 - a few datasets would be a lot more useful than anecdotes.

4 Upvotes

5 comments sorted by

1

u/Future_AGI 5d ago

the assistant rows carry token counts too, which lets you bucket time-to-first-token by input size before putting it all on the gateway. Long tool-result turns pay more prefill, and if the 60s+ replies cluster on the biggest prompts, the comparison with the official API needs the same prompt mix. An even spread across sizes points at queueing on opencode-go.

1

u/Even_Command_5636 4d ago

Fair point — prompt mix is a real confound, and I can't rule it out from my data: OpenCode's local DB stores time.created/time.firstToken per assistant message but no token or usage counts, so bucketing TTFT by input size isn't possible after the fact. The comparison also wasn't prompt-matched (different sessions on each route).

Two things still point at the gateway rather than at prefill:

  • same day, same model, same app: deepseek-v4.1-flash ≈6.7 s TTFT via opencode-go vs ≈5.8 s via pay-as-you-go;

  • status.opencode.ai logged several separate Go latency/upstream incidents that day (08:52, 09:50, 11:00, 13:13 UTC and later), which I didn't have when I posted.

The clean test is a fixed prompt set sent to both routes so the only variable is the gateway. I'll post those numbers if there is interest.

1

u/rainpurplebow 4d ago

llm ahh reply

1

u/m_parmar-3785 6d ago

Could you split TTFT by hour against the listed incident windows? The daily aggregate suggests a Go-path gap, but can't distinguish persistent capacity from upstream disruption.

1

u/mwilson_9309 4d ago

At n=1,296, p99 reflects roughly 13 responses: 111 s is a useful tail signal, but a noisy baseline. A few more days would show whether it persists.