Skip to content

OpenCode

OpenCode is an open-source AI coding assistant that runs in your terminal. It supports the OpenAI-compatible API via environment variables.

Mode

Direct mode only. OpenCode uses the standard OpenAI environment variables and does not support custom headers.

1. Set environment variables

bash
export OPENAI_BASE_URL="https://your-corveil-host/v1"
export OPENAI_API_KEY="sk-citadel-your-key-here"

Add these to your shell profile (~/.zshrc, ~/.bashrc, etc.) for persistence.

2. Launch OpenCode

bash
opencode

Troubleshooting

  • 401 Unauthorized: Verify OPENAI_API_KEY is a valid Corveil virtual API key
  • Connection refused: Ensure OPENAI_BASE_URL includes the /v1 suffix
  • Environment not picked up: Reload your shell (source ~/.zshrc) or set them in the current session