---
title: Adding AI to Claude Code using Generative APIs
description: Learn how to integrate AI-powered code models into Claude Code with Scaleway's Generative APIs.
tags: generative-apis ai machine-learning language-models code-assistance claude-code y-router
dates:
  validation: 2026-01-08
  posted: 2026-01-08
---
import Requirements from '@macros/iam/requirements.mdx'

Claude Code is a coding agent for terminal and IDE. With the help of a proxy like y-router, you can integrate Scaleway's Generative APIs models with Claude Code.

<Requirements />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- A valid [API key](/iam/how-to/create-api-keys/) for API authentication
- Installed [Claude Code](https://claude.com/product/claude-code) on your local machine

## Setting up y-router as a proxy

To connect Claude Code to Scaleway's Generative APIs, you will use y-router as a lightweight proxy. y-router is an open-source Cloudflare worker that translates between Anthropic's Claude API and OpenAI-compatible APIs.

### Clone and configure y-router

1. Clone the y-router repository:
   ```bash
   git clone https://github.com/luohy15/y-router
   cd y-router
   ```

2. Edit the `wrangler.toml` file and add the following configuration:
   ```toml
   [vars]
   OPENROUTER_BASE_URL = "https://api.scaleway.ai/v1"
   ```

3. Start the proxy:
   ```bash
   docker compose up -d
   ```
   You can verify the router is running correctly by performing a query or opening [http://localhost:8787/](http://localhost:8787/) in your browser. You should see a page displaying `Claude Code + OpenRouter`.

### Configure Claude Code

1. Verify Claude Code is installed on your local computer:
   ```bash
   claude -v
   ```
   This command should display the Claude Code version:
   ```bash
   2.1.1 (Claude Code)
   ```
 
2. Add the following environment variables to your `.bashrc` file:
   ```bash
   export ANTHROPIC_DEFAULT_HAIKU_MODEL=qwen3.5-397b-a17b
   export ANTHROPIC_SMALL_FAST_MODEL=qwen3.5-397b-a17b
   export ANTHROPIC_MODEL=qwen3.5-397b-a17b
   export ANTHROPIC_BASE_URL=http://localhost:8787
   export ANTHROPIC_AUTH_TOKEN="<SCW_SECRET_KEY>"
   export ANTHROPIC_DEFAULT_SONET_MODEL=qwen3.5-397b-a17b
   ```

3. Reload your shell configuration:
   ```bash
   source ~/.bashrc
   ```

## Using Claude Code with Scaleway's Generative APIs

Once configured, you can start using Claude Code with Scaleway's Generative APIs:

1. Launch Claude Code:
   ```bash
   claude
   ```

2. Select your prefered theme and press `Enter`.

3. Select whether you trust the files in the current folder.

4. Type any prompt to get started using models running on Scaleway Generative APIs.
   You can verify if the configuration is correct by typing `/models`. The list of models should display, including `qwen3.5-397b-a17b` as defined in the environment variables.

   If you see a message prompting you to log in, displaying `Select login method:` or `Credit balance too low · Add funds:`, ensure you have properly set up environment variables, especially `ANTHROPIC_AUTH_TOKEN` with your Scaleway secret key. If you were already logged in with an Anthropic or Claude account, you may need to use `/logout` to sign out from the account, as this may conflict with API key authentication defined through `ANTHROPIC_AUTH_TOKEN`.

<Message type="tip">
  Ensure that the y-router proxy is running in the background whenever you use Claude Code to maintain the connection to Scaleway's Generative APIs.
</Message>

## Going further

You can customize the proxy settings or explore additional features provided by y-router to optimize your setup further. For more details, refer to the [y-router documentation](https://github.com/luohy15/y-router).

<Message type="note">
  If you encounter issues with the proxy or API access, verify that your environment variables are correctly set and that the proxy is running without errors.
</Message>
