Plain SDKs

Plain SDKs

Because Hisoka serves the real wire protocols rather than a lookalike, the official SDKs
work unchanged. Only the base URL changes.

OpenAI Python

from openai import OpenAI

client = OpenAI(
    api_key="sk-your-key-here",
    base_url="https://hisoka.ai/api/v1",
)

reply = client.chat.completions.create(
    model="glm-5.3-flash",
    messages=[{"role": "user", "content": "Name three prime numbers."}],
)

print(reply.choices[0].message.content)
print(reply.model_extra.get("hisoka"))

The hisoka block is an extra field, so it lands in model_extra rather than a typed
attribute. That is expected: the SDK ignores fields it does not know about, which is why
adding it did not require a fork.

OpenAI Node

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "sk-your-key-here",
  baseURL: "https://hisoka.ai/api/v1",
});

const reply = await client.chat.completions.create({
  model: "glm-5.3-flash",
  messages: [{ role: "user", content: "Name three prime numbers." }],
});

console.log(reply.choices[0].message.content, reply.hisoka);

Streaming

stream = client.chat.completions.create(
    model="glm-5.3-flash",
    messages=[{"role": "user", "content": "Count to five."}],
    stream=True,
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Tokens are forwarded as they arrive rather than buffered until the turn ends, so the first
token appears in well under a second on a model that supports it.

Anthropic SDK

from anthropic import Anthropic

client = Anthropic(
    api_key="sk-your-key-here",
    base_url="https://hisoka.ai/api/v1",
)

message = client.messages.create(
    model="glm-5.3-flash",
    max_tokens=256,
    messages=[{"role": "user", "content": "Name three prime numbers."}],
)

print(message.content[0].text)

Listing models from an SDK

for model in client.models.list().data:
    print(model.id, model.pricing if hasattr(model, "pricing") else "")

The catalogue is public, so this works even before you set a key.

Tool calling

Tools and tool_choice are passed through in the shape the SDK serialises. function.arguments
may arrive as a JSON string or as an object depending on the client; both are accepted and
normalised before the upstream call, so a client that sends an object does not produce a
provider error.

What is not supported

  • Batch APIs. There is no batch queue; a request is a request.
  • Fine-tuning. Not offered.
  • Files and assistants. Those OpenAI endpoints do not exist here. A request to them
    answers 404 not_found with the standard error envelope rather than hanging.