Set configuration values for CodeWiki. API keys are stored securely in your system keychain: • macOS: Keychain Access • Windows: Credential Manager • Linux: Secret Service (GNOME Keyring, KWallet) Examples: \b # Set all configuration (API mode)
(
api_key: Optional[str],
base_url: Optional[str],
main_model: Optional[str],
cluster_model: Optional[str],
fallback_model: Optional[str],
max_tokens: Optional[int],
max_token_per_module: Optional[int],
max_token_per_leaf_module: Optional[int],
max_depth: Optional[int],
provider: Optional[str] = None,
aws_region: Optional[str] = None,
api_version: Optional[str] = None,
azure_deployment: Optional[str] = None
)
| 112 | if output_json: |
| 113 | click.echo(json.dumps(pricing, indent=2, sort_keys=True)) |
| 114 | elif not pricing: |
| 115 | click.echo("No API prices configured. Use 'codewiki config pricing set --help'.") |
| 116 | else: |
| 117 | click.echo("API pricing (USD per million tokens; omitted cache rates use input):") |
| 118 | for provider, models in sorted(pricing.items()): |
| 119 | for model, rates in sorted(models.items()): |
| 120 | click.echo(f" {provider}/{model}: {json.dumps(rates, sort_keys=True)}") |
| 121 | |
| 122 | |
| 123 | @pricing_group.command(name="remove") |
| 124 | @click.argument("model") |
| 125 | @click.option("--provider", help="Defaults to the active API provider.") |
| 126 | def pricing_remove(model, provider): |
| 127 | """Remove configured rates for MODEL.""" |
| 128 | from copy import deepcopy |
| 129 | |
| 130 | manager = _pricing_manager() |
| 131 | provider = _pricing_provider(manager, provider) |
| 132 | pricing = deepcopy(manager.get_config().pricing) if manager.get_config() else {} |
| 133 | if model not in pricing.get(provider, {}): |
| 134 | raise click.ClickException(f"No price configured for {provider}/{model}") |
| 135 | del pricing[provider][model] |
| 136 | if not pricing[provider]: |
| 137 | del pricing[provider] |
| 138 | manager.save(pricing=pricing) |
| 139 | click.echo(f"API pricing removed for {provider}/{model}.") |
| 140 | |
| 141 | |
| 142 | @config_group.command(name="set") |
| 143 | @click.option("--api-key", type=str, help="LLM API key (stored securely in system keychain)") |
| 144 | @click.option("--base-url", type=str, help="LLM API base URL (e.g., https://api.anthropic.com)") |
| 145 | @click.option("--main-model", type=str, help="Primary model for documentation generation") |
| 146 | @click.option("--cluster-model", type=str, help="Model for module clustering (recommend top-tier)") |
| 147 | @click.option("--fallback-model", type=str, help="Fallback model for documentation generation") |
| 148 | @click.option("--max-tokens", type=int, help="Maximum tokens for LLM response (default: 32768)") |
| 149 | @click.option( |
| 150 | "--min-token-per-module", |
| 151 | type=click.IntRange(min=1), |
| 152 | default=None, |
| 153 | help="Minimum code tokens per standalone module (default: 1000)", |
| 154 | ) |
| 155 | @click.option( |
| 156 | "--max-token-per-module", |
| 157 | type=int, |
| 158 | help="Maximum tokens per module for clustering (default: 36369)", |
| 159 | ) |
| 160 | @click.option( |
| 161 | "--max-token-per-leaf-module", |
| 162 | type=int, |
| 163 | help=f"Base code-token threshold to allow delegation (default: {DEFAULT_MAX_TOKEN_PER_LEAF_MODULE})", |
| 164 | ) |
| 165 | @click.option( |
| 166 | "--max-depth", type=int, help="Maximum depth for hierarchical decomposition (default: 2)" |
| 167 | ) |
| 168 | @click.option( |
| 169 | "--request-limit", type=int, help="Maximum model requests per agent run (default: 100)" |
| 170 | ) |
| 171 | @click.option( |
nothing calls this directly
no test coverage detected