Browse documentation
API ReferenceGet Model GET

Get Model

Retrieve detailed configuration and real-time metadata for a specific model by ID, including context limits, list pricing, and tenant access entitlements.

Last updated

The /v1/models/{model_id} endpoint retrieves detailed configuration and operational metadata for a single model or smart router alias by its unique identifier. Use this endpoint to verify model availability, inspect provider ownership, and confirm tenant access entitlements before issuing high-volume inference batches.

GET https://api.nrouter.ai/v1/models/{model_id}
Single Model
Direct Inspection

Lookup configuration and access permissions for any specific model ID.

Turnaround Time
Sub-10ms Cache

Served directly from in-memory gateway routing tables with zero DB latency.

Cost Invariant
$0 Metadata Spend

Metadata discovery incurs zero token billing and no credit reservation holds.

Security Model
ACL Enforcement

Returns 404 if the requested model is not permitted under your tenant policy.


Architectural Role & Lifecycle

When an application queries /v1/models/{model_id}, nRouter executes a rapid validation sequence:

  1. Phase 1: In-Memory Key Auth & Model ACL: Hashes the virtual key (sk-nrouter-...) and checks if the model exists in nRouter's global catalog and whether the caller's organization has permissions to access it.
  2. Dynamic Resolution: If the requested identifier is a concrete model (e.g. gpt-5.5, claude-sonnet-4-5-20250929), the endpoint returns the model's provider specifications. If it is a virtual smart router alias (e.g. nrouter/auto), it returns the alias routing configuration.
  3. Tenant Security Isolation: If a model exists globally but has been restricted or disabled for your organization, the gateway returns HTTP 404 Not Found (model_not_found) to prevent topology enumeration.
  4. Immediate Response: The response is served in single-digit milliseconds with $0 in billing charges.

Path Parameters

ParameterTypeRequiredDescription
model_idstringYesThe unique identifier of the model to retrieve (e.g. gpt-5.5, claude-sonnet-4-5-20250929, gemini-2.5-pro, nrouter/auto).

Request & Response Headers

Inbound Request Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer authentication format: Bearer sk-nrouter-....

Outbound Response Headers

HeaderTypeDescription
x-nr-request-idstringUnique UUID correlation identifier for tracing.
x-nr-latency-msintegerGateway edge turnaround time in milliseconds.
x-nr-modelstringThe resolved model identifier.

Response Payload

{
  "id": "gpt-5.5",
  "object": "model",
  "created": 1709251200,
  "owned_by": "openai"
}

Field Breakdown

FieldTypeDescription
idstringThe model identifier used in API calls.
objectstringAlways "model".
createdintegerUnix timestamp of when the model was cataloged.
owned_bystringThe provider that owns the model (e.g. openai, anthropic, google).

SDK Code Examples

import { nRouter } from "@nrouter_ai/sdk";

const client = new nRouter({
  apiKey: process.env.NROUTER_API_KEY,
});

const model = await client.models.retrieve("gpt-5.5");
console.log(`Model: ${model.id}`);
console.log(`Owned By: ${model.owned_by}`);

Error Handling & Status Codes

{
  "error": {
    "type": "gateway_error",
    "message": "The model 'non-existent-model' does not exist or you do not have access to it.",
    "code": "model_not_found"
  }
}
HTTP StatusError CodeRoot CauseRecommended Action
401 Unauthorizedinvalid_api_keyVirtual key missing, expired, or invalid.Check Authorization: Bearer sk-nrouter-... in dashboard.
404 Not Foundmodel_not_foundModel does not exist or tenant ACL prohibits access.Query GET /v1/models to list all models available to your key.
429 Too Many Requestsrate_limit_exceededVirtual key or organization RPM quota exceeded.Cache model metadata locally in client applications.
500 / 503 Gateway Errorservice_unavailableInternal catalog database temporarily unreachable.Retry request with exponential backoff.

Model Metadata Architecture & Dynamic Access Control

The model detail endpoint (GET /v1/models/{model_id}) resolves real-time telemetry, access permissions, context boundaries, and pricing structures directly from the gateway's authoritative database.

Tenant Model ACL Validation

Every request to retrieve model metadata verifies multi-tiered access control lists:

  1. Organization-Level Entitlements: Organizations on Enterprise plans can configure custom model allowlists and denylists. If a model is restricted by your organization administrator, the endpoint returns HTTP 404 with model_not_found to prevent information leaks.
  2. Virtual Key Restrictions: Virtual keys can be scoped to specific model families (e.g. gpt-5.5 only). If a key attempts to query an unauthorized model, the gateway enforces key-level isolation.
  3. Provider Region & Compliance Rules: If your organization enforces strict data sovereignty policies (e.g. EU-only processing), models hosted exclusively in disallowed regions are automatically omitted from resolution.

Context Limits & Pricing Fields

The JSON response includes machine-readable metadata essential for client-side token budgeting:

  • context_length: Maximum supported token context window (e.g. 128000, 200000, 1000000).
  • pricing.prompt: Cost in USD per input token at the exact provider list price ($0 markup).
  • pricing.completion: Cost in USD per generated completion token.
  • pricing.image: Flat USD rate per generated image or image input tile.
  • pricing.request: Flat invocation charge if applicable.

Dynamic Fallback Chains & Alias Resolution

When querying model metadata, nRouter supports both canonical model identifiers (e.g. anthropic/claude-3-5-sonnet) and virtual aliases (e.g. nrouter/auto or custom organization aliases).

  • Canonical Model IDs: Resolves to the specific foundation model deployment across configured provider regions.
  • Smart Router Targets: For managed aliases like nrouter/auto, nRouter looks at the request (whether it asks for reasoning, how long the input and requested output are, whether it uses tools over many turns) and at the kind of task, then picks a model from a pool that nRouter manages; if that model is unavailable it falls back to another model that costs the same or less. Inspecting the router alias does not reveal fallback chains or candidate models; the response always reports nrouter/auto as the model and is billed at the list price of the model that answered.
  • Zero-Markup Transparency: Every pricing entry matches upstream cloud provider rates exactly, enabling high-fidelity FinOps forecasting and auditing across multi-tenant deployments.
  • Cache Header Guarantees: Model configuration payloads carry HTTP ETag and Cache-Control headers, allowing client applications to cache definitions for up to 60 seconds with background revalidation.
GET
/v1/models/{model_id}

Authorization

NRouterApiKey
AuthorizationBearer <token>

Your nRouter virtual key (sk-nrouter-…). Sent as Authorization: Bearer sk-nrouter-….

In: header

Path Parameters

model_id*string

Header Parameters

x-nr-tags?string

Custom spend and attribution tags (comma-separated key=value pairs)

x-nr-mcp-server?string

Target MCP server ID when routing MCP tool calls or prompts through the gateway

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/models/string"
{  "id": "gpt-4o",  "object": "model",  "owned_by": "nrouter"}
Was this page helpful?