{"id":23768,"library":"fschat","title":"FastChat","description":"FastChat (fschat) is an open platform for training, serving, and evaluating large language model chatbots. Currently at version 0.2.36, it supports models like Vicuna, Llama, and many others, with features including a web UI, OpenAI-compatible API, and integration with vLLM, SGLang, and MLX. Released under the Apache 2.0 license.","status":"active","version":"0.2.36","language":"python","source_language":"en","source_url":"https://github.com/lm-sys/fastchat","tags":["llm","chatbot","serving","evaluation","training","openai-compatible"],"install":[{"cmd":"pip install fschat","lang":"bash","label":"Basic install"},{"cmd":"pip install fschat[model_worker,webui]","lang":"bash","label":"With all optional dependencies"}],"dependencies":[{"reason":"Required for model inference and training","package":"torch","optional":false},{"reason":"Hugging Face Transformers for model loading","package":"transformers","optional":false},{"reason":"Used for the web UI (gradio option)","package":"gradio","optional":true},{"reason":"Optional high-throughput serving backend","package":"vllm","optional":true},{"reason":"Optional SGLang worker for vision-language models","package":"sglang","optional":true}],"imports":[{"note":"FastChat uses submodules; direct top-level imports are rare.","wrong":"from fastchat import something","symbol":"FastChat","correct":"from fastchat.model import get_conversation_template"},{"note":"","wrong":"","symbol":"ModelWorker","correct":"from fastchat.serve.model_worker import ModelWorker"}],"quickstart":{"code":"from fastchat.model import get_conversation_template\nfrom fastchat.serve.inference import generate_stream\n\nconversation = get_conversation_template(\"vicuna\")\nconversation.append_message(conversation.roles[0], \"Hello!\")\nconversation.append_message(conversation.roles[1], None)  # assistant placeholder\nprompt = conversation.get_prompt()\n\n# Example using a local model (requires model download)\n# from fastchat.serve.model_worker import ModelWorker\n# worker = ModelWorker(controller_addr=\"http://localhost:21001\", model_names=[\"vicuna-7b-v1.5\"], worker_addr=\"http://localhost:21002\")\nprint(prompt)","lang":"python","description":"Generate a conversation prompt using the Vicuna template."},"warnings":[{"fix":"Start controller: python -m fastchat.serve.controller, then model worker, then web server.","message":"FastChat's controller uses HTTP requests; all components (controller, model worker, web server) must be started separately. Failure to start the controller first leads to connection errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Use --load-8bit for 8-bit quantization or --device cpu for CPU inference (slow).","message":"The model worker requires significant GPU memory; default settings may OOM on smaller GPUs. Adjust --num-gpus or --load-8bit accordingly.","severity":"gotcha","affected_versions":"all"},{"fix":"Use python -m fastchat.serve.gradio_web_server_multi for multiple models.","message":"The old fastchat.serve.gradio_web_server is deprecated in favor of fastchat.serve.gradio_web_server_multi (for multiple models) or the new web UI variants.","severity":"deprecated","affected_versions":">=0.2.25 <0.2.36"},{"fix":"Set OPENAI_API_BASE=http://localhost:8000/v1 in your environment.","message":"When using the OpenAI-compatible API, environment variable OPENAI_API_BASE must be set to the FastChat API server URL (e.g., http://localhost:8000/v1). Otherwise clients will try to reach the real OpenAI API.","severity":"gotcha","affected_versions":"all"},{"fix":"Use --force-reload flag on model worker if registration fails.","message":"In version 0.2.30, the default model worker registration changed; old controller may not recognize new worker without --force-reload.","severity":"breaking","affected_versions":">=0.2.30"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with: pip install fschat. (Note: pip package name is fschat, but import uses 'fastchat').","cause":"Package not installed or installed under different name (fschat, not fastchat).","error":"ModuleNotFoundError: No module named 'fastchat'"},{"fix":"Start controller first: python -m fastchat.serve.controller","cause":"The controller process is not started or is not reachable.","error":"RuntimeError: The server cannot be started because no controller is running."},{"fix":"Kill existing processes or use different ports via --port arguments.","cause":"Ports for controller (21001), model worker (21002), or web server (7860) are already occupied.","error":"OSError: [Errno 98] Address already in use"},{"fix":"Use a valid template name (e.g., 'vicuna', 'llama-2', 'mistral') or add custom template via register_template.","cause":"The model template identifier is incorrect or model not registered.","error":"ValueError: The conversation template 'vicuna' is not found."},{"fix":"Ensure --model-names argument in model worker matches the model name used by the client.","cause":"The model worker was started with a model name that doesn't match the request.","error":"AssertionError: The model name is not in the list of models."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}