Skip to content

feat: add Astraflow provider support#75

Open
ucloudnb666 wants to merge 1 commit into
wassim249:masterfrom
ucloudnb666:feat/astraflow-1778823612
Open

feat: add Astraflow provider support#75
ucloudnb666 wants to merge 1 commit into
wassim249:masterfrom
ucloudnb666:feat/astraflow-1778823612

Conversation

@ucloudnb666

Copy link
Copy Markdown

Summary

Adds Astraflow by UCloud as an OpenAI-compatible LLM provider alongside the existing OpenAI models.

Astraflow is an OpenAI-compatible AI model aggregation platform supporting 200+ models, available via a global endpoint and a China endpoint. Because it is API-compatible with OpenAI, integration requires only setting base_url + api_key on ChatOpenAI — no new SDK or subpackage needed.

Changes

.env.example

  • Documents ASTRAFLOW_API_KEY (global endpoint) and ASTRAFLOW_CN_API_KEY (China endpoint).

app/core/config.py

  • Reads ASTRAFLOW_API_KEY, ASTRAFLOW_CN_API_KEY, ASTRAFLOW_BASE_URL, and ASTRAFLOW_CN_BASE_URL from the environment, with the official default base URLs pre-filled.

app/services/llm/registry.py

  • Adds two Astraflow entries to LLMRegistry.LLMS:
    • astraflow/default — global endpoint, uses ASTRAFLOW_API_KEY
    • astraflow-cn/default — China endpoint, uses ASTRAFLOW_CN_API_KEY
  • Both entries reuse ChatOpenAI (already a dependency) with the Astraflow base_url so no new packages are required.
  • The get() method already supports per-call overrides, so any Astraflow model slug can be passed at call-time via kwargs.

Usage

# .env
ASTRAFLOW_API_KEY=your-global-key
DEFAULT_LLM_MODEL=astraflow/default

Or for the China endpoint:

ASTRAFLOW_CN_API_KEY=your-cn-key
DEFAULT_LLM_MODEL=astraflow-cn/default

Sign up at https://astraflow.ucloud-global.com (global) or https://astraflow.ucloud.cn (China).

Signed-off-by: ucloudnb666 <ucloudnb666@users.noreply.github.com>
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.

1 participant