Skip to navigationSkip to main contentSkip to footerScaleway DocsSparklesIconAsk our AI
SparklesIconAsk our AI

Integrating OpenCode with Scaleway's Generative APIs

OpenCode is a coding agent for terminal and IDE. You can integrate Scaleway's Generative APIs models to OpenCode.

Before you start

To complete the actions presented below, you must have:

  • A Scaleway account logged into the console
  • Owner status or IAM permissions allowing you to perform actions in the intended Organization
  • A valid API key for API authentication
  • Installed OpenCode on your local machine

Configure OpenCode using the CLI

  1. Start OpenCode:

    opencode
    CheckCircleOutlineIcon
    Tip

    If command not found displays, ensure you have properly installed opencode and registered the tool in your terminal configuration. After installation, you can launch a new terminal or reload your current terminal configuration with:

    source ~/.bashrc # Or source ~/.zshrc if you use zsh
  2. Press Ctrl + P to display commands.

  3. Type provider to search for commands. Select Connect provider, then press Enter.

  4. Type scaleway to search for providers. Select Scaleway, then press Enter.

  5. Enter your SCW_SECRET_KEY as API key. Press Enter.

  6. Select a model in the list, for instance Qwen3.5 397B A17B.

  7. Type any prompt asking OpenCode to create or update code files. For example:

    "Write a fibonnaci function in python that computes the first 10 fibonnaci numbers"

Configure OpenCode using configuration files

You can configure OpenCode with Scaleway via configuration files. This allows you to reuse a configuration with different credentials.

  1. Create a ~/.config/opencode/opencode.json configuration file with the following content:

    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "scaleway": {
          "options": {
            "apiKey": "{env:SCW_SECRET_KEY}",
            "baseURL": "https://api.scaleway.ai/{env:SCW_PROJECT_ID}/v1"
          }
        }
      }
    }

    Where:

    • SCW_SECRET_KEY stands for the Scaleway API key you generated via the Identity and Access Management dashboard
    • SCW_PROJECT_ID stands for your Scaleway Project identifier, which you can find on your Project Dashboard (click the Copy ID button)

    This configuration requires you to have set SCW_SECRET_KEY and SCW_PROJECT_ID as environment variables in your local terminal or configuration file, such as .zshrc. You can check that both these values are configured with the following command in your terminal:

    echo $SCW_SECRET_KEY
    echo $SCW_PROJECT_ID

    Both configured values should display.

  2. Start OpenCode:

    opencode

    The OpenCode terminal appears.

    CheckCircleOutlineIcon
    Tip

    If command not found displays, ensure you have properly installed OpenCode and registered the tool in your terminal configuration. After installation, you can launch a new terminal or reload your current terminal configuration with:

    source ~/.bashrc # Or source ~/.zshrc if you use zsh
  3. Press Ctrl + P to display commands.

  4. Select Switch model.

  5. Under Scaleway, select any model in the list, for instance Qwen3.5 397B A17B.

  6. Type any prompt asking OpenCode to create or update code files. For example:

    "Write a fibonnaci function in python that computes the first 10 fibonnaci numbers"

For more details about configuration files, see OpenCode's documentation about configuration options when using a JSON configuration file.

Going further

  • You can explore additional OpenCode features in OpenCode's documentation.
  • By default, requests are sent to https://api.scaleway.ai/v1 and performed on your Scaleway default Project. If you want to perform requests on a specific Project (for instance, to track specific billing), edit the OpenCode JSON configuration file and add the Project identifier to the URL https://api.scaleway.ai/###PROJECT_ID###/v1.
SearchIcon
No Results