Docs

Plugsky Python SDK — drop-in OpenAI client

The fastest way to call Plugsky from Python is the official OpenAI SDK with a base_url override. pip install openai, change the base URL, ship.

Install

bash
pip install openai

Basic chat

python
from openai import OpenAI
client = OpenAI(
    api_key="sk-live-PLUGSKY-...",
    base_url="https://api.plugsky.com/v1",
)
resp = client.chat.completions.create(
    model="plugsky-pro",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)

Streaming

python
stream = client.chat.completions.create(
    model="plugsky-pro",
    messages=[{"role":"user","content":"Tell me a story"}],
    stream=True,
)
for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Function calling

python
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get weather for a city",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"]
        }
    }
}]
resp = client.chat.completions.create(
    model="plugsky-pro", messages=messages, tools=tools,
)

Embeddings

python
emb = client.embeddings.create(
    model="plugsky-embed-large",
    input="text to embed",
)
vector = emb.data[0].embedding

Try it

7-day trial for $5, no card required.

Start $5 trial →