Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)
Python
Add Scaleway Generative APIs provider (#1769)
dojddelaxc-archc67510ae819b
diff --git a/.env.example b/.env.exampleindex 4e84b9e2..3322090d 100644--- a/.env.example+++ b/.env.example@@ -142,6 +142,10 @@ VERTEX_LOCATION="global"# NEBIUS_API_KEY=<your-token>+# Scaleway (OpenAI-compatible Chat Completions at api.scaleway.ai/v1)+# SCW_SECRET_KEY=<your-token>++# Chutes (OpenAI-compatible Chat Completions at llm.chutes.ai/v1)# CHUTES_API_KEY=<your-token>@@ -247,6 +251,7 @@ MODEL="nvidia_nim/nvidia/nemotron-3-super-120b-a12b"# FCC_SMOKE_MODEL_DEEPINFRA=<provider/model-id># FCC_SMOKE_MODEL_SILICONFLOW=<provider/model-id># FCC_SMOKE_MODEL_NEBIUS=<provider/model-id>+# FCC_SMOKE_MODEL_SCALEWAY=<provider/model-id># FCC_SMOKE_MODEL_CHUTES=<provider/model-id># FCC_SMOKE_MODEL_FEATHERLESS=<provider/model-id># FCC_SMOKE_MODEL_AGNES=<provider/model-id>@@ -282,6 +287,7 @@ REASONING_HAIKU=inherit# DEEPINFRA_PROXY=<http-or-socks-url># SILICONFLOW_PROXY=<http-or-socks-url># NEBIUS_PROXY=<http-or-socks-url>+# SCW_PROXY=<http-or-socks-url># CHUTES_PROXY=<http-or-socks-url># FEATHERLESS_PROXY=<http-or-socks-url># AGNES_PROXY=<http-or-socks-url>diff --git a/pyproject.toml b/pyproject.tomlindex 06c104ad..91162088 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "hatchling.build"[project]name = "free-claude-code"-version = "6.2.36"+version = "6.2.37"description = "Local proxy connecting coding agents to OpenAI-compatible AI providers"readme = "README.md"requires-python = ">=3.14.0"diff --git a/smoke/lib/config.py b/smoke/lib/config.pyindex 8d35f5dd..45ac4001 100644--- a/smoke/lib/config.py+++ b/smoke/lib/config.py@@ -81,6 +81,7 @@ PROVIDER_SMOKE_DEFAULT_MODELS: dict[str, str] = {"deepinfra": "deepinfra/deepseek-ai/DeepSeek-V4-Flash","siliconflow": "siliconflow/Qwen/Qwen3-32B","nebius": "nebius/Qwen/Qwen3-30B-A3B",+ "scaleway": "scaleway/deepseek/deepseek-v4-flash","chutes": "chutes/Qwen/Qwen3-32B-TEE","featherless": "featherless/Qwen/Qwen3-32B","sambanova": "sambanova/Meta-Llama-3.3-70B-Instruct",diff --git a/src/free_claude_code/api/admin_static/providers/SOURCES.md b/src/free_claude_code/api/admin_static/providers/SOURCES.mdindex dc27afb4..1d911881 100644--- a/src/free_claude_code/api/admin_static/providers/SOURCES.md+++ b/src/free_claude_code/api/admin_static/providers/SOURCES.md@@ -41,6 +41,7 @@ The LLaMA.cpp icon comes from the upstream llama.cpp repository; its MIT license| `poolside-color.svg` | https://unpkg.com/@lobehub/[email protected]/icons/poolside-color.svg || `qwen-color.svg` | https://unpkg.com/@lobehub/[email protected]/icons/qwen-color.svg || `sambanova-color.svg` | https://unpkg.com/@lobehub/[email protected]/icons/sambanova-color.svg |+| `scaleway.svg` | https://www.scaleway.com/favicon/website/favicon.svg || `siliconcloud-color.svg` | https://unpkg.com/@lobehub/[email protected]/icons/siliconcloud-color.svg || `together-color.svg` | https://unpkg.com/@lobehub/[email protected]/icons/together-color.svg || `tokenrouter.png` | https://www.tokenrouter.com/logo-without-title.png |diff --git a/src/free_claude_code/api/admin_static/providers/scaleway.svg b/src/free_claude_code/api/admin_static/providers/scaleway.svgnew file mode 100644index 00000000..a536876a--- /dev/null+++ b/src/free_claude_code/api/admin_static/providers/scaleway.svg@@ -0,0 +1,11 @@+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none">+ <style>+ @media (prefers-color-scheme:dark){path{fill:#fff}}+ </style>+ <path+ d="M8.37 3.666H5.736A1.182 1.182 0 0 0 4.69 4.79v3.81c0 .257.1.48.267.647.166.167.389.267.644.267.5 0 .912-.412.912-.913V6.184c0-.379.311-.691.69-.691h1.189c.255 0 .478-.1.644-.267a.927.927 0 0 0 .267-.658c0-.501-.433-.902-.934-.902ZM7.181 12.357h2.635a1.181 1.181 0 0 0 1.045-1.126v-3.81a.9.9 0 0 0-.267-.647.897.897 0 0 0-.645-.267c-.5 0-.912.412-.912.914v2.417c0 .38-.31.691-.689.691h-1.19c-.255 0-.477.1-.644.268a.927.927 0 0 0-.267.657.934.934 0 0 0 .934.902Z"+ fill="#BF95F9"/>+ <path fill-rule="evenodd" clip-rule="evenodd"+ d="M4.024 0h4.791a5.683 5.683 0 0 1 5.692 5.716v7.588A3.027 3.027 0 0 1 11.75 16H6.703C3.557 16 1 13.437 1 10.284V3.031A3.03 3.03 0 0 1 4.024 0Zm8.67 5.716c0-2.14-1.744-3.889-3.879-3.889h-4.78c-.667 0-1.2.535-1.2 1.204v7.253a3.88 3.88 0 0 0 3.88 3.889h4.957a1.193 1.193 0 0 0 1.023-.98V5.715Z"+ fill="#BF95F9"/>+</svg>diff --git a/src/free_claude_code/config/admin/provider_manifest.py b/src/free_claude_code/config/admin/provider_manifest.pyindex 93fb8de7..77b273ac 100644--- a/src/free_claude_code/config/admin/provider_manifest.py+++ b/src/free_claude_code/config/admin/provider_manifest.py@@ -204,6 +204,13 @@ _PROVIDER_FIELD_OVERRIDES: dict[str, ProviderFieldOverride] = {"and tool-capable models."),},+ "SCW_SECRET_KEY": {+ "label": "Scaleway API Key",+ "description": (+ "Scaleway Generative APIs secret key for OpenAI-compatible chat and "+ "tool-capable models."+ ),+ },"CHUTES_API_KEY": {"label": "Chutes API Key","description": (diff --git a/src/free_claude_code/config/provider_catalog.py b/src/free_claude_code/config/provider_catalog.pyindex b369769c..c12a6da0 100644--- a/src/free_claude_code/config/provider_catalog.py+++ b/src/free_claude_code/config/provider_catalog.py@@ -68,6 +68,8 @@ DEEPINFRA_DEFAULT_BASE = "https://api.deepinfra.com/v1/openai"SILICONFLOW_DEFAULT_BASE = "https://api.siliconflow.com/v1"# Nebius Token Factory OpenAI-compatible Chat Completions API.NEBIUS_DEFAULT_BASE = "https://api.tokenfactory.nebius.com/v1"+# Scaleway Generative APIs OpenAI-compatible Chat Completions API.+SCALEWAY_DEFAULT_BASE = "https://api.scaleway.ai/v1"# Chutes OpenAI-compatible Chat Completions API.CHUTES_DEFAULT_BASE = "https://llm.chutes.ai/v1"# Featherless AI OpenAI-compatible Chat Completions API.@@ -639,6 +641,17 @@ PROVIDER_CATALOG: dict[str, ProviderDescriptor] = {default_base_url=LLM7_DEFAULT_BASE,proxy_attr="llm7_proxy",),+ "scaleway": ProviderDescriptor(+ provider_id="scaleway",+ display_name="Scaleway",+ website_url="https://www.scaleway.com/",+ logo_filename="scaleway.svg",+ credential_env="SCW_SECRET_KEY",+ credential_url="https://console.scaleway.com/iam/api-keys",+ credential_attr="scw_secret_key",+ default_base_url=SCALEWAY_DEFAULT_BASE,+ proxy_attr="scw_proxy",+ ),"ollama_cloud": ProviderDescriptor(provider_id="ollama_cloud",display_name="Ollama Cloud",diff --git a/src/free_claude_code/config/settings.py b/src/free_claude_code/config/settings.pyindex 18e5f5e5..3785393e 100644--- a/src/free_claude_code/config/settings.py+++ b/src/free_claude_code/config/settings.py@@ -296,6 +296,11 @@ class Settings(BaseModel):default=None, validation_alias="CEREBRAS_API_KEY")+ # ==================== Scaleway (OpenAI-compatible) ====================+ scw_secret_key: OptionalNonEmptyString = Field(+ default=None, validation_alias="SCW_SECRET_KEY"+ )+# ==================== Ollama Cloud ====================ollama_api_key: OptionalNonEmptyString = Field(default=None, validation_alias="OLLAMA_API_KEY"@@ -503,6 +508,9 @@ class Settings(BaseModel):cerebras_proxy: OptionalNonEmptyString = Field(default=None, validation_alias="CEREBRAS_PROXY")+ scw_proxy: OptionalNonEmptyString = Field(+ default=None, validation_alias="SCW_PROXY"+ )ollama_cloud_proxy: OptionalNonEmptyString = Field(default=None, validation_alias="OLLAMA_CLOUD_PROXY")diff --git a/src/free_claude_code/providers/credential_validation.py b/src/free_claude_code/providers/credential_validation.pyindex 3cf64eab..e4e1621f 100644--- a/src/free_claude_code/providers/credential_validation.py+++ b/src/free_claude_code/providers/credential_validation.py@@ -67,6 +67,7 @@ _MODELS = _list_field("data")# https://docs.siliconflow.com/cn/api-reference/userinfo/get-user-info# https://ai.google.dev/gemini-api/docs/generate-content/api-errors# https://github.com/nebius/nebius-physical-ai/blob/main/docs/workbench/token-factory.md+# https://www.scaleway.com/en/docs/generative-apis/# https://vercel.com/docs/ai-gateway/sdks-and-apis/rest-api# https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/hf_api.py# https://docs.cohere.com/reference/list-models@@ -108,6 +109,7 @@ _PROBES = (_list_field("models"),),_Probe("nebius", "/models", _MODELS, _AUTH_401),+ _Probe("scaleway", "/models", _MODELS, _AUTH_401),_Probe("vercel","/credits",diff --git a/src/free_claude_code/providers/openai_chat/profiles.py b/src/free_claude_code/providers/openai_chat/profiles.pyindex 1c5cdf78..b791eb26 100644--- a/src/free_claude_code/providers/openai_chat/profiles.py+++ b/src/free_claude_code/providers/openai_chat/profiles.py@@ -737,4 +737,13 @@ OPENAI_CHAT_PROFILES: dict[str, OpenAIChatProfile] = {normalize_base_url=True,reasoning_delta_field="reasoning",),+ "scaleway": OpenAIChatProfile(+ _policy(+ "SCALEWAY",+ ReasoningReplayMode.REASONING_CONTENT,+ default_max_tokens=ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS,+ ),+ NO_REASONING,+ model_listing=OpenAIModelListing(path="/models"),+ ),}diff --git a/tests/contracts/test_provider_catalog_order.py b/tests/contracts/test_provider_catalog_order.pyindex 0ce01642..2afcc3b1 100644--- a/tests/contracts/test_provider_catalog_order.py+++ b/tests/contracts/test_provider_catalog_order.py@@ -52,6 +52,7 @@ _EXPECTED_PROVIDER_ORDER: tuple[str, ...] = ("nararoute","poolside","llm7",+ "scaleway","ollama_cloud","lmstudio","llamacpp",diff --git a/tests/contracts/test_smoke_config.py b/tests/contracts/test_smoke_config.pyindex f3e6b203..5a6c2f27 100644--- a/tests/contracts/test_smoke_config.py+++ b/tests/contracts/test_smoke_config.py@@ -59,6 +59,7 @@ def _settings(**overrides):"deepinfra_api_key": "","siliconflow_api_key": "","nebius_api_key": "",+ "scw_secret_key": "","chutes_api_key": "","featherless_api_key": "","wandb_api_key": "",@@ -474,6 +475,23 @@ def test_chutes_provider_smoke_uses_documented_agent_model(monkeypatch) -> None:assert models[0].source == "provider_default"+def test_scaleway_provider_smoke_uses_documented_agent_model(monkeypatch) -> None:+ monkeypatch.delenv("FCC_SMOKE_MODEL_SCALEWAY", raising=False)+ config = _smoke_config(+ settings=_settings(+ model="ollama/llama3.1",+ ollama_base_url="",+ scw_secret_key="scw-key",+ )+ )++ models = config.provider_smoke_models()++ assert [model.provider for model in models] == ["scaleway"]+ assert models[0].full_model == "scaleway/deepseek/deepseek-v4-flash"+ assert models[0].source == "provider_default"++def test_featherless_provider_smoke_uses_documented_agent_model(monkeypatch) -> None:monkeypatch.delenv("FCC_SMOKE_MODEL_FEATHERLESS", raising=False)config = _smoke_config(diff --git a/tests/providers/test_credential_validation.py b/tests/providers/test_credential_validation.pyindex 9392cc7c..651836bc 100644--- a/tests/providers/test_credential_validation.py+++ b/tests/providers/test_credential_validation.py@@ -39,6 +39,7 @@ CASES = [400,),("nebius", "https://api.tokenfactory.nebius.com/v1/models", {"data": []}, 401),+ ("scaleway", "https://api.scaleway.ai/v1/models", {"data": []}, 401),("vercel","https://ai-gateway.vercel.sh/v1/credits",diff --git a/tests/providers/test_provider_runtime.py b/tests/providers/test_provider_runtime.pyindex 2df79e7e..7964d7e0 100644--- a/tests/providers/test_provider_runtime.py+++ b/tests/providers/test_provider_runtime.py@@ -30,6 +30,7 @@ from free_claude_code.config.provider_catalog import (PROVIDER_CATALOG,QWENCLOUD_CODING_DEFAULT_BASE,QWENCLOUD_DEFAULT_BASE,+ SCALEWAY_DEFAULT_BASE,SILICONFLOW_DEFAULT_BASE,SUPPORTED_PROVIDER_IDS,TOGETHER_DEFAULT_BASE,@@ -84,6 +85,7 @@ def _make_settings(**overrides):mock.deepinfra_api_key = "test_deepinfra_key"mock.siliconflow_api_key = "test_siliconflow_key"mock.nebius_api_key = "test_nebius_key"+ mock.scw_secret_key = "test_scw_key"mock.chutes_api_key = "test_chutes_key"mock.featherless_api_key = "test_featherless_key"mock.mistral_api_key = "test_mistral_key"@@ -167,6 +169,7 @@ def _make_settings(**overrides):mock.deepinfra_proxy = Nonemock.siliconflow_proxy = Nonemock.nebius_proxy = None+ mock.scw_proxy = Nonemock.chutes_proxy = Nonemock.featherless_proxy = Nonemock.azure_openai_proxy = None@@ -457,6 +460,28 @@ async def test_nebius_provider_config_uses_key_base_and_proxy() -> None:assert isinstance(provider, OpenAIChatProvider)+async def test_scaleway_provider_config_uses_key_base_and_proxy() -> None:+ descriptor = PROVIDER_CATALOG["scaleway"]+ settings = _make_settings(+ scw_secret_key="scw-token",+ scw_proxy="http://proxy.test:8080",+ )++ config = build_provider_config(descriptor, settings)+ with patch("free_claude_code.providers.openai_chat.client.AsyncOpenAI"):+ provider = await create_provider("scaleway", settings)++ assert descriptor.display_name == "Scaleway"+ assert descriptor.credential_env == "SCW_SECRET_KEY"+ assert descriptor.credential_url == "https://console.scaleway.com/iam/api-keys"+ assert descriptor.base_url_attr is None+ assert config.api_key == "scw-token"+ assert config.base_url == SCALEWAY_DEFAULT_BASE+ assert config.proxy == "http://proxy.test:8080"+ assert isinstance(provider, OpenAIChatProvider)++@pytest.mark.asyncioasync def test_chutes_provider_config_uses_key_base_and_proxy() -> None:descriptor = PROVIDER_CATALOG["chutes"]@@ -880,6 +905,7 @@ async def test_create_provider_instantiates_each_builtin():"deepinfra": OpenAIChatProvider,"siliconflow": OpenAIChatProvider,"nebius": OpenAIChatProvider,+ "scaleway": OpenAIChatProvider,"chutes": OpenAIChatProvider,"featherless": OpenAIChatProvider,"azure_openai": OpenAIChatProvider,diff --git a/tests/providers/test_scaleway.py b/tests/providers/test_scaleway.pynew file mode 100644index 00000000..96969b16--- /dev/null+++ b/tests/providers/test_scaleway.py@@ -0,0 +1,159 @@+"""Tests for the Scaleway Generative APIs OpenAI-chat provider profile."""++from unittest.mock import AsyncMock++import httpx2+import pytest+from openai import AsyncOpenAI++from free_claude_code.application.model_metadata import ProviderModelInfo+from free_claude_code.config.constants import ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS+from free_claude_code.config.provider_catalog import SCALEWAY_DEFAULT_BASE+from free_claude_code.core.anthropic.models import MessagesRequest+from free_claude_code.core.reasoning import ReasoningPolicy+from free_claude_code.providers.model_listing import ModelListResponseError+from free_claude_code.providers.openai_chat import OpenAIChatProvider+from tests.providers.support import (+ REASONING_DEFAULT,+ REASONING_OFF,+ REASONING_ON,+ immediate_admission,+ make_provider_config,+ profiled_provider,+ reasoning_for,+)++_MODEL = "deepseek/deepseek-v4-flash"+++def scaleway_provider() -> OpenAIChatProvider:+ return profiled_provider(+ "scaleway",+ make_provider_config(+ api_key="test-scaleway-key",+ base_url=SCALEWAY_DEFAULT_BASE,+ rate_limit=10,+ rate_window=60,+ ),+ admission=immediate_admission(provider_name="scaleway"),+ )+++def test_constructs_standard_openai_chat_provider(+ scaleway_provider: OpenAIChatProvider,+) -> None:+ assert isinstance(scaleway_provider, OpenAIChatProvider)+ assert scaleway_provider._provider_name == "SCALEWAY"+ assert scaleway_provider._api_key == "test-scaleway-key"+ assert scaleway_provider._base_url == SCALEWAY_DEFAULT_BASE+++ "reasoning",+ [REASONING_DEFAULT, REASONING_ON, REASONING_OFF],+)+def test_preserves_standard_fields_and_omits_reasoning_controls(+ scaleway_provider: OpenAIChatProvider,+ reasoning: ReasoningPolicy,+) -> None:+ request = MessagesRequest.model_validate(+ {+ "model": _MODEL,+ "messages": [{"role": "user", "content": "Summarize the diff."}],+ }+ )++ body = scaleway_provider._chat._build_request_body(request, reasoning=reasoning)++ assert body["max_tokens"] == ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS+ assert body["model"] == _MODEL+ assert "reasoning" not in body+ assert "reasoning_effort" not in body+ assert "thinking" not in body+ assert "extra_body" not in body+++def test_replays_thinking_in_reasoning_content_field(+ scaleway_provider: OpenAIChatProvider,+) -> None:+ request = MessagesRequest.model_validate(+ {+ "model": _MODEL,+ "messages": [+ {"role": "user", "content": "Solve it."},+ {+ "role": "assistant",+ "content": [+ {"type": "thinking", "thinking": "Work through it."},+ {"type": "text", "text": "The answer is 42."},+ ],+ },+ {"role": "user", "content": "Continue."},+ ],+ }+ )++ body = scaleway_provider._chat._build_request_body(+ request,+ reasoning=reasoning_for(request),+ )++ assert body["messages"][1] == {+ "role": "assistant",+ "content": "The answer is 42.",+ "reasoning_content": "Work through it.",+ }+++async def test_lists_models_from_models_endpoint(+ scaleway_provider: OpenAIChatProvider,+) -> None:+ scaleway_provider._client.get = AsyncMock(return_value={"data": [{"id": _MODEL}]})++ model_infos = await scaleway_provider.list_model_infos()++ assert model_infos == frozenset({ProviderModelInfo(_MODEL)})+ scaleway_provider._client.get.assert_awaited_once()+ call = scaleway_provider._client.get.await_args+ assert call is not None+ assert call.args == ("/models",)+++async def test_rejects_empty_model_ids(+ scaleway_provider: OpenAIChatProvider,+) -> None:+ scaleway_provider._client.get = AsyncMock(return_value={"data": [{"id": ""}]})++ with pytest.raises(ModelListResponseError, match="include id"):+ await scaleway_provider.list_model_infos()+++async def test_model_catalog_uses_documented_url_and_bearer_auth(+ scaleway_provider: OpenAIChatProvider,+) -> None:+ requests: list[httpx2.Request] = []++ def handler(request: httpx2.Request) -> httpx2.Response:+ requests.append(request)+ return httpx2.Response(200, json={"data": [{"id": _MODEL}]})++ await scaleway_provider._client.close()+ scaleway_provider._client = AsyncOpenAI(+ api_key="wire-scaleway-key",+ base_url=SCALEWAY_DEFAULT_BASE,+ max_retries=0,+ http_client=httpx2.AsyncClient(transport=httpx2.MockTransport(handler)),+ )+ try:+ model_infos = await scaleway_provider.list_model_infos()+ finally:+ await scaleway_provider.cleanup()++ assert model_infos == frozenset({ProviderModelInfo(_MODEL)})+ assert len(requests) == 1+ assert str(requests[0].url) == "https://api.scaleway.ai/v1/models"+ assert requests[0].headers["authorization"] == "Bearer wire-scaleway-key"diff --git a/uv.lock b/uv.lockindex 2a4d38f2..42764b6f 100644--- a/uv.lock+++ b/uv.lock@@ -599,7 +599,7 @@ wheels = [[[package]]name = "free-claude-code"-version = "6.2.36"+version = "6.2.37"source = { editable = "." }dependencies = [{ name = "aiohttp" },