Skip to main content
OpenCode is a terminal-based AI coding agent. You can point it at Consus Gateway to get Claude in your terminal while keeping all traffic within government-authorized cloud environments.

1. Set Your API Key

Add your Consus Gateway API key as an environment variable:
Add this to your ~/.zshrc or ~/.bashrc to persist it.

2. Configure OpenCode

Add the following to your opencode.json config file:

3. Select the Model

Launch OpenCode and use the /models command to verify Consus Gateway models appear. Select one and start coding.
That’s it. Your requests now route through Consus Gateway to government-authorized cloud infrastructure. Streaming, tool use (file reads, writes, shell commands), multi-turn conversations, and image input all work out of the box.

Image & PDF Input

Claude and Gemini models support images and PDF documents. The config above already includes the required fields:
  • attachment: true: enables file/image attachments in OpenCode’s UI
  • modalities.input: ["text", "image", "pdf"]: tells OpenCode the model accepts image and PDF input
Note: These fields are required for custom providers. Without them, OpenCode intercepts attachments client-side and replaces them with an error before they ever reach the server. They are currently undocumented in the official OpenCode docs.
Paste a screenshot (Ctrl+V / Cmd+V) or attach a PDF using the attachment button. Images and files must be under 3.5 MB each; total base64 data per message (images + files combined) must be under 4.5 MB (enforced by the gateway’s request payload limit). Only application/pdf is supported for file attachments.