Skip to Content
NineTwo's

Quickstart

Make a first request against the NineTwo's public API.

1. Set credentials

export NINETWOS_API_KEY="ntw_replace_with_your_project_api_key"
export NINETWOS_BASE_URL="https://api.ninetwos.com/v1"

Keys are project-scoped bearer tokens. They carry operation scopes and a model allowlist; they are not browser session tokens. See Authentication.

2. Discover models and capabilities

curl -sS "$NINETWOS_BASE_URL/models" \
  -H "Authorization: Bearer $NINETWOS_API_KEY"

GET /v1/models is the availability authority. An empty data array is a valid response when no model is publicly discoverable for the project.

Use the returned model ID and capability values rather than hardcoding limits:

export NINETWOS_MODEL="zuv-0.5"

The model's capabilities.limits.max_output_tokens.recommended and capabilities.limits.context_window.effective values are the safe client-side starting points. They are dynamic and profile/serving-dependent; they are not protocol constants.

3. Create a chat completion

Idempotency-Key is required on every chat completion request, including streaming requests. Use a unique key per logical operation and reuse it only with the identical payload.

curl -sS "$NINETWOS_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $NINETWOS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: quickstart-001" \
  -d '{
    "model": "zuv-0.5",
    "messages": [
      {"role": "user", "content": "Hello from the NineTwo's quickstart"}
    ],
    "max_completion_tokens": 256,
    "stream": false
  }'

max_completion_tokens is canonical. max_tokens is accepted as a compatibility alias for OpenAI editor clients. The response id is the gateway execution UUID; use it with GET /v1/requests/{id} for recovery.

4. Stream the response

Set "stream": true and consume the response as server-sent events. The response includes an X-Request-Id header. Only data: [DONE] after settlement is a successful terminal marker; a transport EOF is not.

See Chat and streaming for a complete Node.js example.

Next steps

On this page