Text Generation
MLX
Safetensors
Transformers
longcat_next
multimodal
conversational
custom_code
8-bit precision
Instructions to use mlx-community/LongCat-Next-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/LongCat-Next-8bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("mlx-community/LongCat-Next-8bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Transformers
How to use mlx-community/LongCat-Next-8bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlx-community/LongCat-Next-8bit", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("mlx-community/LongCat-Next-8bit", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use mlx-community/LongCat-Next-8bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlx-community/LongCat-Next-8bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/LongCat-Next-8bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mlx-community/LongCat-Next-8bit
- SGLang
How to use mlx-community/LongCat-Next-8bit with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "mlx-community/LongCat-Next-8bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/LongCat-Next-8bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "mlx-community/LongCat-Next-8bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/LongCat-Next-8bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Pi
How to use mlx-community/LongCat-Next-8bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/LongCat-Next-8bit"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mlx-community/LongCat-Next-8bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use mlx-community/LongCat-Next-8bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/LongCat-Next-8bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default mlx-community/LongCat-Next-8bit
Run Hermes
hermes
- OpenClaw new
How to use mlx-community/LongCat-Next-8bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/LongCat-Next-8bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "mlx-community/LongCat-Next-8bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MLX LM
How to use mlx-community/LongCat-Next-8bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mlx-community/LongCat-Next-8bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/LongCat-Next-8bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/LongCat-Next-8bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use mlx-community/LongCat-Next-8bit with Docker Model Runner:
docker model run hf.co/mlx-community/LongCat-Next-8bit
| { | |
| "add_prefix_space": false, | |
| "audio_end_token": "<longcat_audio_end>", | |
| "audio_pad_token": "<longcat_audio_pad>", | |
| "audio_start_token": "<longcat_audio_start>", | |
| "backend": "tokenizers", | |
| "bos_token": "<longcat_s>", | |
| "clean_up_tokenization_spaces": false, | |
| "eos_token": "</longcat_s>", | |
| "extra_special_tokens": [ | |
| "<mask_131048>", | |
| "<mask_131049>", | |
| "<mask_131050>", | |
| "<mask_131051>", | |
| "<mask_131052>", | |
| "<mask_131053>", | |
| "<mask_131054>", | |
| "<mask_131055>", | |
| "<mask_131056>", | |
| "<mask_131057>", | |
| "<mask_131058>", | |
| "<mask_131059>", | |
| "<mask_131060>", | |
| "<mask_131061>", | |
| "<mask_131062>", | |
| "<mask_131063>", | |
| "<mask_131064>", | |
| "<mask_131065>", | |
| "<longcat_img_token_size>", | |
| "</longcat_img_token_size>", | |
| "<mask_131068>", | |
| "<mask_131069>", | |
| "<mask_131070>", | |
| "<mask_131071>", | |
| "<longcat_point_start>", | |
| "<longcat_point_end>", | |
| "<longcat_point_delim>", | |
| "<longcat_polygon_start>", | |
| "<longcat_polygon_end>", | |
| "<mask_131077>", | |
| "<mask_131078>", | |
| "<longcat_audio_start>", | |
| "<longcat_audio_end>", | |
| "<longcat_audio_pad>", | |
| "<longcat_img_start>", | |
| "<longcat_img_end>", | |
| "<longcat_img_pad>", | |
| "<longcat_img_newline>", | |
| "<longcat_box_start>", | |
| "<longcat_box_end>", | |
| "<longcat_box_delim>", | |
| "<longcat_ref_start>", | |
| "<longcat_ref_end>", | |
| "<longcat_img_delim>", | |
| "<longcat_audio_delim>", | |
| "<longcat_video_palce>", | |
| "<longcat_video_start>", | |
| "<longcat_video_end>", | |
| "<longcat_audiotext_start>", | |
| "<longcat_audiotext_end>", | |
| "<longcat_audiotext_pad>", | |
| "<longcat_audiogen_start>", | |
| "<longcat_audiogen_end>" | |
| ], | |
| "image_end_token": "<longcat_img_end>", | |
| "image_newline_token": "<longcat_img_newline>", | |
| "image_pad_token": "<longcat_img_pad>", | |
| "image_start_token": "<longcat_img_start>", | |
| "is_local": true, | |
| "model_max_length": 131072, | |
| "model_specific_special_tokens": { | |
| "audio_end_token": "<longcat_audio_end>", | |
| "audio_pad_token": "<longcat_audio_pad>", | |
| "audio_start_token": "<longcat_audio_start>", | |
| "image_end_token": "<longcat_img_end>", | |
| "image_newline_token": "<longcat_img_newline>", | |
| "image_pad_token": "<longcat_img_pad>", | |
| "image_start_token": "<longcat_img_start>" | |
| }, | |
| "pad_token": "<longcat_pad>", | |
| "sp_model_kwargs": {}, | |
| "tokenizer_class": "TokenizersBackend", | |
| "tool_parser_type": "longcat", | |
| "unk_token": "<longcat_unk>" | |
| } | |