Skip to content

feat: add GatewayZ provider with Anthropic API support#4

Open
vdimarco wants to merge 32 commits intonumman-ali:mainfrom
Alpaca-Network:main
Open

feat: add GatewayZ provider with Anthropic API support#4
vdimarco wants to merge 32 commits intonumman-ali:mainfrom
Alpaca-Network:main

Conversation

@vdimarco
Copy link

@vdimarco vdimarco commented Jan 4, 2026

Summary

Adds GatewayZ as a new provider with direct Anthropic API support via https://api.gatewayz.ai/v1, enabling access to 10,000+ models through the GatewayZ gateway.

Changes

Provider Configuration

  • New provider template with authToken mode and requiresModelMapping: true
  • ANTHROPIC_BASE_URL set to https://api.gatewayz.ai/v1 for direct Anthropic messages API
  • Auto-filled model defaults: claude-sonnet-4-20250514, claude-opus-4-5-20251101, claude-haiku-3-5-20241022

Brand & Theme

  • Purple/violet color palette with gateway-themed thinking verbs
  • ASCII art splash screen with "Your Gateway to AI" tagline

TUI/CLI Improvements

  • Auto-fill model defaults for GatewayZ in both TUI setup and CLI quick setup
  • Custom API key label ("GatewayZ API key")
  • Added GatewayZ to MODEL_MAPPING_PROVIDERS for variant actions menu
  • Fixed WriteConfigStep to use provider.requiresModelMapping instead of hardcoded provider check

Documentation

  • Updated README with GatewayZ quick start example
  • Provider education content with features:
    • Access to 10,000 models via Gatewayz API
    • Maximum throughput and lowest model latency metrics
    • Lowest pay-per-use pricing on the market

Test plan

  • npm test passes for GatewayZ-related tests
  • Local e2e test: npm run dev -- quick --provider gatewayz --api-key "test" --yes works without requiring model flags
  • Configuration correctly sets ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, and model defaults
  • Curl test confirms endpoint responds correctly

🤖 Generated with Claude Code

vdimarco and others added 19 commits January 4, 2026 08:01
Add api.gatewayz.ai/v1 as a new provider supporting the Anthropic
/messages API endpoint.

Changes:
- Add gatewayz provider template with baseUrl, env config, and apiKey auth
- Create GatewayZ Portal brand theme (violet/purple palette with cyan accents)
- Add provider education content with setup links and feature descriptions
- Include gatewayz in fullySupported providers list
- Add comprehensive test for gatewayz brand configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…flags in package-lock.json

Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
Update documentation to include GatewayZ in:
- Intro paragraph
- Features list
- Quick setup examples
- Supported providers table
- CLI options
- Brand themes list

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add startup ASCII art for GatewayZ provider with:
- Purple/violet color gradient (primary, secondary, accent, dim)
- Cyan accent for the "Z" in GatewayZ
- "Your Portal to Claude" tagline
- Diamond separator matching other providers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The base URL was defined in the provider template but not included
in the env configuration, causing 404 errors when making API requests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
GatewayZ API expects Authorization: Bearer header, not x-api-key.
Change authMode to 'authToken' so ANTHROPIC_AUTH_TOKEN is used.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
GatewayZ routes through OpenRouter, so it needs model mapping like
OpenRouter. Updated:
- Added requiresModelMapping: true to provider config
- Updated provider education to reflect model mapping requirement
- Updated README with correct usage example showing model flags
- Moved gatewayz from fullySupported to requiresMapping category

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
GatewayZ uses OneRouter, not OpenRouter directly. Updated references
in provider config, TUI education content, and README.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updated model IDs to use OneRouter format (e.g., claude-opus-4-5-@20251101)
instead of OpenRouter format (anthropic/claude-*).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixed two locations where gatewayz was missing from model mapping support:
- WriteConfigStep now uses provider.requiresModelMapping instead of
  hardcoded 'openrouter' check for model validation warnings
- VariantActionsScreen MODEL_MAPPING_PROVIDERS now includes 'gatewayz'
  so users can configure models from the variant actions menu

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added OneRouter model ID placeholders for GatewayZ provider so users
see the correct format when configuring models during setup.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updated features to highlight:
- 10,000 models via Gatewayz API
- Maximum throughput and lowest latency
- Lowest pay-per-use pricing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changed from hardcoded ANTHROPIC_AUTH_TOKEN/ANTHROPIC_API_KEY to use
the provider's apiKeyLabel (e.g., "GatewayZ API key") for better UX.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When GatewayZ is selected as provider, the model configuration screen
now auto-fills with the correct OneRouter model IDs instead of showing
empty fields with placeholders:
- Opus: claude-opus-4-5-@20251101
- Sonnet: claude-sonnet-4-@20250514
- Haiku: claude-haiku-3-5-@20241022

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updated GatewayZ model IDs to use direct Anthropic gateway format:
- claude-opus-4-5-20251101
- claude-sonnet-4-20250514
- claude-haiku-3-5-20241022

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…provider-lv7bg1

feat: add GatewayZ provider with Anthropic API support and Portal theme
Added PROVIDER_MODEL_DEFAULTS for GatewayZ so CLI quick setup works
without requiring --model-* flags. GatewayZ will now automatically use:
- claude-sonnet-4-20250514
- claude-opus-4-5-20251101
- claude-haiku-3-5-20241022

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…provider-lv7bg1

Add Anthropic defaults for Gatewayz provider
@numman-ali
Copy link
Owner

Awesome PR

I might not merge immediately as I have some other work I'm doing

Do you care if I take the work and commit it myself or would you rather have the contribution stamp?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds GatewayZ as a new provider for CC-MIRROR, enabling access to 10,000+ AI models through the GatewayZ gateway API using Anthropic-compatible endpoints. The implementation follows the existing provider pattern and includes comprehensive TUI/CLI support, brand theming, and documentation.

Key changes:

  • New GatewayZ provider configuration with authToken authentication mode and model mapping requirements
  • Purple/violet themed brand assets including ASCII splash screen and custom theme colors
  • Auto-fill model defaults for seamless CLI/TUI setup experience

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/providers/index.ts Adds GatewayZ provider template with base URL, auth mode, and environment configuration
src/brands/gatewayz.ts New brand theme with violet/purple color palette and gateway-themed thinking verbs
src/brands/index.ts Registers GatewayZ brand preset
src/tui/app.tsx Critical bug: Incorrectly uses apiKeyLabel for envVarName parameter; adds model default auto-fill logic
src/tui/screens/ModelConfigScreen.tsx Adds GatewayZ model placeholders for TUI input fields
src/tui/screens/VariantActionsScreen.tsx Includes GatewayZ in model mapping providers list
src/tui/content/providers.ts Adds provider education content with features and setup links
src/cli/utils/modelOverrides.ts Implements provider-specific model defaults for CLI quick setup
src/core/wrapper.ts Adds purple/violet gradient ASCII splash screen for GatewayZ
src/core/variant-builder/steps/WriteConfigStep.ts Generalizes model mapping check to use requiresModelMapping property
test/core.test.ts Adds comprehensive test coverage for GatewayZ variant creation
README.md Documents GatewayZ in provider list, quick start examples, and CLI options
CHANGELOG.md Minor markdown formatting fix (unrelated to GatewayZ feature)
package-lock.json Version bump and peer dependency cleanup (standard maintenance)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

