Skip to content
NewNexus 2.0 is here, and it’s open source. Read the launch post

API reference

Analytics

Usage over a date range grouped by team, person, model, provider, product, key or day. Owners and admins see the organization; members see their own usage and their teams'. by team, depth and under roll spend up the tree of teams.

View as Markdown

Usage

get/v1/analytics/usage

Usage over a date range (UTC days, inclusive; at most 366): totals, groups with their share, and a daily series. Spend with no team is the Unassigned group. Owners and admins see the organization; members their own usage and their teams', with teammates as one row by person. An agent link sees only its person's own calls, as person=me does for anyone. with groupBy=team, depth and under roll spend up the tree: each group includes its teams below; spend on a team that has child teams, above the depth shown, is its own (direct) group. Members see rollups only from their own teams down. With groupBy=key, each key shows by its name and prefix, never its token. A revoked key keeps its name and says revoked. A person's Nexus UI sessions are one group. A member sees the keys of their own calls. All other calls in their teams are one Others row. A member's own call with no key is Unassigned. With groupBy=hour, each group is one UTC hour with calls (YYYY-MM-DDTHH), in order, under the same scope as by day; the series stays by day.

spend.read_ownEvery memberTry it in the API Explorer

Parameters

  • groupByquery · "team" | "person" | "model" | "provider" | "product" | "key" | "day" | "hour"

    How to group (default team)

  • fromquery · string (date)

    YYYY-MM-DD; default 29 days before to

  • toquery · string (date)

    YYYY-MM-DD; default today

  • teamquery · string

    Only this team's usage and its child teams' (slug); members: their own teams and the teams under them

  • depthquery · integer

    GroupBy=team: roll up to the teams at this depth (1 = top level; with under, counted below it)

  • underquery · string

    GroupBy=team: roll up to the child teams of this team (slug)

  • personquery · "me"

    me: only your own calls, under every groupBy, and scope is own. No other value is accepted (400).

Responses

