ドキュメンテーション
プロジェクトセットアップ
lmstudio
は PyPI で公開されているライブラリで、独自のプロジェクトで lmstudio-python
を使用できます。これはオープンソースで、GitHub で開発されています。ソースコードはこちらからご覧いただけます。
lmstudio-python は PyPI で公開されているため、pip
または任意のプロジェクト依存関係マネージャー(pdm
と uv
が例として示されていますが、他の Python プロジェクト管理ツールも同様の依存関係追加コマンドを提供しています)を使用してインストールできます。
pip install lmstudio
ドキュメント内のすべての例は、サーバーAPIがデフォルトポートでローカルに実行されていることを前提としています。クライアントインスタンスを作成する際に "host:port"
文字列を渡すことで、サーバーAPIのネットワークロケーションを上書きすることができます。
import lmstudio as lms
SERVER_API_HOST = "localhost:1234"
# This must be the *first* convenience API interaction (otherwise the SDK
# implicitly creates a client that accesses the default server API host)
lms.configure_default_client(SERVER_API_HOST)
# Note: the dedicated configuration API was added in lmstudio-python 1.3.0
# For compatibility with earlier SDK versions, it is still possible to use
# lms.get_default_client(SERVER_API_HOST) to configure the default client
このページ
lmstudio-python のインストール
サーバーAPIのホストとTCPポートをカスタマイズする