@@ -55,6 +55,11 @@ const providerEndpointPlugins = vi.hoisted(() => [
5555 endpointClass : "xai-native" ,
5656 hosts : [ "api.x.ai" ] ,
5757 } ,
58+ {
59+ endpointClass : "nvidia-native" ,
60+ hosts : [ "integrate.api.nvidia.com" ] ,
61+ baseUrls : [ "https://integrate.api.nvidia.com/v1" ] ,
62+ } ,
5863 ] ,
5964 providerRequest : {
6065 providers : {
@@ -68,6 +73,7 @@ const providerEndpointPlugins = vi.hoisted(() => [
6873 kimi : { family : "moonshot" , compatibilityFamily : "moonshot" } ,
6974 mistral : { family : "mistral" } ,
7075 moonshot : { family : "moonshot" , compatibilityFamily : "moonshot" } ,
76+ nvidia : { family : "nvidia" } ,
7177 openrouter : { family : "openrouter" } ,
7278 qwen : { family : "modelstudio" } ,
7379 together : { family : "together" } ,
@@ -132,6 +138,29 @@ describe("provider attribution", () => {
132138 } ) ;
133139 } ) ;
134140
141+ it ( "returns a documented NVIDIA attribution policy" , ( ) => {
142+ const policy = resolveProviderAttributionPolicy ( "nvidia" , {
143+ OPENCLAW_VERSION : "2026.3.22" ,
144+ } ) ;
145+
146+ expect ( policy ) . toEqual ( {
147+ provider : "nvidia" ,
148+ enabledByDefault : true ,
149+ verification : "vendor-documented" ,
150+ hook : "request-headers" ,
151+ reviewNote :
152+ "NVIDIA NIM billing invoke-origin attribution header. Applied only on verified NVIDIA routes." ,
153+ product : "OpenClaw" ,
154+ version : "2026.3.22" ,
155+ headers : {
156+ "X-BILLING-INVOKE-ORIGIN" : "OpenClaw" ,
157+ } ,
158+ } ) ;
159+ expect ( resolveProviderAttributionHeaders ( "NVIDIA" , { OPENCLAW_VERSION : "2026.3.22" } ) ) . toEqual ( {
160+ "X-BILLING-INVOKE-ORIGIN" : "OpenClaw" ,
161+ } ) ;
162+ } ) ;
163+
135164 it ( "normalizes aliases when resolving provider headers" , ( ) => {
136165 expect (
137166 resolveProviderAttributionHeaders ( "OpenRouter" , {
@@ -221,6 +250,7 @@ describe("provider attribution", () => {
221250 ] ) ,
222251 ) . toEqual ( [
223252 [ "openrouter" , true , "vendor-documented" , "request-headers" ] ,
253+ [ "nvidia" , true , "vendor-documented" , "request-headers" ] ,
224254 [ "openai" , true , "vendor-hidden-api-spec" , "request-headers" ] ,
225255 [ "openai-codex" , true , "vendor-hidden-api-spec" , "request-headers" ] ,
226256 [ "xai" , true , "vendor-hidden-api-spec" , "request-headers" ] ,
@@ -446,6 +476,10 @@ describe("provider attribution", () => {
446476 endpointClass : "cerebras-native" ,
447477 hostname : "api.cerebras.ai" ,
448478 } ) ;
479+ expectRecordFields ( resolveProviderEndpoint ( "https://integrate.api.nvidia.com/v1" ) , {
480+ endpointClass : "nvidia-native" ,
481+ hostname : "integrate.api.nvidia.com" ,
482+ } ) ;
449483 expectRecordFields ( resolveProviderEndpoint ( "https://opencode.ai/api" ) , {
450484 endpointClass : "opencode-native" ,
451485 hostname : "opencode.ai" ,
@@ -511,6 +545,46 @@ describe("provider attribution", () => {
511545 ) . toBeUndefined ( ) ;
512546 } ) ;
513547
548+ it ( "gates documented NVIDIA attribution to official NVIDIA NIM endpoints" , ( ) => {
549+ expectRecordFields (
550+ resolveProviderRequestPolicy ( {
551+ provider : "nvidia" ,
552+ api : "openai-completions" ,
553+ baseUrl : "https://integrate.api.nvidia.com/v1" ,
554+ transport : "stream" ,
555+ capability : "llm" ,
556+ } ) ,
557+ {
558+ endpointClass : "nvidia-native" ,
559+ knownProviderFamily : "nvidia" ,
560+ attributionProvider : "nvidia" ,
561+ allowsHiddenAttribution : false ,
562+ } ,
563+ ) ;
564+
565+ expect (
566+ resolveProviderRequestAttributionHeaders ( {
567+ provider : "custom-nim" ,
568+ api : "openai-completions" ,
569+ baseUrl : "https://integrate.api.nvidia.com/v1" ,
570+ transport : "stream" ,
571+ capability : "llm" ,
572+ } ) ,
573+ ) . toEqual ( {
574+ "X-BILLING-INVOKE-ORIGIN" : "OpenClaw" ,
575+ } ) ;
576+
577+ expect (
578+ resolveProviderRequestAttributionHeaders ( {
579+ provider : "nvidia" ,
580+ api : "openai-completions" ,
581+ baseUrl : "https://proxy.example.com/v1" ,
582+ transport : "stream" ,
583+ capability : "llm" ,
584+ } ) ,
585+ ) . toBeUndefined ( ) ;
586+ } ) ;
587+
514588 it ( "summarizes proxy-like, local, invalid, default, and native routing compactly" , ( ) => {
515589 expect (
516590 describeProviderRequestRoutingSummary ( {
@@ -580,6 +654,18 @@ describe("provider attribution", () => {
580654 capability : "llm" ,
581655 } ) ,
582656 ) . toBe ( "provider=groq api=openai-completions endpoint=groq-native route=native policy=none" ) ;
657+
658+ expect (
659+ describeProviderRequestRoutingSummary ( {
660+ provider : "nvidia" ,
661+ api : "openai-completions" ,
662+ baseUrl : "https://integrate.api.nvidia.com/v1" ,
663+ transport : "stream" ,
664+ capability : "llm" ,
665+ } ) ,
666+ ) . toBe (
667+ "provider=nvidia api=openai-completions endpoint=nvidia-native route=native policy=documented" ,
668+ ) ;
583669 } ) ;
584670
585671 it ( "models other provider families without enabling hidden attribution" , ( ) => {
0 commit comments