Integrate Thesean With OpenCode

Set up OpenCode to call supported Ship models through Thesean's Anthropic-compatible Messages API.

Ensure you have your Thesean API key from the Thesean Dashboard before continuing.

Prerequisites

Ensure you have OpenCode installed. See the OpenCode installation guide for more options, or use one of the following methods:

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

Configuration

Choose one of the following configuration methods:

Option 1: Global Configuration

This configuration applies to all projects using OpenCode.

Step 1: Store Your API Key

Add your Thesean API key to your shell profile (~/.zshrc, ~/.bashrc, etc.) or a secure location like a .env file:

# Add to ~/.zshrc, ~/.bashrc, etc.
export THESEAN_API_KEY="your-thesean-api-key"

Replace your-thesean-api-key with your actual Thesean API key from the Thesean Dashboard.

Then reload your shell:

source ~/.zshrc  # or source ~/.bashrc etc.

Step 2: Create Global OpenCode Configuration

Create or edit ~/.config/opencode/opencode.json with the following content:

You can also add the API key directly in the config file by replacing {env:THESEAN_API_KEY} with your actual API key. However, using an environment variable is recommended for security.

{
  "$schema": "https://opencode.ai/config.json",
  "model": "thesean-anthropic/ship-like/claude-opus-4-8",
  "provider": {
    "thesean-anthropic": {
      "npm": "@ai-sdk/anthropic",
      "name": "Thesean Ship Models",
      "options": {
        "baseURL": "https://api.thesean.ai/v1",
        "apiKey": "{env:THESEAN_API_KEY}",
        "timeout": 600000
      },
      "models": {
        "ship-like/claude-opus-4-8": {
          "name": "Ship Claude Opus 4.8"
        },
        "ship-like/claude-sonnet-5": {
          "name": "Ship Claude Sonnet 5"
        },
        "ship-like/claude-haiku-4-5": {
          "name": "Ship Claude Haiku 4.5"
        }
      }
    }
  }
}

Option 2: Per-Project Configuration

This configuration applies only to a specific project directory.

Step 1: Store Your API Key

Create a .env file in your project root:

echo "THESEAN_API_KEY=your-thesean-api-key" >> .env
echo ".env" >> .gitignore

Replace your-thesean-api-key with your actual Thesean API key from the Dashboard.

Step 2: Create Project OpenCode Configuration

Create an opencode.json file in your project root with the same configuration content as above. OpenCode will automatically detect and use this config when you run it from the project directory.

Per-project settings override global settings. Use this option if you need different configurations for different projects. See the OpenCode config documentation for more details and Available Models for information about supported Ship models.

Start Using OpenCode

Navigate to your project directory and start OpenCode:

cd your-project
opencode

OpenCode will now call the selected Ship model through Thesean's Anthropic-compatible Messages API. Switch between the two configured models with the /model command within OpenCode.


Next Steps

View Available Models

Review supported Ship models and their pricing.

Read more

View Other Integrations

Explore other ways to integrate Thesean with your development workflow.

Read more