Skip to main content

AGI Open Network China Models

A simple yet powerful framework for accessing Chinese AI models. Currently supports the full range of SiliconFlow models, with plans to support more Chinese AI service providers in the future.

Features

  • 🚀 Simple and intuitive API interface
  • 🎯 Support for multiple model types (Chat, Text, Image, Audio, Video)
  • 🔧 Flexible configuration options
  • 📚 Comprehensive documentation and examples
  • 🛠 Complete type hints

Installation

pip install agi-open-network-cn

Quick Start

SiliconFlow Models

from agi_open_network_cn import (
    SiliconFlowClient,
    SiliconFlowChatModel,
    SiliconFlowImageModel,
    SiliconFlowAudioModel,
)

# Initialize client
client = SiliconFlowClient(api_key="your-api-key")

# Use ChatGLM
chat_model = SiliconFlowChatModel(client, model_name="chatglm-turbo")
response = chat_model.simple_chat("Tell me about ChatGLM")
print(response)

# Use Stable Diffusion to generate images
image_model = SiliconFlowImageModel(client)
image_url = image_model.simple_generate("A cute Chinese dragon")
print(image_url)

# Speech to text
audio_model = SiliconFlowAudioModel(client)
text = audio_model.simple_transcribe("speech.mp3")
print(text)

Supported Models and Features

SiliconFlow

Chat Models

  • ChatGLM Series
    • chatglm-turbo: General-purpose model with balanced performance
    • chatglm-pro: Professional version with enhanced capabilities
    • chatglm-std: Standard version with good cost-performance ratio
    • chatglm-lite: Lightweight version for faster responses
  • Qwen Series
    • qwen-turbo: Qwen general version
    • qwen-plus: Qwen enhanced version
  • GPT Series
    • gpt-3.5-turbo
    • gpt-4

Image Models

  • Stable Diffusion Series
    • stable-diffusion-3-5-large-turbo: Latest version, faster generation
    • stable-diffusion-xl: Large model for higher quality
  • FLUX Series
    • FLUX.1-schnell: High-performance image generation
    • Pro/black-forest-labs/FLUX.1-schnell: Professional version

Audio Features

  • Speech to Text: Supports multiple languages and scenarios
  • Text to Speech: High naturalness with emotional expression
  • Custom Voice: Support for voice cloning

Video Features

  • Text to Video: Supports various styles and scenarios
  • Async Generation: Support for long video generation
  • Auto Status Query: Convenient progress tracking

Advanced Usage

Custom Model Parameters

# Using advanced parameters
response = chat_model.chat(
    messages=[
        {"role": "system", "content": "You are a professional Python teacher"},
        {"role": "user", "content": "Explain decorators"},
    ],
    temperature=0.7,
    max_tokens=2000,
    top_p=0.9,
)

Batch Processing

# Batch image generation
prompts = [
    "Chinese ink painting: Mountains and waters",
    "Chinese ink painting: Plum blossoms",
    "Chinese ink painting: Bamboo",
]

for prompt in prompts:
    image_url = image_model.simple_generate(prompt)
    print(f"{prompt}: {image_url}")

Async Video Generation

from agi_open_network_cn import SiliconFlowVideoModel

video_model = SiliconFlowVideoModel(client)
response = video_model.generate("A video showcasing Chinese traditional culture")
request_id = response["request_id"]

# Poll for results
while True:
    status = video_model.get_status(request_id)
    if status["status"] == "completed":
        print(f"Video URL: {status['url']}")
        break
    time.sleep(10)

Error Handling

from agi_open_network_cn.exceptions import AGIOpenNetworkError

try:
    response = chat_model.simple_chat("Hello")
except AGIOpenNetworkError as e:
    print(f"Error occurred: {e}")

Contributing

We welcome all forms of contributions, including but not limited to:

  • Submitting issues and suggestions
  • Improving documentation
  • Adding new features
  • Fixing bugs
  • Adding new model providers

License

MIT License

Contact Us

Metadata

Release files for agi-open-network-cn 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agi-open-network-cn 0.1.0
File Size Uploaded Provenance
agi_open_network_cn-0.1.0.tar.gz 6.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agi-open-network-cn 0.1.0
File Interpreter ABI Platform
agi_open_network_cn-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 kB

Release files / agi_open_network_cn-0.1.0.tar.gz

Download URL agi_open_network_cn-0.1.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
60cd61ebe23b402d533098c903fc466bb37c2d346c8cbb4f37ce887f85683a83
BLAKE2b-256 checksum
How to use checksums
54981dbc6ee9a06a9ba67ab03ce63e6016e120bdd3896c48d0f04a631936cb95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Release files / agi_open_network_cn-0.1.0-py3-none-any.whl

Download URL agi_open_network_cn-0.1.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ac1137f6ef65650e8e6426750141b35d5523bbc5957b1cf73f2816a6bb79902
BLAKE2b-256 checksum
How to use checksums
6a633abb7d4d232f02849f1894d6796d93eef99659fcbb210d4a78f53ac4fe11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Security for agi-open-network-cn 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page