ZaltharDocs

Using your model

Calling your model

Use your fine-tuned model from code with any OpenAI-compatible client.

When a training job succeeds, its model is published to your organisation as <org-slug>/<job-name>. Pass that slug as model to the Chat completions, Completions or Responses API.

Find your model’s slug

Open Models in the console, or list the models your key can use:

curl https://api.zalthar.com/v1/models \
  -H "Authorization: Bearer $ZALTHAR_API_KEY"

Python

from openai import OpenAI
import os

client = OpenAI(
    base_url="https://api.zalthar.com/v1",
    api_key=os.environ["ZALTHAR_API_KEY"],
)

reply = client.chat.completions.create(
    model="acme/support-triage",
    messages=[{"role": "user", "content": "Where is my parcel?"}],
)
print(reply.choices[0].message.content)

TypeScript

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.zalthar.com/v1",
  apiKey: process.env.ZALTHAR_API_KEY,
});

const reply = await client.chat.completions.create({
  model: "acme/support-triage",
  messages: [{ role: "user", content: "Where is my parcel?" }],
});
console.log(reply.choices[0].message.content);

Streaming

Set stream: true to receive tokens as server-sent events. The final chunk includes token usage.

stream = client.chat.completions.create(
    model="acme/support-triage",
    messages=[{"role": "user", "content": "Write a short apology."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Timeouts

Requests to fine-tuned models can wait in a queue before they start, especially the first request after a period without traffic. Use a generous client timeout, for example several minutes, rather than the default of some HTTP libraries.

Dedicated endpoints, with your own replicas and scale-to-zero settings, are coming soon. Until then, fine-tuned models are served through the shared API described here.