OpenCode is a claude code alternative that has quickly gained in popularity and is recommended by many of the top thought leaders in the AI space Using Portkey to track costs for OpenCode is simple and one step setup because Portkey is openAI compatible.Documentation Index
Fetch the complete documentation index at: https://portkey-docs-log-export-guide-1773064217.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Setup
We use the custom provider option from opencode to integrate with Portkey.- In your OpenCode settings (usually located at
~/.config/opencode/opencode.jsonin macos, check https://opencode.ai/docs/config/#locations) configure the following:
your-integration-name is the name of the integration you have configured in Portkey and your-model-name is the name of the model you are using.
-
Start opencode and execute the
/connectcommand and select Portkey as the provider (if you are prompted for api key you can enter a dummy string) -
That is all xd, now you can track costs in your portkey dashboard and see your usage in real time.


