MyRelay

← Back to the notebook

I check one small OpenCode request before coding

Your terminal tool and your model are separate things

OpenCode is a coding assistant that runs in your terminal, the text-based window where you work with development tools. It can help explain a project, suggest changes, and work on code. But OpenCode is not itself the AI model. It sends requests to a model through a provider connection.

That distinction matters when you want to use a relay. Instead of sending requests directly to a model company's service, you point OpenCode at an intermediary that forwards them. Your terminal workflow stays familiar, while the address, credentials, and available models come from the relay.

MyRelay gives an individual developer one key and one pay-as-you-go budget across several model providers. The useful part for a beginner is having one place to inspect usage rather than trying to reconcile several separate accounts.

Gather three details before changing anything

A relay connection needs three pieces of information: an API base address, an API key, and a model identifier. The address tells OpenCode where to send requests. The key authorizes access to your account. The model identifier tells the relay which model should answer.

Create a MyRelay account, then find your API key, available models, and connection instructions. MyRelay's API base is https://api.myapirelay.com. Check its current OpenAI-compatible instructions for the exact base address expected by your client, including whether a version suffix is required. A missing or duplicated suffix can make an otherwise sensible setup fail.

Copy the model identifier from the relay's instructions or model listing rather than guessing it from a display name. A name such as Gemini 2.5 Flash helps you recognize a model, but the identifier accepted by the API may use different spelling.

Choose a provider connection that accepts a custom address

OpenCode supports provider configuration, but the setup details can change between releases. Follow the documentation for your installed version to add a custom OpenAI-compatible provider. This means a connection that uses the OpenAI-style request format while allowing a different service address and key.

Do not assume that choosing a built-in provider and pasting a relay key will redirect traffic. The connection also needs to use the relay's address. Depending on your OpenCode version, adding that connection may involve provider configuration rather than a simple sign-in screen.

Keep the relay key private. Use the credential mechanism recommended by OpenCode, and avoid putting secrets into project material that could be shared or committed. A relay key authorizes spending from your account, so treat it like a password.

After adding the connection, select a model attached to that provider. Before continuing, check that both the selected provider and model are the ones you intended.

Make the first request deliberately small

Start in a small practice project without sensitive material. Ask OpenCode a narrow question, such as explaining one short function without changing anything. Avoid beginning with a request to review an entire repository or build a complete application.

Then inspect the request in MyRelay. Members can see each request's tokens and cost. Tokens are the units used to measure model input and output; more project context and longer answers generally mean more usage. Confirming a real request in the relay's records is more useful than assuming the setup worked because a settings screen accepted your key.

If the request fails, check the address, key, and model identifier first. An authentication error often points to credentials, while an unavailable-model message suggests checking the identifier or account access. Avoid repeatedly retrying a large task while troubleshooting.

Keep each coding session easy to account for

A coding task can trigger several model requests, especially when the assistant reads context, changes files, and checks its work. One prompt does not necessarily mean one charge. Set a personal session allowance, use any available spending controls, and review usage after the first few tasks.

Keep requests focused and inspect changes before asking for more work. The relay simplifies access and accounting; it does not automatically make every task inexpensive. A small first request, followed by a cost check, is a practical habit worth keeping.

More to read