
MLX Omni Server هو خادم استدلال محلي مدعوم من إطار MLX من Apple ، مصمم خصيصًا لشرائح Apple Silicon (M-Series). إنه ينفذ نقاط نهاية API المتوافقة مع OpenAI ، مما يتيح التكامل السلس مع عملاء Openai SDK الحاليين مع الاستفادة من قوة استنتاج ML المحلي.
ينفذ الخادم نقاط النهاية المتوافقة مع OpenAI:
/v1/chat/completions/v1/audio/speech -نص إلى كلام/v1/audio/transcriptions -الكلام إلى النص/v1/models - نماذج قائمة/v1/models/{model} - استرداد أو حذف النموذج/v1/images/generations - توليد الصور # Install using pip
pip install mlx-omni-server # If installed via pip as a package
mlx-omni-server يمكنك استخدام- --port لتحديد منفذ مختلف ، مثل: mlx-omni-server --port 10240 ، المنفذ الافتراضي هو 10240.
يمكنك عرض المزيد من معلمات بدء التشغيل باستخدام mlx-omni-server --help .
from openai import OpenAI
# Configure client to use local server
client = OpenAI (
base_url = "http://localhost:10240/v1" , # Point to local server
api_key = "not-needed" # API key is not required for local server
)
# Text-to-Speech Example
response = client . audio . speech . create (
model = "lucasnewman/f5-tts-mlx" ,
input = "Hello, welcome to MLX Omni Server!"
)
# Speech-to-Text Example
audio_file = open ( "speech.mp3" , "rb" )
transcript = client . audio . transcriptions . create (
model = "mlx-community/whisper-large-v3-turbo" ,
file = audio_file
)
# Chat Completion Example
chat_completion = client . chat . completions . create (
model = "meta-llama/Llama-3.2-3B-Instruct" ,
messages = [
{ "role" : "user" , "content" : "What can you do?" }
]
)
# Image Generation Example
image_response = client . images . generate (
model = "argmaxinc/mlx-FLUX.1-schnell" ,
prompt = "A serene landscape with mountains and a lake" ,
n = 1 ,
size = "512x512"
)يمكنك عرض المزيد من الأمثلة في الأمثلة.
نرحب بالمساهمات! إذا كنت مهتمًا بالمساهمة في MLX Omni Server ، فيرجى مراجعة دليل التطوير الخاص بنا للحصول على معلومات مفصلة حول:
للتغييرات الرئيسية ، يرجى فتح مشكلة أولاً لمناقشة ما تريد تغييره.
تم ترخيص هذا المشروع بموجب ترخيص معهد ماساتشوستس للتكنولوجيا - راجع ملف الترخيص للحصول على التفاصيل.
هذا المشروع لا ينتمي إلى Openai أو Apple. إنه تطبيق مستقل يوفر واجهات برمجة التطبيقات المتوافقة مع OpenAI باستخدام إطار MLX من Apple.