mlx omni server
v0.2.1

MLX OMNI服務器是由Apple的MLX Framework提供動力的本地推理服務器,該框架專為Apple Silicon(M系列)芯片而設計。它實現了與OpenAI兼容的API端點,從而使現有的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服務器做出貢獻,請查看我們的開髮指南以獲取有關以下信息的詳細信息。
對於重大更改,請先開設一個問題,以討論您想更改的內容。
該項目是根據MIT許可證獲得許可的 - 有關詳細信息,請參見許可證文件。
該項目不隸屬於Openai或Apple。這是一個獨立的實現,可使用Apple的MLX框架提供與OpenAI兼容的API。