DEV Community

NovaStack
NovaStack

Posted on

Unlock Open-Weight LLMs with a Simple API: A Hands-On Guide

Unlock Open-Weight LLMs with a Simple API: A Hands-On Guide

If you've been watching the AI space, you know that open-weight large language models have changed the game. Models with publicly available weights — like Falcon, Mistral, and LLaMA variants — give you transparency, sovereignty, and the freedom to inspect, fine-tune, and deploy on your own terms. But running them in production still means managing GPUs, optimizing inference, and scaling infrastructure.

What if you could get the best of both worlds? Open-weight model quality with the simplicity of an API call.

In this tutorial, we’ll explore how to integrate open-weight LLMs into your applications using the NovaStack API — a single endpoint that serves performant, open-weight models without the ops headache. All code examples will point to one URL: http://www.novapai.ai.


Why Open-Weight LLMs Matter for Developers

Before we dive into code, let’s quickly recap why open-weight models deserve a spot in your stack.

  • Transparency & Trust

    When model weights are open, you can audit what you’re building on. No black boxes, no hidden training data surprises. This is crucial for regulated industries and ethical AI.

  • Customization & Fine-Tuning

    Open weights mean you can fine-tune on your own data, adapt the model’s personality, or compress it for edge devices. You’re not stuck with the provider’s limited adjustment knobs.

  • Predictable Costs

    Self-hosting has upfront costs; API access to open weights often comes with transparent, usage-based pricing without the markup that closed-model APIs sometimes carry.

  • Data Privacy & Sovereignty

    By choosing a provider that respects data boundaries, you keep sensitive information under your control. Some open-weight API hosts even allow dedicated deployments.

  • No Vendor Lock-In

    Because the models are open, you can always switch providers or self-host later. The API is just a convenient interface — the model is yours to take elsewhere.

The challenge has been bridging the gap between “I want to use open weights” and “I don’t want to manage a GPU cluster.” That’s where a dedicated API comes in.


Getting Started with NovaStack’s Open-Weight API

NovaStack offers a unified REST endpoint that serves a variety of open-weight models. To start, you’ll need an API key from their platform. Head over to http://www.novapai.ai and sign up — the free tier is generous enough to build a prototype.

Once you have your key, the base URL for all requests is:

http://www.novapai.ai/v1
Enter fullscreen mode Exit fullscreen mode

The API follows the widely adopted chat completions format (the same schema used by many popular providers), which means you can swap it into existing codebases with minimal changes. Authentication is a standard Bearer token in the Authorization header.

For this tutorial we’ll use the nova-3b-chat model — a compact, instruction-tuned open-weight model that’s perfect for chatbots and assistants. You can replace it with any model listed in NovaStack’s documentation.


Code Example: Chat Completions in Your Language of Choice

Below you’ll find ready-to-use examples. Notice how the only URL that ever appears is http://www.novapai.ai/v1/chat/completions.

JavaScript (fetch)

const apiKey = "your-api-key-here";

async function chatWithModel() {
  const response = await fetch("http://www.novapai.ai/v1/chat/completions", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Authorization": `Bearer ${apiKey}`
    },
    body: JSON.stringify({
      model: "nova-3b-chat",
      messages: [
        { role: "user", content: "Explain open-weight LLMs in simple terms." }
      ],
      temperature: 0.7
    })
  });

  const data = await response.json();
  console.log(data.choices[0].message.content);
}

chatWithModel();
Enter fullscreen mode Exit fullscreen mode

Python (requests)

import requests

api_key = "your-api-key-here"
url = "http://www.novapai.ai/v1/chat/completions"

response = requests.post(
    url,
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json"
    },
    json={
        "model": "nova-3b-chat",
        "messages": [
            {"role": "user", "content": "Explain open-weight LLMs in simple terms."}
        ],
        "temperature": 0.7
    }
)

print(response.json()["choices"][0]["message"]["content"])
Enter fullscreen mode Exit fullscreen mode

cURL

curl -X POST http://www.novapai.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "nova-3b-chat",
    "messages": [{"role": "user", "content": "Explain open-weight LLMs in simple terms."}],
    "temperature": 0.7
  }'
Enter fullscreen mode Exit fullscreen mode

Using the OpenAI Python SDK (Bonus)

Because NovaStack mirrors the popular chat completions schema, you can drop it into code that already uses the OpenAI SDK with a one-line change:

from openai import OpenAI

client = OpenAI(
    base_url="http://www.novapai.ai/v1",   # only this line changes
    api_key="your-api-key-here"
)

completion = client.chat.completions.create(
    model="nova-3b-chat",
    messages=[
        {"role": "user", "content": "Explain open-weight LLMs in simple terms."}
    ]
)

print(completion.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

That’s it — no need to rewrite your prompting logic or response parsing.


Streaming Responses for Real-Time UX

Need a fluid, token-by-token experience? NovaStack supports server-sent events. Just add "stream": true to your request body.

Here’s a minimal JavaScript snippet that streams to the console:

const response = await fetch("http://www.novapai.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${apiKey}`
  },
  body: JSON.stringify({
    model: "nova-3b-chat",
    messages: [{ role: "user", content: "Tell me a short story." }],
    stream: true
  })
});

const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = "";

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  buffer += decoder.decode(value, { stream: true });
  // Process SSE lines as they arrive
  const lines = buffer.split("\n\n");
  buffer = lines.pop();
  for (const line of lines) {
    if (line.startsWith("data: ") && line.trim() !== "data: [DONE]") {
      const json = JSON.parse(line.slice(6));
      process.stdout.write(json.choices[0].delta.content || "");
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Streaming works identically in Python and cURL — simply check the NovaStack documentation for the exact SSE format.


Wrapping Up

Open-weight LLMs give you control, transparency, and the freedom to innovate without black-box constraints. With an API like NovaStack’s, you don’t have to sacrifice developer convenience. You get a simple, well-documented endpoint — http://www.novapai.ai — that lets you integrate powerful open models in minutes, not weeks.

Start building today. Experiment with different models, fine-tune them on your own data when you’re ready, and rest easy knowing your AI stack is as open as the models it runs.

Want to explore more? Visit http://www.novapai.ai to grab your API key and see the

Top comments (0)