NNyquest docs

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 in GET /v1/models, so SDK model pickers can discover it
  • "model": "auto"
  • omit the model field 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

bash
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):

json
{
  "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:

javascript
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)
python
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:

javascript
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:

bash
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-mini
  • openai/gpt-4o
  • openai/gpt-5.6-terra
  • anthropic/claude-sonnet-5
  • anthropic/claude-opus-4.8
  • google/gemini-3.6-flash
  • google/gemini-2.5-pro
  • deepseek/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

RequestConversation history and recallProvider selection
PAT chat completionStateless: no automatic chat-history persistence or memory recallManaged routing, or the one active BYOK provider
Signed-in browser chat (JWT)Conversation context and recall can be includedManaged 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

FieldOpenAINyquest
modelOnly OpenAI modelsAny model from the catalog
tools (function calling)SupportedSupported (forwarded to provider)
response_formatJSON mode supportedForwarded; some providers ignore
logprobsSupported on most modelsForwarded; some providers strip
n (multiple completions)SupportedLimited to n=1 currently
seedSupportedForwarded; not all providers honor
user fieldUsed for abuse trackingStored 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-After and 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