200OKapplication/json

  • fromstring (date)required
  • tostring (date)required
  • groupBy"team" | "person" | "model" | "provider" | "product" | "key" | "day"required
  • scope"org" | "member" | "own"required

    org: the whole organization (owners and admins); member: your own usage and that of your teams and the teams under them; own: only your own calls (an agent link, or person=me).

  • teamobject
    • idstring
    • slugstring
    • namestring
  • totalsobjectrequired
    • spentUsdnumber

      Deprecated: read spentUsdDecimal, the exact decimal string (root rule 9).

    • spentUsdDecimalstring | null

      spentUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to spentUsd. null for a total, group or day with no call at all (root rule 9's empty day), where spentUsd is 0.

    • callsinteger
    • inputTokensinteger
    • outputTokensinteger
    • callsByStatusobject

      Calls by status, refused calls included. calls counts settled, failed and released calls only.

      • settledintegerrequired
      • failedintegerrequired
      • refusedintegerrequired
      • releasedintegerrequired
    • errorRatenumber | null

      (failed + refused) / (settled + failed + refused), 0-1. Released calls count in neither part. null when there are no such calls.

    • overspendPreventedobject

      The refused calls a spend limit stopped in the period, and what they asked to hold (amountMicros of the record's overspendPrevented, not what they would have cost), in all and by the level whose limit refused them. A refusal at a level other than these four counts nowhere. Zeros, not null, when no limit stopped a call. It equals the spend file's rows with an overspendLevel over the same days.

      • callsintegerrequired
      • amountUsdnumberrequired

        Deprecated: read amountUsdDecimal, the exact decimal string (root rule 9).

      • amountUsdDecimalstring

        amountUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to amountUsd.

      • byLevelobjectrequired
        • organizationobjectrequired
          • callsintegerrequired
          • amountUsdnumberrequired

            Deprecated: read amountUsdDecimal, the exact decimal string (root rule 9).

          • amountUsdDecimalstring

            amountUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to amountUsd.

        • teamobjectrequired
          • callsintegerrequired
          • amountUsdnumberrequired

            Deprecated: read amountUsdDecimal, the exact decimal string (root rule 9).

          • amountUsdDecimalstring

            amountUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to amountUsd.

        • personobjectrequired
          • callsintegerrequired
          • amountUsdnumberrequired

            Deprecated: read amountUsdDecimal, the exact decimal string (root rule 9).

          • amountUsdDecimalstring

            amountUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to amountUsd.

        • productobjectrequired

          A product's monthly cap.

          • callsintegerrequired
          • amountUsdnumberrequired

            Deprecated: read amountUsdDecimal, the exact decimal string (root rule 9).

          • amountUsdDecimalstring

            amountUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to amountUsd.

  • groupsarray of objectrequired
    • keystring

      Team id, user id, model, provider, product/capability, key id or day; ui:<user id> for a person's Nexus UI sessions; unassigned for no team (or person, or key); others for a member's teammates (or their keys).

    • labelstring
    • sharenumber
    • slugstring
    • namestring

      Keys: the key's name, when it has one.

    • prefixstring

      Keys: the first characters of the token, to recognise it. Never the token.

    • deletedboolean

      A team deleted since, or a key that no store holds. A key shows its id.

    • revokedboolean

      Keys: the key is revoked. It keeps its name and prefix, and its label ends with , revoked.

    • spentUsdnumber

      Deprecated: read spentUsdDecimal, the exact decimal string (root rule 9).

    • spentUsdDecimalstring | null

      spentUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to spentUsd. null for a total, group or day with no call at all (root rule 9's empty day), where spentUsd is 0.

    • callsinteger
    • inputTokensinteger
    • outputTokensinteger
    • callsByStatusobject

      Calls by status, refused calls included. calls counts settled, failed and released calls only.

      • settledintegerrequired
      • failedintegerrequired
      • refusedintegerrequired
      • releasedintegerrequired
    • errorRatenumber | null

      (failed + refused) / (settled + failed + refused), 0-1. Released calls count in neither part. null when there are no such calls.

    • depthinteger

      Teams: how deep the team sits (1 = top level).

    • levelstring
    • hasChildrenboolean

      Rollups: the team has child teams; drill in with under=<slug>.

    • directboolean

      Rollups: spend attributed to the team itself, not to the teams under it (key <teamId>:direct).

    • productstring

      By team, key product:<product>/<capability>: a module's own calls, with no team and no person (a review a GitHub event started). The module's product.

    • capabilitystring

      By team, key product:<product>/<capability>: the module's capability.

  • seriesarray of objectrequired
    • daystring (date)
    • groupsobject

      Spend per group key that day. Deprecated: read groupsDecimal, the same spend as exact decimal strings (root rule 9).

    • groupsDecimalobject

      groups with each spend as an exact decimal string in US dollars with six decimals, from the micro-dollars. Prefer it to groups.

    • spentUsdnumber

      Deprecated: read spentUsdDecimal, the exact decimal string (root rule 9).

    • spentUsdDecimalstring | null

      spentUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to spentUsd. null for a total, group or day with no call at all (root rule 9's empty day), where spentUsd is 0.

    • callsinteger
    • inputTokensinteger
    • outputTokensinteger
    • callsByStatusobject

      Calls by status, refused calls included. calls counts settled, failed and released calls only.

      • settledintegerrequired
      • failedintegerrequired
      • refusedintegerrequired
      • releasedintegerrequired
    • errorRatenumber | null

      (failed + refused) / (settled + failed + refused), 0-1. Released calls count in neither part. null when there are no such calls.

  • depthinteger

    Rollups: the depth shown, from the top level.

  • underobject
    • idstring
    • slugstring
    • namestring
    • levelstring
    • patharray of TeamLink
      • idstringrequired
      • slugstringrequired
      • namestringrequired
      • levelstring

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl "$NEXUS_URL/v1/analytics/usage" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.usage({ groupBy: "team", from: "2026-10-01", to: "2026-10-16", depth: "1" });

Export usage CSV

get/v1/analytics/usage/export.csv

The organization's usage, one row per day, team, person, model, provider and product, as CSV (owners and admins). At most 100,000 rows a file: past that the file stops, and its manifest says complete: false and gives nextCursor. Each export is an audit event (observability.exported) with the file's manifest, never its rows. An organization runs at most 60 exports an hour: the 61st is a 429 export_rate_limited, whose Retry-After is the seconds until the hour frees one (the RateLimit-* headers stay the per-minute limit's). A bad filter is a 400 before any row.

spend.exportOwner, AdminTry it in the API Explorer

Parameters

  • fromquery · string (date)

    The first UTC day, YYYY-MM-DD; default 29 days before to

  • toquery · string (date)

    The last UTC day, YYYY-MM-DD, included; default today. A range covers at most 366 days

  • teamquery · string

    A team slug or id: that team and every team under it; unassigned for calls with no team

  • personquery · string

    A person's user id

  • modelquery · string

    A model, as the rows name it; - for the calls with none (released calls), as Analytics groups them

  • providerquery · string

    A provider, as the rows name it; - for the calls with none (refused and released calls), as Analytics groups them

  • productquery · string

    A product (agents) or a product and capability (intelligence/wiki): Analytics' group key

  • cursorquery · string

    A cut file's manifest.nextCursor: the next file of the same query. A manifest's watermark also works: it starts the same series again. It is bound to the organization, the caller and the query: anywhere else it is a 400 invalid_cursor

Responses

200CSV with a header row: one column per field of `UsageRow`, in its order.text/csv

string

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429export_rate_limitedThe 61st is a 429 `export_rate_limited`, whose `Retry-After` is the seconds until the hour frees one (the `RateLimit-*` headers stay the per-minute limit's)
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl "$NEXUS_URL/v1/analytics/usage/export.csv" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.usageExport("csv", { team: "platform" });

Export usage JSON Lines

get/v1/analytics/usage/export.jsonl

The organization's usage, one row per day, team, person, model, provider and product, as JSON Lines (owners and admins). At most 100,000 rows a file: past that the file stops, and its manifest says complete: false and gives nextCursor. Each export is an audit event (observability.exported) with the file's manifest, never its rows. An organization runs at most 60 exports an hour: the 61st is a 429 export_rate_limited, whose Retry-After is the seconds until the hour frees one (the RateLimit-* headers stay the per-minute limit's). A bad filter is a 400 before any row.

spend.exportOwner, AdminTry it in the API Explorer

Parameters

  • fromquery · string (date)

    The first UTC day, YYYY-MM-DD; default 29 days before to

  • toquery · string (date)

    The last UTC day, YYYY-MM-DD, included; default today. A range covers at most 366 days

  • teamquery · string

    A team slug or id: that team and every team under it; unassigned for calls with no team

  • personquery · string

    A person's user id

  • modelquery · string

    A model, as the rows name it; - for the calls with none (released calls), as Analytics groups them

  • providerquery · string

    A provider, as the rows name it; - for the calls with none (refused and released calls), as Analytics groups them

  • productquery · string

    A product (agents) or a product and capability (intelligence/wiki): Analytics' group key

  • cursorquery · string

    A cut file's manifest.nextCursor: the next file of the same query. A manifest's watermark also works: it starts the same series again. It is bound to the organization, the caller and the query: anywhere else it is a 400 invalid_cursor

Responses

200JSON Lines: one `UsageRow` per line, then one line `{"manifest": ExportManifest}`.application/jsonl

string

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429export_rate_limitedThe 61st is a 429 `export_rate_limited`, whose `Retry-After` is the seconds until the hour frees one (the `RateLimit-*` headers stay the per-minute limit's)
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl "$NEXUS_URL/v1/analytics/usage/export.jsonl" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
TypeScript · @nexus/kit
import { createCoreClient } from "@nexus/kit";

const core = createCoreClient({ baseUrl: process.env.NEXUS_URL!, apiKey: process.env.NEXUS_API_KEY });
const result = await core.usageExport("jsonl", { team: "platform" });

Get agent adoption

get/v1/analytics/agents

Agent adoption: for each UTC day of a range (inclusive; at most 366), the people whose agent calls (nexus claude, nexus codex) went through the agent gateway, with their email and how many calls. Refused calls are left out. Each day also lists the people with only subscription sessions that day. Each day also counts the active engineers by product: the people with at least one non-refused call that day, and for agents the people with only subscription sessions too. Owners and admins see the organization; members only themselves.

spend.read_ownEvery memberTry it in the API Explorer

Parameters

  • fromquery · string (date)

    YYYY-MM-DD; default 29 days before to

  • toquery · string (date)

    YYYY-MM-DD; default today

Responses

200OKapplication/json

  • fromstring (date)required
  • tostring (date)required
  • scope"org" | "member"required
  • daysarray of objectrequired

    Every day from from to to, oldest first; a day without agent calls has no people. Each day also counts its active engineers by product: the people with at least one non-refused call that day, and for agents the people with only subscription sessions too. A day with no such person has engineers 0 and no products.

    • daystring (date)required
    • peoplearray of objectrequired
      • userIdstringrequired
      • emailstring | nullrequired
      • callsintegerrequired

        min 1

    • subscriptionarray of objectrequired

      People with subscription sessions that day (their own Claude or ChatGPT plan) and no agent call through Gateway. A session counts when it reports its first model call. A person on both routes that day is in people only. Gateway keeps these counts for 367 days; days before Gateway counted them have none.

      • userIdstringrequired
      • emailstring | nullrequired
      • sessionsintegerrequired

        min 1

    • engineersintegerrequired

      Distinct active engineers that day over every product: a person with at least one non-refused call, or with a subscription session for agents.

      min 0

    • productsarray of objectrequired

      Active engineers by product slug (core, agents, chat), sorted by product, only products with someone. A person counts once per product, so these can add up to more than engineers. For agents the subscription-only people count too.

      • productstringrequired
      • engineersintegerrequired

        min 1

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl "$NEXUS_URL/v1/analytics/agents" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Get chat usage

get/v1/analytics/chat

Chat sessions in numbers, never content or titles: sessions, messages, people and cost by mode and team (and person, for owners and admins). Members see their own.

spend.read_ownEvery memberTry it in the API Explorer

Parameters

  • daysquery · integer

Responses

200OKapplication/json

  • scope"org" | "own"
  • daysinteger
  • sincestring (date-time)
  • retentionDaysinteger
  • totalsobject & object
    • sessionsinteger
    • messagesinteger
    • costUsdnumber

      Deprecated: read costUsdDecimal, the exact decimal string (root rule 9).

    • costUsdDecimalstring

      costUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to costUsd.

    • peopleinteger
  • byModeobject
    • chatobject
      • sessionsinteger
      • messagesinteger
      • costUsdnumber

        Deprecated: read costUsdDecimal, the exact decimal string (root rule 9).

      • costUsdDecimalstring

        costUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to costUsd.

    • askobject
      • sessionsinteger
      • messagesinteger
      • costUsdnumber

        Deprecated: read costUsdDecimal, the exact decimal string (root rule 9).

      • costUsdDecimalstring

        costUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to costUsd.

  • byTeamarray of object & object
    • sessionsinteger
    • messagesinteger
    • costUsdnumber

      Deprecated: read costUsdDecimal, the exact decimal string (root rule 9).

    • costUsdDecimalstring

      costUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to costUsd.

    • teamstring | null
  • byPersonarray of object & object

    Owners and admins

    • sessionsinteger
    • messagesinteger
    • costUsdnumber

      Deprecated: read costUsdDecimal, the exact decimal string (root rule 9).

    • costUsdDecimalstring

      costUsd as an exact decimal string in US dollars with six decimals ("12.245000"), from the micro-dollars. Prefer it to costUsd.

    • userIdstring
    • emailstring

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute

Example

curl
curl "$NEXUS_URL/v1/analytics/chat" \
  -H "Authorization: Bearer $NEXUS_API_KEY"