[Bug] "OpenCode's free tier can only be used from within OpenCode" error when using Custom Agents · Issue #50081 · anomalyco/opencode · GitHub
Skip to content

[Bug] "OpenCode's free tier can only be used from within OpenCode" error when using Custom Agents #50081

Closed as not planned

Description

@zzjcnn

Description

Describe the bug
I am encountering an error when attempting to use a custom agent configuration within OpenCode. The request fails, and the console outputs the following error message:

Error from provider (Console): OpenCode's free tier can only be used from within OpenCode

To Reproduce
Configure a custom agent (e.g., modifying the configuration to use a specific model or custom prompt).

Trigger the agent within the OpenCode environment.

Observe the error in the console output.

Expected behavior
The custom agent should execute normally using the available free tier, as it is being invoked from within the OpenCode application.

Actual behavior
The provider rejects the request, stating that the free tier can only be used "within OpenCode," despite the request originating from the OpenCode client.

Additional Context
It appears the provider's validation logic might be incorrectly identifying the custom agent request as an external or unauthorized source.

Attached is a screenshot of the specific error message.

Plugins

No response

OpenCode version

1.18.31

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. zzjcnn commented on Sep 20, 2026

    @zzjcnn
    Author
    Image
  2. Neloy-Barman commented on Sep 20, 2026

    @Neloy-Barman

    I ran into this same issue yesterday while trying to run a custom agent. After digging around, it looks like this is a known side effect of OpenCode's V1 → V2 migration — agent configs defined the old way won't work under V2 without updating the permission format.

    For reference, here's a simple code reviewer agent definition:

    V1 (old) permission format:

    ---
    description: Primary review agent that validates implementation quality and creates comprehensive test scenarios
    mode: primary
    model: opencode/mimo-v2.5-free
    temperature: 0.1
    permission:
      read: allow
      edit: deny
      bash: deny
    ---
    
    You are the Primary Review Agent responsible for validating implementation quality and creating comprehensive test scenarios.

    V2 (new) permission format:

    ---
    description: Primary review agent that validates implementation quality and creates comprehensive test scenarios
    mode: primary
    model: opencode/mimo-v2.5-free
    permissions:
      - action: read
        resource: "*"
        effect: allow
      - action: edit
        resource: "*"
        effect: deny
      - action: bash
        resource: "*"
        effect: deny
    ---
    
    You are the Primary Review Agent responsible for validating implementation quality and creating comprehensive test scenarios.

    Switching to the V2 permission block (array of {action, resource, effect} objects instead of the flat permission map) fixed it for me. This isn't a bug on OpenCode's end — it's purely a migration issue on the agent config side.

    Docs: https://opencode.ai/v2/docs/migrate-v1/#permissions-and-tools

  3. qstmenu commented on Sep 20, 2026

    @qstmenu

    Got the same issue when running the "opencode agent create" command to make custom agent.

    Image
  4. Neloy-Barman commented on Sep 20, 2026

    @Neloy-Barman

    @qstmenu, try creating the agent config manually instead of using CMD.

  5. Drasenix commented on Sep 21, 2026

    @Drasenix

    @Neloy-Barman Thank you ! It worked for me !

  6. Neloy-Barman commented on Sep 21, 2026

    @Neloy-Barman

    @Drasenix Welcome.

  7. marco-rionaut commented on Sep 22, 2026

    @marco-rionaut

    Reproduces on 2.0.12 (macOS, Homebrew) — and the trigger narrows down to the agent's deny permissions, not the permission format. The V2 permissions array does not fix it here:

    agent permissions result
    f4noperm none bereit (works)
    f4deny V2 array: edit+shell → deny 403
    f4denyv1 V1 map: edit: deny, bash: deny 403

    Minimal repro:

    1. .opencode/agent/deny.md
      ---
      description: repro
      mode: primary
      permissions:
        - {"action": "edit", "resource": "*", "effect": "deny"}
        - {"action": "shell", "resource": "*", "effect": "deny"}
      ---
    2. printf 'Reply with one word: ok' | opencode run --standalone --model opencode/muse-spark-1.3-contributor-free --format json --agent deny
    3. → {"type":"error","error":{"type":"provider.auth","message":"Error from provider (Console): OpenCode's free tier can only be used from within OpenCode","status":403}}

    The same invocation with --agent build (or an agent without denies) answers normally; --standalone makes no difference.

    Environment: opencode v2.0.12 (Homebrew opencode-v2), macOS 27.0 arm64. Suspect: with tools stripped by deny, the request no longer passes the console-side origin check.

  8. sekedus commented on Sep 22, 2026

    @sekedus

    see my workaround here.

  9. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

  10. SC0d3r commented on Oct 17, 2026

    @SC0d3r
    Image

    I am constantly getting this error in opencode version v2.0.32
    and i am not using any agent, its just a simple default build mode in opencode v2

  11. sixfingerdev commented on Oct 18, 2026

    @sixfingerdev

    me too, in opencode 2

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions