Skip to content

feat: add Astraflow provider support#2554

Open
ucloudnb666 wants to merge 1 commit into
evolution-foundation:mainfrom
ucloudnb666:feat/astraflow-1779362652
Open

feat: add Astraflow provider support#2554
ucloudnb666 wants to merge 1 commit into
evolution-foundation:mainfrom
ucloudnb666:feat/astraflow-1779362652

Conversation

@ucloudnb666
Copy link
Copy Markdown

@ucloudnb666 ucloudnb666 commented May 21, 2026

📋 Description

Adds support for Astraflow — an OpenAI-compatible AI model aggregation platform by UCloud (优刻得) supporting 200+ models — as a configurable integration in Evolution API.

What changed

src/config/env.config.ts

  • Added Astraflow type (ENABLED, API_KEY_GLOBAL for the global endpoint, API_KEY_CN_GLOBAL for the China endpoint)
  • Added ASTRAFLOW: Astraflow to the Env interface
  • Added parsing of ASTRAFLOW_ENABLED, ASTRAFLOW_API_KEY, and ASTRAFLOW_CN_API_KEY environment variables in envProcess()

env.example

  • Added ASTRAFLOW_ENABLED, ASTRAFLOW_API_KEY, and ASTRAFLOW_CN_API_KEY env vars with comments pointing to the signup URLs

About Astraflow

Provider Astraflow by UCloud / 优刻得
Compatibility OpenAI-compatible (drop-in replacement)
Models 200+
Global endpoint https://api-us-ca.umodelverse.ai/v1
China endpoint https://api.modelverse.cn/v1
Global signup https://astraflow.ucloud-global.com
China signup https://astraflow.ucloud.cn

Usage

Because Astraflow is fully OpenAI-compatible, users can leverage the existing OpenAI chatbot integration in Evolution API by:

  1. Setting ASTRAFLOW_ENABLED=true and supplying ASTRAFLOW_API_KEY (global) or ASTRAFLOW_CN_API_KEY (China) in their .env
  2. When configuring an OpenAI bot instance, using the Astraflow API key and setting the base URL to:
    • Global: https://api-us-ca.umodelverse.ai/v1
    • China: https://api.modelverse.cn/v1

No new SDK, no new subpackage, no database migrations required.

🔗 Related Issue

Closes #(issue_number)

🧪 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧹 Code cleanup
  • 🔒 Security fix

🧪 Testing

  • Manual testing completed
  • Functionality verified in development environment
  • No breaking changes introduced
  • Tested with different connection types (if applicable)

📸 Screenshots (if applicable)

N/A

✅ Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have manually tested my changes thoroughly
  • I have verified the changes work with different scenarios
  • Any dependent changes have been merged and published

📝 Additional Notes

No new SDK, no new subpackage, and no database migrations are required. Astraflow is a fully drop-in OpenAI-compatible provider, so existing OpenAI bot integrations in Evolution API can be reused directly by pointing the base URL to the appropriate Astraflow endpoint.

Summary by Sourcery

New Features:

  • Introduce Astraflow provider configuration with support for global and China-specific API keys via environment variables.

Signed-off-by: ucloudnb666 <ucloudnb666@users.noreply.github.com>
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 21, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds Astraflow as a configurable, OpenAI-compatible provider by extending the env config types and wiring new Astraflow-related environment variables into the configuration service, along with documenting the new env vars in env.example.

Flow diagram for Astraflow env vars into OpenAI-compatible chatbot

flowchart TD
  subgraph EnvFile
    ASTRAFLOW_ENABLED
    ASTRAFLOW_API_KEY
    ASTRAFLOW_CN_API_KEY
  end

  EnvFile --> ConfigService_envProcess
  ConfigService_envProcess --> AstraflowConfig[ASTRAFLOW in ConfigService]
  AstraflowConfig --> OpenaiChatbot[Openai chatbot using Astraflow base URL]
Loading

File-Level Changes

Change Details Files
Introduce Astraflow provider configuration type and wire it into the main Env configuration.
  • Define Astraflow type with enable flag plus global and China API key fields
  • Extend Env interface to include an ASTRAFLOW property of type Astraflow
  • Initialize ASTRAFLOW config in ConfigService.envProcess() using ASTRAFLOW_ENABLED, ASTRAFLOW_API_KEY, and ASTRAFLOW_CN_API_KEY environment variables
src/config/env.config.ts
Expose Astraflow-related environment variables in the example env file.
  • Add ASTRAFLOW_ENABLED flag in env.example
  • Add ASTRAFLOW_API_KEY and ASTRAFLOW_CN_API_KEY placeholders with comments for Astraflow signup URLs
env.example

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider aligning the Astraflow config shape and naming with the existing Openai config (e.g., API_KEY_GLOBAL / API_KEY_CN or similar) so it’s immediately clear how each key maps to endpoints and to avoid confusion around the *_GLOBAL suffix for the China-specific key.
  • It may be helpful to add a brief inline comment above the ASTRAFLOW block in envProcess() explaining how the Astraflow env vars are intended to be used (especially how the CN vs global keys are selected) to make the integration behavior clearer to future readers.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider aligning the Astraflow config shape and naming with the existing Openai config (e.g., `API_KEY_GLOBAL` / `API_KEY_CN` or similar) so it’s immediately clear how each key maps to endpoints and to avoid confusion around the `*_GLOBAL` suffix for the China-specific key.
- It may be helpful to add a brief inline comment above the `ASTRAFLOW` block in `envProcess()` explaining how the Astraflow env vars are intended to be used (especially how the CN vs global keys are selected) to make the integration behavior clearer to future readers.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dpaes
Copy link
Copy Markdown

dpaes commented May 21, 2026

whats the purpose of include this? @ucloudnb666

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