Nexweave

Documentation

Nexweave API

Nexweave is an OpenAI-compatible gateway. Point any OpenAI SDK at your Nexweave base URL, use a Nexweave API key, and call a curated set of open models through one endpoint and one balance.

Quickstart

Nexweave speaks the same protocol as the OpenAI API, so the fastest way to start is the official OpenAI SDK. Change two things — the base URL and the API key — and everything else stays the same.

python
from openai import OpenAI

client = OpenAI(
    base_url="https://nexweave.vercel.app/api/v1",
    api_key="sk-nexweave-...",  # your Nexweave key
)

resp = client.chat.completions.create(
    model="hunyuan",
    messages=[{"role": "user", "content": "Hello from Nexweave!"}],
)

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

Authentication

Every request needs a Nexweave API key, passed as a bearer token in the Authorization header. Create keys from your dashboard. You see the full key only once, so store it somewhere safe — Nexweave keeps only a hash.

bash
Authorization: Bearer sk-nexweave-...

Your platform key balance is checked before each request. If your balance is empty, the gateway returns 402 Payment Required before contacting any provider.

Chat completions

Send a POST to /chat/completions with a model id and a list of messages. Here is a raw curl example:

bash
curl https://nexweave.vercel.app/api/v1/chat/completions \
  -H "Authorization: Bearer sk-nexweave-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-oss-20b",
    "messages": [
      {"role": "user", "content": "Explain what a model gateway is in one sentence."}
    ]
  }'

The response matches the OpenAI schema — you read the text from choices[0].message.content, and token counts come back in usage. Nexweave uses that same usage block to bill your balance, so what you are charged always matches what the provider reported.

Streaming

Set "stream": true to receive server-sent events as the model generates. Nexweave forwards the upstream stream to you unchanged.

python
stream = client.chat.completions.create(
    model="nemotron-super",
    messages=[{"role": "user", "content": "Count to five."}],
    stream=True,
)

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

A note on billing while streaming: because usage totals arrive at the end of a stream (and some providers omit them), Nexweave estimates token counts for streamed requests when the upstream does not supply them.

Models

List everything programmatically with GET /models, the same shape as OpenAI's models endpoint. Here is the current catalog and what each model costs, charged per token against your balance:

ModelProviderInput / 1MOutput / 1MContext
gpt-oss-20bopenrouter$0.20$0.40131K
nemotron-ultraopenrouter$0.20$0.401000K
nemotron-superopenrouter$0.20$0.401000K
nemotron-nanoopenrouter$0.20$0.40256K
gemma-26bopenrouter$0.20$0.40262K
lagunaopenrouter$0.20$0.40262K
north-codeopenrouter$0.20$0.40256K
nemotron-omniopenrouter$0.20$0.40256K
nemotron-nano-9bopenrouter$0.20$0.40128K
nemotron-vlopenrouter$0.20$0.40128K
autoopenrouter$0.20$0.40200K

Errors

Nexweave uses standard HTTP status codes. Errors come back in the OpenAI error shape, so existing SDK error handling works unchanged.

StatusMeaning
401Missing or invalid API key.
402Your balance is empty. Ask an admin to add credits.
404Unknown model id. Check GET /models.
429Upstream provider rate limit. Retry with backoff.
502Upstream provider error.

Ready to try it?

Sign in with GitHub, create a key, and make your first call in under a minute.

Go to dashboard