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.
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.
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:
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.
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:
| Model | Provider | Input / 1M | Output / 1M | Context |
|---|---|---|---|---|
gpt-oss-20b | openrouter | $0.20 | $0.40 | 131K |
nemotron-ultra | openrouter | $0.20 | $0.40 | 1000K |
nemotron-super | openrouter | $0.20 | $0.40 | 1000K |
nemotron-nano | openrouter | $0.20 | $0.40 | 256K |
gemma-26b | openrouter | $0.20 | $0.40 | 262K |
laguna | openrouter | $0.20 | $0.40 | 262K |
north-code | openrouter | $0.20 | $0.40 | 256K |
nemotron-omni | openrouter | $0.20 | $0.40 | 256K |
nemotron-nano-9b | openrouter | $0.20 | $0.40 | 128K |
nemotron-vl | openrouter | $0.20 | $0.40 | 128K |
auto | openrouter | $0.20 | $0.40 | 200K |
Errors
Nexweave uses standard HTTP status codes. Errors come back in the OpenAI error shape, so existing SDK error handling works unchanged.
| Status | Meaning |
|---|---|
401 | Missing or invalid API key. |
402 | Your balance is empty. Ask an admin to add credits. |
404 | Unknown model id. Check GET /models. |
429 | Upstream provider rate limit. Retry with backoff. |
502 | Upstream 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