headline: 'GatewayZ — Your Gateway to AI',
tagline: 'Your Gateway to AI',
features: [
'Access to 10,000 models via Gatewayz API',
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent capitalization: "Gatewayz API" should be "GatewayZ API" to match the brand name used everywhere else in the codebase (e.g., line 81 "GatewayZ — Your Gateway to AI").

Suggested change
'Access to 10,000 models via Gatewayz API',
'Access to 10,000 models via GatewayZ API',

Copilot uses AI. Check for mistakes.
Comment on lines +263 to +269
const getDefaultModels = (key?: string | null): { opus: string; sonnet: string; haiku: string } => {
if (key === 'gatewayz') {
return {
opus: 'claude-opus-4-5-20251101',
sonnet: 'claude-sonnet-4-20250514',
haiku: 'claude-haiku-3-5-20241022',
};
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GatewayZ model defaults are duplicated in three places: here in getDefaultModels, in ModelConfigScreen.tsx getPlaceholder, and in modelOverrides.ts PROVIDER_MODEL_DEFAULTS. This duplication creates a maintenance burden and risk of inconsistency. Consider centralizing these defaults in a shared constant, possibly in the provider definition itself or in a dedicated constants file.

Suggested change
const getDefaultModels = (key?: string | null): { opus: string; sonnet: string; haiku: string } => {
if (key === 'gatewayz') {
return {
opus: 'claude-opus-4-5-20251101',
sonnet: 'claude-sonnet-4-20250514',
haiku: 'claude-haiku-3-5-20241022',
};
const GATEWAYZ_DEFAULT_MODELS: { opus: string; sonnet: string; haiku: string } = {
opus: 'claude-opus-4-5-20251101',
sonnet: 'claude-sonnet-4-20250514',
haiku: 'claude-haiku-3-5-20241022',
};
const getDefaultModels = (key?: string | null): { opus: string; sonnet: string; haiku: string } => {
if (key === 'gatewayz') {
return GATEWAYZ_DEFAULT_MODELS;

Copilot uses AI. Check for mistakes.
};

/**
* Ensure model mapping for providers that require it (e.g., OpenRouter, LiteLLM)
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment references "OpenRouter, LiteLLM" as examples but should be updated to include GatewayZ or be more generic since GatewayZ also requires model mapping. Consider updating to "providers that require model mapping" or explicitly listing all applicable providers.

Suggested change
* Ensure model mapping for providers that require it (e.g., OpenRouter, LiteLLM)
* Ensure model mapping for providers that require explicit model mapping

Copilot uses AI. Check for mistakes.
README.md Outdated
Comment on lines 146 to 148
--model-sonnet <name> Map to sonnet model (for OpenRouter)
--model-opus <name> Map to opus model (for OpenRouter)
--model-haiku <name> Map to haiku model (for OpenRouter)
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments "(for OpenRouter)" on these model mapping options are outdated. These flags now apply to multiple providers that require model mapping, including GatewayZ. Consider updating to "(for providers requiring model mapping)" or removing the parenthetical entirely since the usage is documented elsewhere.

Suggested change
--model-sonnet <name> Map to sonnet model (for OpenRouter)
--model-opus <name> Map to opus model (for OpenRouter)
--model-haiku <name> Map to haiku model (for OpenRouter)
--model-sonnet <name> Map to sonnet model (for providers requiring model mapping)
--model-opus <name> Map to opus model (for providers requiring model mapping)
--model-haiku <name> Map to haiku model (for providers requiring model mapping)

Copilot uses AI. Check for mistakes.
providerLabel={provider?.label || 'Provider'}
providerKey={providerKey || undefined}
envVarName={provider?.authMode === 'authToken' ? 'ANTHROPIC_AUTH_TOKEN' : 'ANTHROPIC_API_KEY'}
envVarName={provider?.apiKeyLabel || 'API Key'}
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The envVarName parameter expects an environment variable name (like ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY), but this change passes provider?.apiKeyLabel which contains human-readable text like "GatewayZ API key". This will display incorrectly in the MaskedInput component where envVarName is shown as a label.

The original logic should be preserved: provider?.authMode === 'authToken' ? 'ANTHROPIC_AUTH_TOKEN' : 'ANTHROPIC_API_KEY'

Suggested change
envVarName={provider?.apiKeyLabel || 'API Key'}
envVarName={provider?.authMode === 'authToken' ? 'ANTHROPIC_AUTH_TOKEN' : 'ANTHROPIC_API_KEY'}

Copilot uses AI. Check for mistakes.
providerLabel={provider?.label || 'Provider'}
providerKey={providerKey || undefined}
envVarName={provider?.authMode === 'authToken' ? 'ANTHROPIC_AUTH_TOKEN' : 'ANTHROPIC_API_KEY'}
envVarName={provider?.apiKeyLabel || 'API Key'}
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The envVarName parameter expects an environment variable name (like ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY), but this change passes provider?.apiKeyLabel which contains human-readable text like "GatewayZ API key". This will display incorrectly in the MaskedInput component where envVarName is shown as a label.

The original logic should be preserved: provider?.authMode === 'authToken' ? 'ANTHROPIC_AUTH_TOKEN' : 'ANTHROPIC_API_KEY'

Suggested change
envVarName={provider?.apiKeyLabel || 'API Key'}
envVarName={provider?.authMode === 'authToken' ? 'ANTHROPIC_AUTH_TOKEN' : 'ANTHROPIC_API_KEY'}

Copilot uses AI. Check for mistakes.
- Fix capitalization: 'Gatewayz API' -> 'GatewayZ API' in providers.ts
- Update modelOverrides.ts comment to be more generic
- Update README model flag comments to mention 'providers requiring model mapping'

Note: Keeping apiKeyLabel for envVarName intentionally as it provides
better UX by showing "GatewayZ API key" instead of "ANTHROPIC_AUTH_TOKEN"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vdimarco
Copy link
Author

vdimarco commented Jan 5, 2026

Addressing Copilot Review Comments

Fixed ✅

  1. Capitalization: Changed "Gatewayz API" to "GatewayZ API" in providers.ts
  2. Comment update: Changed modelOverrides.ts comment from "OpenRouter, LiteLLM" to "providers that require explicit model mapping"
  3. README update: Changed model flag comments from "(for OpenRouter)" to "(for providers requiring model mapping)"

Intentionally Kept ⚠️

  1. envVarName using apiKeyLabel: This is an intentional UX improvement - showing "GatewayZ API key:" is more user-friendly than the generic "ANTHROPIC_AUTH_TOKEN:". The parameter name is slightly misleading but the functionality is correct and provides better user experience.

Not Addressed (Low Priority) ℹ️

  1. Model defaults duplication: Copilot suggested centralizing the model defaults across app.tsx, ModelConfigScreen.tsx, and modelOverrides.ts. This would be a nice refactor for a future PR but is not critical - the current code works correctly and consistently.

All critical feedback has been addressed in commit fe27a43.

vdimarco and others added 3 commits January 5, 2026 14:39
- Fix capitalization: 'Gatewayz API' -> 'GatewayZ API' in providers.ts
- Update modelOverrides.ts comment to be more generic
- Update README model flag comments to mention 'providers requiring model mapping'

Note: Keeping apiKeyLabel for envVarName intentionally as it provides
better UX by showing "GatewayZ API key" instead of "ANTHROPIC_AUTH_TOKEN"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…provider-lv7bg1

Add Anthropic API support for GatewayZ and update docs
Resolves merge conflicts by integrating GatewayZ provider support
alongside the existing mirror provider and team mode functionality:

- Add GatewayZ provider with purple/violet theme
- Include GatewayZ in provider comparisons and brand themes
- Add GatewayZ test coverage for variant creation
- Update CLI options to include gatewayz provider
- Update model mapping comments for all providers requiring mapping

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vdimarco
Copy link
Author

Merge Conflicts Resolved 🎉

I've resolved the merge conflicts between the GatewayZ provider feature and the existing mirror/team mode features. The changes have been pushed to the branch terragon/fix-merge-conflicts-update-comments-99eyc7.

What was merged:

  • ✅ GatewayZ provider with purple/violet theme
  • ✅ GatewayZ included in provider comparisons and brand themes
  • ✅ GatewayZ test coverage for variant creation
  • ✅ Updated CLI options to include gatewayz provider
  • ✅ Model mapping comments updated for all providers

Copilot Review Comments:

All review comments have been addressed as documented in the previous comment:

  • Capitalization fixed ("GatewayZ API")
  • Comments updated for providers requiring model mapping
  • README model flag comments updated

Tests:

287 out of 291 tests pass. The 4 failing tests are pre-existing in the base branch (related to TUI navigation changes from the mirror/team mode features) and are not caused by this merge.


Friendly reminder: We're eager to get this merged when you have time! The GatewayZ integration is ready to go 🚀

Let us know if there's anything else needed.

Integrates GatewayZ provider from upstream with the existing
mirror provider and team mode features:

- Add GatewayZ provider with purple/violet theme
- Include GatewayZ in provider comparisons and brand themes
- Add GatewayZ test coverage for variant creation
- Update CLI options to include gatewayz provider
- Merge team mode, orchestrator skill, and task management features

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vdimarco
Copy link
Author

Update: Merge Conflicts Resolved ✅

The merge conflicts have now been fully resolved! The PR status should now show Changes can be cleanly merged.

What was resolved:

  • README.md - Combined GatewayZ provider documentation with existing mirror/team mode content
  • src/core/wrapper.ts - Added both mirror and GatewayZ splash screens with their color themes
  • src/tui/content/providers.ts - Merged provider comparison arrays including GatewayZ
  • test/core.test.ts - Added both mirror and GatewayZ test cases

The GatewayZ provider is now fully integrated with all the existing team mode and mirror provider features.


Friendly reminder: We're eager to get this merged when you have time! 🚀 Everything is ready to go.

vdimarco and others added 2 commits January 14, 2026 20:20
Add input validation for the --older-than CLI option in the tasks clean
command. Previously, passing a non-numeric value (e.g., --older-than=abc)
would result in NaN, causing all tasks to be silently filtered out since
any comparison with NaN returns false. This led to confusing "No tasks
match" messages instead of a clear error.

Now validates that:
- The value is a valid number
- The value is non-negative

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update package-lock.json to reflect correct version 1.6.2 matching
package.json. The lockfile had stale version 1.0.4.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vdimarco
Copy link
Author

Ready for Merge ✅

All commits from Alpaca-Network/cc-mirror are ready to be merged into numman-ali/cc-mirror:

Commits included in this PR:

  • 003589b fix: sync package-lock.json version with package.json
  • 043dd4f fix: validate --older-than option to prevent silent NaN comparison
  • 9673950 Merge numman-ali/main with GatewayZ provider support

Changes integrated:

  • GatewayZ provider support (new provider)
  • Mirror provider and team mode features preserved
  • Bug fix for --older-than CLI option (was silently becoming NaN)
  • package-lock.json version sync fix

The PR is marked as MERGEABLE. Please merge to sync all commits to the source repo.

vdimarco and others added 5 commits January 18, 2026 15:18
Merge fix-merge-conflicts: add Team Mode, Mirror Claude, and Tasks CLI
Similar to the --older-than fix, this adds validation for the --limit
option in tasks list command to prevent NaN from silently breaking the
limit logic. Also requires positive integer input.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Merge upstream changes including:
- Claude Code 2.1.12 upgrade
- Windows wrapper improvements
- CI/CD workflow and coverage improvements
- Team mode gating (now legacy feature)
- Maintainer state tracking
- Test stabilization and coverage

Preserves fork-specific changes:
- GatewayZ provider support with purple theme
- Model mapping documentation enhancements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The Claude Code Action workflows require CLAUDE_CODE_OAUTH_TOKEN secret
to be configured. Add conditional check so the step gracefully skips
when the secret is not available, instead of failing the entire check.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add escapeRegExp helper to properly escape function names before using
them in RegExp constructor to prevent regex failures if the name
contains special characters like $, [, ], etc.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@numman-ali
Copy link
Owner

I'm doing a stacked PR here, really appreciate this

#31

@numman-ali
Copy link
Owner

Will update and test before releasing

Sync latest upstream commits and docs (legacy team mode gating)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants