NovaKitv1.0

Chat Completions

Generate text completions with state-of-the-art language models

Chat Completions

Generate chat completions using GPT-4, Claude, Gemini, Llama, and 200+ other top language models. This endpoint is fully OpenAI SDK compatible.

OpenAI Compatible: This endpoint works with the OpenAI SDK - just change the base URL to https://www.novakit.ai/api/v1

Try it Now

Test the Chat Completions API directly in your browser:

Endpoint

POST /chat/completions
POST /chat/completions?stream=true

Required scope: chat

Request Body

{
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello!"}
  ],
  "model": "openai/gpt-4o-mini",
  "temperature": 0.7,
  "max_tokens": 2048,
  "stream": false,
  "web_search": false,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0
}

Parameters

ParameterTypeRequiredDefaultDescription
messagesarrayYes-Array of message objects with role and content
modelstringNoopenai/gpt-4o-miniModel ID from /models endpoint
temperaturenumberNo0.7Sampling temperature (0-2). Higher = more creative
max_tokensnumberNo2048Maximum tokens to generate
streambooleanNofalseEnable Server-Sent Events (SSE) streaming
web_searchbooleanNofalseEnable web search for real-time information
top_pnumberNo1Nucleus sampling threshold (0-1)
frequency_penaltynumberNo0Reduce repetition of tokens (-2 to 2)
presence_penaltynumberNo0Encourage topic diversity (-2 to 2)
stopstring|arrayNo-Stop sequences to end generation
userstringNo-Unique user ID for tracking

Message Object

FieldTypeRequiredDescription
rolestringYesOne of: system, user, assistant, tool
contentstringYesThe message content
imagesarrayNoArray of image URLs for vision models (up to 4)
namestringNoOptional name for the participant

Vision Support: When using images, ensure you're using a vision-capable model like openai/gpt-4o, anthropic/claude-3.5-sonnet, or google/gemini-1.5-pro.

Response

{
  "id": "chatcmpl-1234567890",
  "object": "chat.completion",
  "created": 1703123456,
  "model": "openai/gpt-4o-mini",
  "model_tier": "standard",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 8,
    "total_tokens": 20,
    "credits_used": 5,
    "credits_breakdown": {"base": 5},
    "tokens_remaining_estimate": 99980
  }
}

Examples

curl -X POST https://www.novakit.ai/api/v1/chat/completions \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "system", "content": "You are a helpful coding assistant."},
      {"role": "user", "content": "Write a Python function to calculate factorial"}
    ],
    "model": "openai/gpt-4o-mini",
    "max_tokens": 500
  }'
import requests

response = requests.post(
    "https://www.novakit.ai/api/v1/chat/completions",
    headers={
        "Authorization": "Bearer sk_your_api_key",
        "Content-Type": "application/json"
    },
    json={
        "messages": [
            {"role": "system", "content": "You are a helpful coding assistant."},
            {"role": "user", "content": "Write a Python function to calculate factorial"}
        ],
        "model": "openai/gpt-4o-mini",
        "max_tokens": 500
    }
)

print(response.json()["choices"][0]["message"]["content"])
const response = await fetch(
  "https://www.novakit.ai/api/v1/chat/completions",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer sk_your_api_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      messages: [
        { role: "system", content: "You are a helpful coding assistant." },
        { role: "user", content: "Write a Python function to calculate factorial" }
      ],
      model: "openai/gpt-4o-mini",
      max_tokens: 500,
    }),
  }
);

const data = await response.json();
console.log(data.choices[0].message.content);
from openai import OpenAI

client = OpenAI(
    api_key="sk_your_api_key",
    base_url="https://www.novakit.ai/api/v1"
)

response = client.chat.completions.create(
    model="openai/gpt-4o-mini",
    messages=[
        {"role": "system", "content": "You are a helpful coding assistant."},
        {"role": "user", "content": "Write a Python function to calculate factorial"}
    ],
    max_tokens=500
)

print(response.choices[0].message.content)

Streaming

Enable streaming to receive tokens as they're generated:

from openai import OpenAI

client = OpenAI(
    api_key="sk_your_api_key",
    base_url="https://www.novakit.ai/api/v1"
)

stream = client.chat.completions.create(
    model="openai/gpt-4o-mini",
    messages=[{"role": "user", "content": "Write a short story"}],
    stream=True
)

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

Vision (Image Analysis)

Send images for analysis with vision-capable models:

response = client.chat.completions.create(
    model="openai/gpt-4o",
    messages=[{
        "role": "user",
        "content": "What's in this image?",
        "images": ["https://example.com/image.jpg"]
    }]
)

Enable web search for up-to-date information:

curl -X POST https://www.novakit.ai/api/v1/chat/completions \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [{"role": "user", "content": "What are the latest AI news?"}],
    "web_search": true
  }'

Available Models

NovaKit provides access to 200+ models via OpenRouter. Here are some popular choices:

OpenAI Models

ModelContextBest ForTier
openai/gpt-4o128KComplex reasoning, vision, codingStandard
openai/gpt-4o-mini128KFast, cost-effective, general useBasic
openai/gpt-4-turbo128KHighest quality OpenAI modelPowerful
openai/o1-preview128KAdvanced reasoning, mathPowerful
openai/o1-mini128KFast reasoning tasksStandard

Anthropic Models

ModelContextBest ForTier
anthropic/claude-3.5-sonnet200KBest balance of speed & qualityStandard
anthropic/claude-3-opus200KMost capable, complex analysisPowerful
anthropic/claude-3-haiku200KUltra-fast, cost-effectiveBasic

Google Models

ModelContextBest ForTier
google/gemini-1.5-pro1MMassive context, multimodalStandard
google/gemini-1.5-flash1MFast, large contextBasic
google/gemini-2.0-flash1MLatest Gemini, fastBasic

Open Source Models

ModelContextBest ForTier
meta-llama/llama-3.1-405b128KBest open-source, reasoningPowerful
meta-llama/llama-3.1-70b128KStrong general purposeStandard
meta-llama/llama-3.1-8b128KFast, lightweightBasic
mistralai/mixtral-8x22b64KCoding, analysisStandard
deepseek/deepseek-chat64KCoding, mathStandard

Use the Models endpoint to get the complete list of 200+ available models with real-time pricing and availability.

Model Tiers & Credits

Different model tiers consume credits at different rates:

TierMultiplierDescription
Basic1xFast, cost-effective models
Standard1.5-2xBalanced quality and speed
Powerful2-3xHighest capability models

Error Handling

StatusCodeDescription
400invalid_requestMalformed request body
401unauthorizedInvalid or missing API key
402quota_exceededToken quota exhausted
403forbiddenAPI key missing chat scope
429rate_limitedToo many requests
500server_errorInternal error (retry safe)
{
  "error": "Quota exceeded for chat_tokens",
  "code": "quota_exceeded",
  "remaining": 0
}

On this page