From 5c756e4a87ec6c76a5cceae447f56ef887661591 Mon Sep 17 00:00:00 2001 From: Yagil Burowski Date: Tue, 14 Apr 2026 23:37:37 -0400 Subject: [PATCH 1/2] Convert developer index pages to MDX --- 1_developer/2_rest/{index.md => index.mdx} | 20 ++-- 1_developer/2_rest/meta.json | 16 ++-- .../3_openai-compat/{index.md => index.mdx} | 14 +-- 1_developer/4_anthropic-compat/index.md | 93 ------------------- 1_developer/4_anthropic-compat/index.mdx | 25 +++++ 5 files changed, 50 insertions(+), 118 deletions(-) rename 1_developer/2_rest/{index.md => index.mdx} (90%) rename 1_developer/3_openai-compat/{index.md => index.mdx} (90%) delete mode 100644 1_developer/4_anthropic-compat/index.md create mode 100644 1_developer/4_anthropic-compat/index.mdx diff --git a/1_developer/2_rest/index.md b/1_developer/2_rest/index.mdx similarity index 90% rename from 1_developer/2_rest/index.md rename to 1_developer/2_rest/index.mdx index 5c5035f..ebb2f00 100644 --- a/1_developer/2_rest/index.md +++ b/1_developer/2_rest/index.mdx @@ -23,7 +23,7 @@ The v1 REST API includes enhanced features such as: The following endpoints are available in LM Studio's v1 REST API. - +
@@ -34,32 +34,32 @@ The following endpoints are available in LM Studio's v1 REST API. - + - + - + - - - + + + - + - + @@ -69,7 +69,7 @@ The following endpoints are available in LM Studio's v1 REST API. The table below compares the features of LM Studio's `/api/v1/chat` endpoint with OpenAI-compatible and Anthropic-compatible inference endpoints. -
Endpoint
/api/v1/chat Chat
/api/v1/models List Models
/api/v1/models/load Load
/api/v1/models/unloadUnload/api/v1/models/unloadUnload
/api/v1/models/download Download
/api/v1/models/download/status Download Status
+
diff --git a/1_developer/2_rest/meta.json b/1_developer/2_rest/meta.json index 97f3ec8..c8076c7 100644 --- a/1_developer/2_rest/meta.json +++ b/1_developer/2_rest/meta.json @@ -1,15 +1,15 @@ { - "title": "REST API", + "title": "LM STUDIO REST API", "pages": [ - "chat", - "download-status", - "download", - "endpoints", - "list", - "load", "quickstart", "stateful-chats", "streaming-events", - "unload" + "chat", + "list", + "load", + "download", + "unload", + "download-status", + "endpoints" ] } diff --git a/1_developer/3_openai-compat/index.md b/1_developer/3_openai-compat/index.mdx similarity index 90% rename from 1_developer/3_openai-compat/index.md rename to 1_developer/3_openai-compat/index.mdx index 3db2b88..e760d5b 100644 --- a/1_developer/3_openai-compat/index.md +++ b/1_developer/3_openai-compat/index.mdx @@ -7,7 +7,7 @@ index: 1 ### Supported endpoints -
Feature
+
@@ -18,33 +18,33 @@ index: 1 - + - + - + - + - +
Endpoint
/v1/models Models
/v1/responses Responses
/v1/chat/completions Chat Completions
/v1/embeddings Embeddings
/v1/completions Completions
-
+
## Set the `base url` to point to LM Studio diff --git a/1_developer/4_anthropic-compat/index.md b/1_developer/4_anthropic-compat/index.md deleted file mode 100644 index d24a538..0000000 --- a/1_developer/4_anthropic-compat/index.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: Anthropic Compatibility Endpoints -sidebar_title: Overview -description: Send Messages requests using the Anthropic-compatible API. -index: 1 ---- - -### Supported endpoints - - - - - - - - - - - - - - - - -
EndpointMethodDocs
/v1/messagesMessages
- -
- -## Using Claude Code with LM Studio - -For a full walkthrough, see: [Use Claude Code with LM Studio](/docs/integrations/claude-code). - -```bash -export ANTHROPIC_BASE_URL=http://localhost:1234 -export ANTHROPIC_AUTH_TOKEN=lmstudio -claude --model openai/gpt-oss-20b -``` - -## Authentication headers - -When Require Authentication is enabled, LM Studio accepts both `x-api-key` and the standard `Authorization: Bearer ` header. To learn more about enabling auth in LM Studio, checkout [Authentication](/docs/developer/core/authentication). - -## Set the base URL to point to LM Studio - -Point your Anthropic client (or any HTTP request) at your local LM Studio server. - -Note: The following examples assume the server port is `1234`. - -### cURL example - -```diff -- curl https://api.anthropic.com/v1/messages \ -+ curl http://localhost:1234/v1/messages \ - -H "Content-Type: application/json" \ -+ -H "x-api-key: $LM_API_TOKEN" \ - -d '{ -- "model": "claude-4-5-sonnet", -+ "model": "ibm/granite-4-micro", - "max_tokens": 256, - "messages": [ - {"role": "user", "content": "Write a haiku about local LLMs."} - ] - }' -``` - -### Python example - -```python -from anthropic import Anthropic - -client = Anthropic( - base_url="http://localhost:1234", - api_key="lmstudio", -) - -message = client.messages.create( - max_tokens=1024, - messages=[ - { - "role": "user", - "content": "Hello from LM Studio", - } - ], - model="ibm/granite-4-micro", -) - -print(message.content) -``` - -If you have not enabled Require Authentication, the `x-api-key` header is optional. -For the Python example, you can also omit `api_key` when authentication is disabled. - -If you're running into trouble, hop onto our [Discord](https://discord.gg/lmstudio) and enter the developers channel. diff --git a/1_developer/4_anthropic-compat/index.mdx b/1_developer/4_anthropic-compat/index.mdx new file mode 100644 index 0000000..facc7c4 --- /dev/null +++ b/1_developer/4_anthropic-compat/index.mdx @@ -0,0 +1,25 @@ +--- +title: Anthropic Compatibility Endpoints +sidebar_title: Overview +description: Send requests to Anthropic-compatible Messages endpoints. +index: 1 +--- + +### Supported endpoints + + + + + + + + + + + + + + + + +
EndpointMethodDocs
/v1/messagesMessages
From 10d0f150b777ba39883bfa82592a1a08491702f7 Mon Sep 17 00:00:00 2001 From: Yagil Burowski Date: Tue, 14 Apr 2026 23:47:58 -0400 Subject: [PATCH 2/2] Restore anthropic content --- 1_developer/4_anthropic-compat/index.mdx | 65 ++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/1_developer/4_anthropic-compat/index.mdx b/1_developer/4_anthropic-compat/index.mdx index facc7c4..f7602e6 100644 --- a/1_developer/4_anthropic-compat/index.mdx +++ b/1_developer/4_anthropic-compat/index.mdx @@ -23,3 +23,68 @@ index: 1 + +## Using Claude Code with LM Studio + +For a full walkthrough, see: [Use Claude Code with LM Studio](/docs/integrations/claude-code). + +```bash +export ANTHROPIC_BASE_URL=http://localhost:1234 +export ANTHROPIC_AUTH_TOKEN=lmstudio +claude --model openai/gpt-oss-20b +``` + +## Authentication headers + +When Require Authentication is enabled, LM Studio accepts both `x-api-key` and the standard `Authorization: Bearer ` header. To learn more about enabling auth in LM Studio, see [Authentication](/docs/developer/core/authentication). + +## Set the base URL to point to LM Studio + +Point your Anthropic client, or any HTTP request, at your local LM Studio server. + +Note: The following examples assume the server port is `1234`. + +### cURL example + +```diff +- curl https://api.anthropic.com/v1/messages \ ++ curl http://localhost:1234/v1/messages \ + -H "Content-Type: application/json" \ ++ -H "x-api-key: $LM_API_TOKEN" \ + -d '{ +- "model": "claude-4-5-sonnet", ++ "model": "ibm/granite-4-micro", + "max_tokens": 256, + "messages": [ + {"role": "user", "content": "Write a haiku about local LLMs."} + ] + }' +``` + +### Python example + +```python +from anthropic import Anthropic + +client = Anthropic( + base_url="http://localhost:1234", + api_key="lmstudio", +) + +message = client.messages.create( + max_tokens=1024, + messages=[ + { + "role": "user", + "content": "Hello from LM Studio", + } + ], + model="ibm/granite-4-micro", +) + +print(message.content) +``` + +If you have not enabled Require Authentication, the `x-api-key` header is optional. For the Python example, you can also omit `api_key` when authentication is disabled. + +If you're running into trouble, hop onto our [Discord](https://discord.gg/lmstudio) and enter the developers channel.