Skip to content

free-tier: Free usage limit reached follows the session ID; forks work #59280

Closed as not planned

Description

@Theodore-Gara

Summary

Free models return AI_APICallError: Free usage limit reached when I send a prompt to an existing session, but the same prompt to a fork of that session (new session ID, byte-identical history) succeeds in the same minute with the same model and account. New sessions always work. The rejection follows the session ID, not the account, model, directory or content.

Environment

  • opencode version: CLI 1.19.4, desktop 2.1.4
  • OS: Windows 11, 10.0.26300 (win32 x64)
  • Terminal: OpenCode Desktop (Electron); CLI tests in xterm-256color
  • Shell: C:\Windows\system32\cmd.exe
  • Install/channel: npm global (opencode-ai@1.19.4) and desktop latest
  • Active plugins: .opencode/plugins/graphify.js, @dietrichgebert/ponytail

Reproduction

  1. Have an existing session that has been used for a while with a free model (I see it with opencode/deepseek-v4.1-flash-free and opencode/big-pickle).

  2. Resume it:

    opencode run -s <sessionID> -m opencode/deepseek-v4.1-flash-free "Reply with exactly: TEST"
  3. The stream fails immediately with Free usage limit reached; the assistant message is stored with tokens.output = 0 and no parts.

  4. Fork the same session:

    opencode run -s <sessionID> --fork -m opencode/deepseek-v4.1-flash-free "Reply with exactly: TEST"
  5. The new <title> (fork #1) session accepts the request and replies normally.

  6. Resume the original again: it fails again, while the fork continues to work.

Expected Behavior

Resuming a session should behave exactly like resuming its fork: history loads and the request is accepted.

Actual Behavior

A/B run at the same time, same account, same model, same directory:

Session Result
ses_0d73c9ee… original, 10:03 stream error … Free usage limit reached
ses_0d73c9ee… fork, 09:56 answered
ses_0c26f2d8… original, 09:41 Free usage limit reached
ses_0c26f2d8… fork (3600 messages), 09:59 request accepted, streaming + tool calls

New sessions in the same directory with the same model work while the old session is rejected.

Things that do not change the result:

  • Switching free models (both deepseek-v4.1-flash-free and big-pickle are rejected on the old ID).
  • Rebuilding the session storage: opencode export <id> > s.json && opencode import s.json rewrites all message/part rows, and the same ID is still rejected.
  • Changing the session directory.

Things that do change the result:

  • --fork (new session ID, identical messages), or starting a new session.

Additional Context

Log lines (paths and IDs shortened):

timestamp=2026-10-26T10:03:40.509Z level=INFO  message=stream  providerID=opencode modelID=deepseek-v4.1-flash-free session.id=ses_0d73c9ee… small=false agent=build mode=primary
timestamp=2026-10-26T10:03:41.620Z level=ERROR message="stream error" providerID=opencode modelID=deepseek-v4.1-flash-free session.id=ses_0d73c9ee… error.error="AI_APICallError: Free usage limit reached. Free models work in OpenCode (https://opencode.ai); subscribe to OpenCode Go to keep going: https://opencode.ai/go"

timestamp=2026-10-26T09:56:13.658Z level=INFO message=process session.id=ses_e885c7aa… messageID=msg_…
timestamp=2026-10-26T09:56:13.662Z level=INFO message=stream  providerID=opencode modelID=deepseek-v4.1-flash-free session.id=ses_e885c7aa… small=false agent=build mode=primary
timestamp=2026-10-26T09:56:19.345Z level=INFO message=loop    session.id=ses_e885c7aa… step=1
timestamp=2026-10-26T09:56:19.359Z level=INFO message="exiting loop" session.id=ses_e885c7aa…

Other notes:

  • The database is a restored backup, so it contains both storage generations (session_message and message/part). 438 of 440 old sessions already have rows in the current tables, and export/import converts the remaining two, so legacy storage is not the cause. The failure follows the session ID across both generations.
  • The desktop shows this as "You've used today's free messages", which sent me looking at quota for days. The account was not out of free usage.
  • Separately, opencode run on these older/forked sessions often does not exit after the reply is already written to the DB (the request completes, no output is printed, the process hangs). I can file that separately if it is not the same bug.

Related: #59252, #58284, #57540.

If the free lane actually keeps a per-session ledger, could the error be made explicit (e.g. "this conversation reached its free limit — fork or start a new session")? Right now it reads as an account-wide quota and is indistinguishable from a real one.

Activity

  1. opencode-agent commented on Oct 26, 2026

    @opencode-agent
    Contributor

    Thanks for the careful A/B testing, @Theodore-Gara. Comparing each session with its fork makes the pattern very clear.

    Your reproduction steps and logs come from the CLI 1.19.4 (opencode-ai), which is OpenCode v1 (versions 0.x and 1.x). v1 only gets fixes for critical bugs such as data loss, security problems or breakage with no workaround. Here forking or starting a new session gets you going again, so this is unlikely to be fixed in v1. The same goes for the opencode run hang you mentioned, if it only happens on 1.19.4.

    We recommend moving to v2 (@opencode/cli, the opencode command, or Desktop 2.x). v2 may behave differently here: a v2 fork sends its source session's ID as the session affinity for model requests, so "fork and it works" may not hold the same way. Also, how much free usage you have and how it's counted is decided by the OpenCode Zen service, not by the app.

    These issues are ordered from most to least likely to be related:

    If you can reproduce this on v2 (an old session fails while its fork or a new session works, with the v2 version and logs), or if you think it's critical, please reply here and we'll take another look.

  2. vedikarya commented on Oct 26, 2026

    @vedikarya

    https://opencode.ai/download/ try updating to v2 now from this link

  3. opencode-agent commented on Oct 27, 2026

    @opencode-agent
    Contributor

    Closing this as not planned, @Theodore-Gara. The reproduction and logs are from the v1 CLI 1.19.4. v1 only gets critical fixes, and forking or starting a new session works around the problem. We haven't heard of it happening on v2, so we're closing it now.

    If you can reproduce it on v2 (@opencode/cli or Desktop 2.x), please open a new issue. Include the v2 version, the logs, and an old session that fails while its fork or a new session works. #58751 and #57540 track how free-tier requests are counted on v2, including large-context sessions being refused. Thanks again for the careful A/B testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions