Skip to content

feat: add Astraflow (ModelVerse) provider support#2183

Open
ucloudnb666 wants to merge 3 commits intostrands-agents:mainfrom
ucloudnb666:feat/astraflow-1776829696
Open

feat: add Astraflow (ModelVerse) provider support#2183
ucloudnb666 wants to merge 3 commits intostrands-agents:mainfrom
ucloudnb666:feat/astraflow-1776829696

Conversation

@ucloudnb666
Copy link
Copy Markdown

Summary

This PR adds support for Astraflow (UCloud ModelVerse) as a model provider in Strands Agents.

Astraflow is UCloud's AI model aggregation platform that provides an OpenAI-compatible API supporting models such as DeepSeek, Claude, GPT-4, and more.

Two Regional Endpoints (registered as independent providers)

Provider class Region Base URL API Key env var
AstraflowModel Global (US/CA) https://api-us-ca.umodelverse.ai/v1 ASTRAFLOW_API_KEY
AstraflowCNModel China https://api.modelverse.cn/v1 ASTRAFLOW_CN_API_KEY

Changes

  • src/strands/models/astraflow.py — New provider module with AstraflowModel (global) and AstraflowCNModel (China) classes, both built on top of the existing OpenAIModel with pre-configured base_url and api_key defaults.
  • src/strands/models/__init__.py — Lazy-load entries for AstraflowModel and AstraflowCNModel.
  • pyproject.toml — New astraflow optional dependency group (reuses the openai package).

Usage

# Global node (US/CA)
from strands import Agent
from strands.models.astraflow import AstraflowModel

model = AstraflowModel(model_id="claude-3-5-haiku-20241022")
agent = Agent(model=model)
agent("Hello!")

# China node
from strands.models.astraflow import AstraflowCNModel

model_cn = AstraflowCNModel(model_id="deepseek-ai/DeepSeek-V3")
agent_cn = Agent(model=model_cn)
agent_cn("你好!")

Install with:

pip install "strands-agents[astraflow]"

Set your API key:

export ASTRAFLOW_API_KEY="your-global-api-key"
export ASTRAFLOW_CN_API_KEY="your-china-api-key"

Design Notes

  • AstraflowModel and AstraflowCNModel extend OpenAIModel directly, inheriting all OpenAI-compatible streaming, tool-use, and structured-output logic.
  • The base_url and api_key are pre-configured via client_args defaults, so users only need to set the environment variable — no manual URL configuration required.
  • Follows the same pattern as other OpenAI-compatible providers in this repo (e.g., SageMakerAIModel).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant