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

# OpenCode plugin

> Track AI coding analytics — cost, tokens, models, and git context — from OpenCode sessions with the Periscope analytics plugin.

The Periscope OpenCode plugin captures analytics events from your [OpenCode](https://opencode.ai) coding sessions and sends them to Periscope. This gives your team visibility into AI coding tool usage — which models are used, how many tokens are consumed, what it costs, and how AI-assisted work connects to your git history.

## What it captures

For each AI assistant message in your OpenCode session, the plugin records:

| Data                   | Description                                                                                     |
| ---------------------- | ----------------------------------------------------------------------------------------------- |
| **Model and provider** | Which LLM model and provider was used (e.g., Claude Sonnet 4 via Anthropic)                     |
| **Token usage**        | Input tokens, output tokens, reasoning tokens, cache reads, and cache writes                    |
| **Cost**               | Dollar cost of the interaction                                                                  |
| **Git context**        | Repository URL, branch name, and current commit SHA                                             |
| **Commit detection**   | When a `git commit` or `git merge` happens during a session, the plugin captures the commit SHA |
| **Session metadata**   | Session ID, title, agent type, whether it is a sub-agent                                        |

<Info>
  Periscope is currently in private beta. Installation instructions will be available once you have access. [Join the waitlist](https://tally.so/r/MeAqPM) to get early access.
</Info>

## How it works

The plugin runs in the background during your OpenCode session. It does not interfere with the assistant or slow down your workflow.

* **After each assistant message**, the plugin extracts model, provider, token counts, cost, and git context, then sends an analytics event to Periscope asynchronously.
* **When a git commit or merge happens**, the plugin detects the commit SHA and associates it with your session. This is how Periscope connects AI-assisted coding to specific commits — enabling traceability from "AI wrote this code" to "this commit was deployed."

## Privacy and security

* The plugin **does not** send code content, file contents, or conversation messages to Periscope
* Only metadata (model, tokens, cost, git refs) is captured
* Authentication uses industry-standard OAuth 2.0
* All data is transmitted over HTTPS

<Card title="Get early access" icon="clock" href="https://tally.so/r/MeAqPM">
  Join the waitlist to get access to the OpenCode plugin and AI coding analytics.
</Card>
