From a78522b53b9baec0f54ef083fc7ca1da57740640 Mon Sep 17 00:00:00 2001 From: anhnh2002 Date: Mon, 29 Jun 2026 15:48:01 +0700 Subject: [PATCH] add atlas cloud provider --- README.md | 12 +++++++++++- codewiki/cli/commands/config.py | 21 +++++++++++++++++++-- codewiki/cli/models/config.py | 2 +- codewiki/src/config.py | 8 ++++++-- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8821c523..6e6699db 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ codewiki --version ### 2. Configure Your Environment -CodeWiki supports multiple LLM providers: **OpenAI-compatible**, **Anthropic**, **AWS Bedrock**, **Azure OpenAI**, plus subscription mode via **Claude Code** and **Codex** CLIs (no API key required). +CodeWiki supports multiple LLM providers: **OpenAI-compatible**, **Atlas Cloud**, **Anthropic**, **AWS Bedrock**, **Azure OpenAI**, plus subscription mode via **Claude Code** and **Codex** CLIs (no API key required). ```bash # OpenAI-compatible @@ -60,6 +60,14 @@ codewiki config set \ --cluster-model claude-sonnet-4 \ --fallback-model glm-4p5 +# Atlas Cloud — base URL auto-set to https://api.atlascloud.ai/v1; +# API key read from $ATLASCLOUD_API_KEY when --api-key is omitted. +codewiki config set \ + --provider atlas-cloud \ + --main-model anthropic/claude-sonnet-4.6 \ + --cluster-model anthropic/claude-sonnet-4.6 \ + --fallback-model zai-org/GLM-4.6 + # Anthropic codewiki config set \ --provider anthropic \ @@ -100,6 +108,8 @@ codewiki config set \ --cluster-model gpt-5.5 ``` +**About Atlas Cloud.** [Atlas Cloud](https://www.atlascloud.ai) is a full-modal AI inference platform that exposes LLM, image, and video models (300+) behind a single OpenAI-compatible API, so it works with CodeWiki out of the box. Browse model IDs at the [models endpoint](https://api.atlascloud.ai/v1/models) and pick a strong coding model for `--main-model` / `--cluster-model`; their [coding plan](https://www.atlascloud.ai/console/coding-plan) offers budget-friendly API access. + **Subscription mode** routes every LLM call through the local `claude` / `codex` CLI binary (via the [`caw`](https://github.com/zzjas/caw) library), so you can run CodeWiki on a Claude Pro/Max or Codex subscription instead of paying per-token API usage. Claude Code's built-in `Write`/`Edit`/`Bash` tools are disabled inside CodeWiki's agent loop so documentation writes still go through CodeWiki's Mermaid-validating editor. > **Note on model names.** In subscription mode the model string is forwarded directly to `claude --model` / `codex --model`, so use the bare CLI model name (e.g. `gpt-5.4`, `claude-sonnet-4-6`) — **not** the litellm-style `openai/…` or `anthropic/…` prefix used by `openai-compatible`. If you previously ran with `openai-compatible`, re-run `config set` for **both** `--main-model` and `--cluster-model` to clear any stale prefixes; `config set` only updates the keys you pass. diff --git a/codewiki/cli/commands/config.py b/codewiki/cli/commands/config.py index 988ba7b4..91b47ffa 100644 --- a/codewiki/cli/commands/config.py +++ b/codewiki/cli/commands/config.py @@ -3,6 +3,7 @@ """ import json +import os import sys import click from typing import Optional, List @@ -86,11 +87,12 @@ def config_group(): @click.option( "--provider", type=click.Choice( - ['openai-compatible', 'anthropic', 'bedrock', 'azure-openai', 'claude-code', 'codex'], + ['openai-compatible', 'atlas-cloud', 'anthropic', 'bedrock', 'azure-openai', 'claude-code', 'codex'], case_sensitive=False, ), help=( "LLM provider type (default: openai-compatible). " + "Use 'atlas-cloud' for Atlas Cloud (base URL auto-set; reads ATLASCLOUD_API_KEY). " "Use 'claude-code' or 'codex' to run on a CLI subscription instead of an API key." ), ) @@ -139,6 +141,11 @@ def config_set( $ codewiki config set --api-key sk-abc123 --base-url https://api.anthropic.com \\ --main-model claude-sonnet-4 --cluster-model claude-sonnet-4 --fallback-model glm-4p5 + \b + # Atlas Cloud (OpenAI-compatible) — base URL auto-set, + # API key read from ATLASCLOUD_API_KEY if --api-key is omitted + $ codewiki config set --provider atlas-cloud --main-model --cluster-model + \b # Subscription mode (Claude Code) — no API key needed, # authenticate via 'claude login' on the host first @@ -169,7 +176,17 @@ def config_set( if not any([api_key, base_url, main_model, cluster_model, fallback_model, max_tokens, max_token_per_module, max_token_per_leaf_module, max_depth, provider, aws_region, api_version, azure_deployment]): click.echo("No options provided. Use --help for usage information.") sys.exit(EXIT_CONFIG_ERROR) - + + # Atlas Cloud convenience defaults: it's an OpenAI-compatible endpoint, so + # auto-fill its base URL and pull the API key from ATLASCLOUD_API_KEY when the + # user does not pass them explicitly. + if provider and provider.lower() == "atlas-cloud": + from codewiki.src.config import ATLAS_CLOUD_BASE_URL + if not base_url: + base_url = ATLAS_CLOUD_BASE_URL + if not api_key: + api_key = os.getenv("ATLASCLOUD_API_KEY") + # Validate inputs before saving validated_data = {} diff --git a/codewiki/cli/models/config.py b/codewiki/cli/models/config.py index 112ed9f3..2aed7604 100644 --- a/codewiki/cli/models/config.py +++ b/codewiki/cli/models/config.py @@ -113,7 +113,7 @@ class Configuration: cluster_model: Model for module clustering fallback_model: Fallback model for documentation generation default_output: Default output directory - provider: LLM provider type (openai-compatible, anthropic, bedrock, azure-openai) + provider: LLM provider type (openai-compatible, atlas-cloud, anthropic, bedrock, azure-openai) aws_region: AWS region for Bedrock provider api_version: Azure OpenAI API version azure_deployment: Azure OpenAI deployment name diff --git a/codewiki/src/config.py b/codewiki/src/config.py index 120ac2bd..cd37cdc3 100644 --- a/codewiki/src/config.py +++ b/codewiki/src/config.py @@ -43,6 +43,10 @@ def is_cli_context() -> bool: LLM_BASE_URL = os.getenv('LLM_BASE_URL', 'http://0.0.0.0:4000/') LLM_API_KEY = os.getenv('LLM_API_KEY', 'sk-1234') +# Atlas Cloud default endpoint (OpenAI-compatible). Used to auto-fill the base URL +# when the user selects the `atlas-cloud` provider without passing --base-url. +ATLAS_CLOUD_BASE_URL = "https://api.atlascloud.ai/v1" + @dataclass class Config: """Configuration class for CodeWiki.""" @@ -58,7 +62,7 @@ class Config: cluster_model: str fallback_model: str = FALLBACK_MODEL_1 # Provider configuration - provider: str = "openai-compatible" # openai-compatible, anthropic, bedrock, azure-openai + provider: str = "openai-compatible" # openai-compatible, atlas-cloud, anthropic, bedrock, azure-openai aws_region: str = "us-east-1" api_version: str = "2024-12-01-preview" # Azure OpenAI API version azure_deployment: str = "" # Azure OpenAI deployment name @@ -181,7 +185,7 @@ def from_cli( main_model: Primary model cluster_model: Clustering model fallback_model: Fallback model - provider: LLM provider type (openai-compatible, anthropic, bedrock, azure-openai) + provider: LLM provider type (openai-compatible, atlas-cloud, anthropic, bedrock, azure-openai) aws_region: AWS region for Bedrock provider api_version: Azure OpenAI API version azure_deployment: Azure OpenAI deployment name