TypeScript SDK

Configure the OpenAI SDK with the Zokasta base URL.

Use the OpenAI SDK from server-side TypeScript. Set ZOKASTA_API_KEY in the environment that runs the code.

  1. Install the SDK

    Run this in your project.

    Terminal
    npm install openai
  2. Configure the client

    Use a base URL ending in /v1.

    TypeScript
    import OpenAI from "openai";
    
    const apiKey = process.env.ZOKASTA_API_KEY;
    if (!apiKey) throw new Error("Set ZOKASTA_API_KEY first.");
    
    const client = new OpenAI({
      baseURL: "https://api.zokasta.com/v1",
      apiKey,
    });
  3. Call a model

    Use an ID from your OpenAI model list.

    TypeScript
    const response = await client.chat.completions.create({
      model: "gpt-5.6-sol",
      messages: [{ role: "user", content: "Hello" }],
      max_completion_tokens: 64,
    });
    
    console.log(response.choices[0]?.message.content);