OpenAI-Compatible Chat
POST /v1/chat/completions accepts the standard OpenAI chat-completions request shape and returns the standard response shape. Use an OpenAI-compatible client with the Nyquest base URL and a personal API key. Supported options depend on the selected model and provider.
Automatic model selection
You don't have to pick a model. Three equivalent spellings hand the choice to Nyquest's router, which classifies the request's complexity and routes it within your tier:
"model": "nyquest/auto"β listed inGET /v1/models, so SDK model pickers can discover it"model": "auto"- omit the
modelfield entirely
The response's model field always reports the model that actually served
the request. On free-tier keys, auto routes within the free pool.
Quick start
curl -X POST https://api.nyquest.ai/v1/chat/completions \
-H "Authorization: Bearer nq-v1-..." \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-5",
"messages": [
{"role": "user", "content": "Write a haiku about HTTP."}
]
}'Response (truncated):
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "anthropic/claude-sonnet-5",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "Haiku here..."},
"finish_reason": "stop"
}
],
"usage": {"prompt_tokens": 15, "completion_tokens": 32, "total_tokens": 47}
}Drop-in with the OpenAI SDK
The OpenAI SDK works unmodified β just change the base URL:
import OpenAI from 'openai'
const client = new OpenAI({
apiKey: process.env.NYQUEST_PAT,
baseURL: 'https://api.nyquest.ai/v1',
})
const response = await client.chat.completions.create({
model: 'anthropic/claude-sonnet-5',
messages: [
{ role: 'user', content: 'Hello!' },
],
})
console.log(response.choices[0].message.content)import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["NYQUEST_PAT"],
base_url="https://api.nyquest.ai/v1",
)
resp = client.chat.completions.create(
model="anthropic/claude-sonnet-5",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)The SDK's tools, temperature, max_tokens, top_p, stop, seed, and other standard fields are all forwarded.
Streaming
Set stream: true for SSE token-by-token output:
const stream = await client.chat.completions.create({
model: 'anthropic/claude-sonnet-5',
messages: [{ role: 'user', content: 'Tell me a story.' }],
stream: true,
})
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '')
}The SSE format follows OpenAI's: each event is data: {...}\n\n, terminated by data: [DONE]\n\n.
Models you can pass
The model field accepts any model in your accessible catalog. Get the list:
curl https://api.nyquest.ai/v1/models \
-H "Authorization: Bearer nq-v1-..."Model IDs are vendor-namespaced (vendor/model) and must be passed exactly as /v1/models returns them. A bare name such as gpt-4o will not resolve β there is no alias table, and lookup is an exact match.
Returns an OpenAI-style list with Nyquest metadata. The default limit is 200 real catalog models; use GET /v1/models?limit=500 to request a larger catalog page. The synthetic nyquest/auto entry is additional to the real-model total. Do not assume the default response is the entire catalog. Examples:
openai/gpt-4o-miniopenai/gpt-4oopenai/gpt-5.6-terraanthropic/claude-sonnet-5anthropic/claude-opus-4.8google/gemini-3.6-flashgoogle/gemini-2.5-prodeepseek/deepseek-v4-flash-0731
If you've added BYOK keys, models from those providers also appear. The platform routes the request through your BYOK key automatically.
Authentication, memory, and BYOK
| Request | Conversation history and recall | Provider selection |
|---|---|---|
| PAT chat completion | Stateless: no automatic chat-history persistence or memory recall | Managed routing, or the one active BYOK provider |
| Signed-in browser chat (JWT) | Conversation context and recall can be included | Managed routing, or the one active BYOK provider |
Saving a provider key does not activate it. Select the provider in BYOK settings; requests use that active provider rather than automatically choosing among every saved key. See BYOK Setup.
For a stateless integration, send the messages and system prompt your program needs with a PAT. The provider receives that supplied context under its own data terms.
What's different from OpenAI
| Field | OpenAI | Nyquest |
|---|---|---|
model | Only OpenAI models | Any model from the catalog |
tools (function calling) | Supported | Supported (forwarded to provider) |
response_format | JSON mode supported | Forwarded; some providers ignore |
logprobs | Supported on most models | Forwarded; some providers strip |
n (multiple completions) | Supported | Limited to n=1 currently |
seed | Supported | Forwarded; not all providers honor |
user field | Used for abuse tracking | Stored but not enforced |
Conversation header
Signed-in browser requests use x-nyquest-conversation: <conversation_id> to continue a conversation. PAT chat requests ignore this header because they are stateless.
There is no documented per-request project-selection or memory-disable header. To control a PAT requestβs context, provide the intended messages explicitly. See Authentication.
Errors and recovery
Check the HTTP status and the error body. Authentication and chat errors commonly use an error object with message and type; some endpoint-specific errors use a string instead. Do not assume every endpoint exposes the same error.code field.
- 401: check the Bearer token.
- 402: the selected paid operation needs funds; check the wallet and model.
- 415: send
Content-Type: application/json. - 429: honor
Retry-Afterand back off. - 503 or interrupted response: inspect the message and request/job status before retrying. A pending settlement or unknown provider outcome is not proof that generation failed.
See Errors and recovery. A successful response can include x-nyquest-settlement: pending; check Usage before repeating that generation. There is no general client idempotency-key/response-replay guarantee.
Cost reporting
The usage field reports provider token counts. Input and output often have different rates: estimate input tokens Γ input rate plus output tokens Γ output rate, not total tokens Γ one rate. Provider-specific cost fields may also be present.
For BYOK, the providerβs own bill is authoritative. For managed requests, use the Usage page, wallet ledger, and Savings page for settled charges and compression credits. Token counts alone do not include every pricing unit, credit, or pending settlement.
Where to next
- Endpoints Reference β non-chat endpoints
- Personal API Keys β token management
- Rate Limits and Quotas β what limits apply
- Picking a Model β model comparison