MixMedia API
API keys Sign inTry it
MixMedia Sign in
Open as Markdown

OpenCode: how to connect Grok, Claude, GPT and Gemini

Step-by-step: install OpenCode, get a MixMedia key, paste the ready opencode.json, pick Grok 4.7 or another model, and run.

OpenCode is a coding app for the terminal and VS Code. The shortest path: a key from the site, one config file, and the Grok 4.7 model (or any other in the list).

The same walkthrough on the website: Open on mixmedia.tech.

1. Install OpenCode

On macOS and Linux:

curl -fsSL https://opencode.ai/install | bash

On Windows, or if you prefer npm (Node.js required): npm install -g opencode-ai. The OpenCode VS Code extension reads the same config file.

2. Get a key

Sign in at mixmedia.tech, open Dashboard → API keys, click “Create key” and copy it. If the balance is empty, top up with a card or SBP.

3. Paste the settings

Create ~/.config/opencode/opencode.json (Windows: %USERPROFILE%\.config\opencode\opencode.json). Create the folder if it is missing. Paste this:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "mixmedia": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "MixMedia",
      "options": {
        "baseURL": "https://api.mixmedia.tech/v1",
        "apiKey": "{env:MIXMEDIA_API_KEY}"
      },
      "models": {
        "grok-4.7": {
          "name": "Grok 4.7"
        },
        "grok-4.6": {
          "name": "Grok 4.6"
        },
        "claude-opus-5-5": {
          "name": "Claude Opus 5.5"
        },
        "claude-sonnet-5-5": {
          "name": "Claude Sonnet 5.5"
        },
        "claude-haiku-5-5": {
          "name": "Claude Haiku 5.5"
        },
        "claude-fable-5.2": {
          "name": "Claude Fable 5.2"
        },
        "gpt-6-astra": {
          "name": "GPT-6 Astra"
        },
        "gpt-6.1-sol": {
          "name": "GPT-6.1 Sol"
        },
        "gpt-6.2-sol": {
          "name": "GPT-6.2 Sol"
        },
        "gpt-6.2-astra": {
          "name": "GPT-6.2 Astra"
        },
        "gpt-5.6": {
          "name": "GPT-5.6"
        },
        "gemini-4-argon": {
          "name": "Gemini 4 Argon"
        },
        "gemini-3.8-flash": {
          "name": "Gemini 3.8 Flash"
        },
        "gemini-3.7-flash": {
          "name": "Gemini 3.7 Flash"
        },
        "gemini-4-carbon": {
          "name": "Gemini 4 Carbon"
        },
        "gemini-4-hydrogen": {
          "name": "Gemini 4 Hydrogen"
        },
        "deepseek-v4-pro": {
          "name": "DeepSeek V4 Pro"
        },
        "deepseek-v4.1-flash": {
          "name": "DeepSeek V4.1 Flash"
        }
      }
    }
  },
  "model": "mixmedia/grok-4.7"
}

Then set the key in an environment variable (so it does not sit in the file):

export MIXMEDIA_API_KEY="sk-aim-YOUR_KEY"

On Windows PowerShell:

[Environment]::SetEnvironmentVariable("MIXMEDIA_API_KEY", "sk-aim-YOUR_KEY", "User")

Grok 4.7 is first in the list, then Grok 4.6, then the other coding models. Live list and prices: https://api.mixmedia.tech/v1/models

4. Launch and pick a model

cd your-project
opencode

Type /models and pick mixmedia/grok-4.7 (or mixmedia/grok-4.6). Or run a single command:

opencode run -m mixmedia/grok-4.7 "fix the bug in calc.py"

If it does not work

  • 401 — the key is incomplete or deleted, or MIXMEDIA_API_KEY is not visible to the app. Restart the terminal, or put the key in the apiKey field of the config file.
  • MixMedia models are missing — check the path to opencode.json and that it is valid JSON (no trailing comma).
  • Insufficient funds — top up in the Dashboard.
  • Each request is listed in the Dashboard.

Try the same models on the website or see prices.

© 2026 MixMedia