Nexith Core is now serving on our own sovereign GPU cluster — cache hits save up to 90%, OpenAI-compatible.Learn more
Nexith
Sign Up

Quickstart


Nexith Core is OpenAI-compatible. If you already use the OpenAI SDK, you only need to change two lines.

Install the SDK

bash
pip install openai

Make your first request

python
from openai import OpenAI

client = OpenAI(
    api_key="nx-your-key",
    base_url="https://api.nexith.ai/v1",
)

response = client.chat.completions.create(
    model="nexith-core",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)

TypeScript / Node.js

typescript
import OpenAI from "openai";

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

const response = await client.chat.completions.create({
  model: "nexith-core",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);

Authentication


All API requests require an API key. Nexith API keys are prefixed with nx-.

Get an API Key

Generate a key at platform.nexith.ai/api-keys. Keys are shown only once — store them securely.

Pass the Key

Include your key in the Authorization header of every request:

http
Authorization: Bearer nx-your-key

Never expose your API key in client-side code or public repositories. Use environment variables or a secrets manager.

Models


Nexith currently offers one flagship model with additional models planned for release.

ModelContextInput PriceOutput Price
nexith-core1M$4.00 / 1M tokens$20.00 / 1M tokens

Prices are per 1 million tokens. The nexith-core model supports a 1M context window, up to 128K output tokens, and OpenAI-compatible streaming chat completions. Cached input is billed at $0.40 / 1M tokens.

Chat Completions


The Chat Completions endpoint generates a model response given a list of messages.

POSThttps://api.nexith.ai/v1/chat/completions

Request Body

json
{
  "model": "nexith-core",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello!"}
  ],
  "stream": true,
  "max_tokens": 2048,
  "temperature": 0.7
}

Parameters

ParameterTypeRequiredDescription
modelstringrequiredModel ID to use. Currently: nexith-core
messagesarrayrequiredArray of message objects with role and content.
streambooleanoptionalIf true, returns a stream of SSE events instead of a single response.
max_tokensintegeroptionalMaximum tokens to generate. Default: model max.
temperaturenumberoptionalSampling temperature between 0 and 2. Higher values produce more varied output.
top_pnumberoptionalNucleus sampling probability mass. Default: 1.
nintegeroptionalNumber of completions to generate. Default: 1.
stopstring | arrayoptionalUp to 4 sequences where the API will stop generating further tokens.

Streaming


When stream: true is set, the API returns a stream of Server-Sent Events (SSE). Each event contains a chunk of the response. The stream ends with a data: [DONE] message.

curl Example

bash
curl https://api.nexith.ai/v1/chat/completions \
  -H "Authorization: Bearer nx-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nexith-core",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": true
  }'

SSE Event Format

text
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","model":"nexith-core","choices":[{"delta":{"content":"Hello"},"index":0}]}

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","model":"nexith-core","choices":[{"delta":{"content":"!"},"index":0}]}

data: [DONE]

Each data: line is a JSON object with a choices[0].delta.content field containing the next token(s). Accumulate these to reconstruct the full response.

Rate Limits


Every API key has per-minute rate limits applied at the gateway level.

Default Limits

PlanRPMTPM
Free10100,000
Pro3003,000,000
EnterpriseCustomCustom

Response Headers

Every API response includes rate limit headers so you can track your remaining quota:

http
X-RateLimit-Limit-Requests: 10
X-RateLimit-Remaining-Requests: 7
X-RateLimit-Reset: 1720000000

When rate limited (HTTP 429), a Retry-After header indicates how many seconds to wait before retrying:

http
Retry-After: 30

Handling Rate Limits

Check for HTTP 429 responses and retry after the Retry-After header value. The example below uses exponential backoff:

python
import time
import openai

client = openai.OpenAI(api_key="nx-...", base_url="https://api.nexith.ai/v1")

def chat_with_retry(messages, max_retries=3):
    for i in range(max_retries):
        try:
            return client.chat.completions.create(
                model="nexith-core",
                messages=messages
            )
        except openai.RateLimitError as e:
            if i < max_retries - 1:
                time.sleep(2 ** i)  # exponential backoff
            else:
                raise

Python SDK


The official OpenAI Python SDK works out of the box with Nexith. Pass base_url and your Nexith API key when constructing the client.

bash
pip install openai
python
from openai import OpenAI

client = OpenAI(
    api_key="nx-your-key",
    base_url="https://api.nexith.ai/v1",
)

response = client.chat.completions.create(
    model="nexith-core",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)

TypeScript SDK


Install the OpenAI npm package and point it at the Nexith base URL. Fully typed with TypeScript support.

bash
npm install openai
typescript
import OpenAI from "openai";

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

const response = await client.chat.completions.create({
  model: "nexith-core",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);
Nexith — Frontier AI Models | Nexith