Skip to content
Guides

SDKs & integrations

Connect existing OpenAI and Anthropic clients to LM0.

On this page OpenAI SDKAnthropic SDKOther clients & frameworksIntegration checklist

OpenAI SDK

Install with pip install openai or npm install openai. Set the base URL to https://api.17.wtf/v1 and supply your model key. The same client can use Chat Completions and stateless Responses. Replace MODEL_ID with a catalog ID.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.17.wtf/v1",
    api_key=os.environ["LM0_API_KEY"],
)
response = client.chat.completions.create(
    model="MODEL_ID",
    messages=[{"role": "user", "content": "Hello!"}],
    max_tokens=512,
)
print(response.choices[0].message.content)

Anthropic SDK

Install with pip install anthropic. Set the Anthropic base URL to https://api.17.wtf without /v1, since the SDK adds the path. Use your LM0 model key; the SDK supplies the version header.

import os
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.17.wtf",
    api_key=os.environ["LM0_API_KEY"],
)
message = client.messages.create(
    model="MODEL_ID",
    max_tokens=512,
    messages=[{"role": "user", "content": "Hello!"}],
)
for block in message.content:
    if block.type == "text":
        print(block.text)

Other clients & frameworks

For clients with an OpenAI-compatible provider, use https://api.17.wtf/v1, your model key, and an exact catalog ID. Check whether your client appends /v1 automatically to avoid duplicated paths. Choose Chat Completions or Responses according to the client and this reference. Configure timeouts appropriate to your chosen model and workload.

Integration checklist

Keep keys in server-side configuration. Test a minimal non-streaming request first, then add streaming and tools. Compatibility covers the documented fields, not every feature of the upstream SDK. Features that require stored responses, hosted tools, audio, files, or other unlisted endpoints should not be assumed to work.