@@ -55,6 +55,11 @@ const providerEndpointPlugins = vi.hoisted(() => [
5555 endpointClass : "xai-native" ,
5656 hosts : [ "api.x.ai" , "api.grok.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" , {
@@ -198,6 +227,7 @@ describe("provider attribution", () => {
198227 ] ) ,
199228 ) . toEqual ( [
200229 [ "openrouter" , true , "vendor-documented" , "request-headers" ] ,
230+ [ "nvidia" , true , "vendor-documented" , "request-headers" ] ,
201231 [ "openai" , true , "vendor-hidden-api-spec" , "request-headers" ] ,
202232 [ "openai-codex" , true , "vendor-hidden-api-spec" , "request-headers" ] ,
203233 [ "anthropic" , false , "vendor-sdk-hook-only" , "default-headers" ] ,
@@ -351,6 +381,10 @@ describe("provider attribution", () => {
351381 endpointClass : "cerebras-native" ,
352382 hostname : "api.cerebras.ai" ,
353383 } ) ;
384+ expectRecordFields ( resolveProviderEndpoint ( "https://integrate.api.nvidia.com/v1" ) , {
385+ endpointClass : "nvidia-native" ,
386+ hostname : "integrate.api.nvidia.com" ,
387+ } ) ;
354388 expectRecordFields ( resolveProviderEndpoint ( "https://opencode.ai/api" ) , {
355389 endpointClass : "opencode-native" ,
356390 hostname : "opencode.ai" ,
@@ -400,6 +434,46 @@ describe("provider attribution", () => {
400434 ) . toBeUndefined ( ) ;
401435 } ) ;
402436
437+ it ( "gates documented NVIDIA attribution to official NVIDIA NIM endpoints" , ( ) => {
438+ expectRecordFields (
439+ resolveProviderRequestPolicy ( {
440+ provider : "nvidia" ,
441+ api : "openai-completions" ,
442+ baseUrl : "https://integrate.api.nvidia.com/v1" ,
443+ transport : "stream" ,
444+ capability : "llm" ,
445+ } ) ,
446+ {
447+ endpointClass : "nvidia-native" ,
448+ knownProviderFamily : "nvidia" ,
449+ attributionProvider : "nvidia" ,
450+ allowsHiddenAttribution : false ,
451+ } ,
452+ ) ;
453+
454+ expect (
455+ resolveProviderRequestAttributionHeaders ( {
456+ provider : "custom-nim" ,
457+ api : "openai-completions" ,
458+ baseUrl : "https://integrate.api.nvidia.com/v1" ,
459+ transport : "stream" ,
460+ capability : "llm" ,
461+ } ) ,
462+ ) . toEqual ( {
463+ "X-BILLING-INVOKE-ORIGIN" : "OpenClaw" ,
464+ } ) ;
465+
466+ expect (
467+ resolveProviderRequestAttributionHeaders ( {
468+ provider : "nvidia" ,
469+ api : "openai-completions" ,
470+ baseUrl : "https://proxy.example.com/v1" ,
471+ transport : "stream" ,
472+ capability : "llm" ,
473+ } ) ,
474+ ) . toBeUndefined ( ) ;
475+ } ) ;
476+
403477 it ( "summarizes proxy-like, local, invalid, default, and native routing compactly" , ( ) => {
404478 expect (
405479 describeProviderRequestRoutingSummary ( {
@@ -469,6 +543,18 @@ describe("provider attribution", () => {
469543 capability : "llm" ,
470544 } ) ,
471545 ) . toBe ( "provider=groq api=openai-completions endpoint=groq-native route=native policy=none" ) ;
546+
547+ expect (
548+ describeProviderRequestRoutingSummary ( {
549+ provider : "nvidia" ,
550+ api : "openai-completions" ,
551+ baseUrl : "https://integrate.api.nvidia.com/v1" ,
552+ transport : "stream" ,
553+ capability : "llm" ,
554+ } ) ,
555+ ) . toBe (
556+ "provider=nvidia api=openai-completions endpoint=nvidia-native route=native policy=documented" ,
557+ ) ;
472558 } ) ;
473559
474560 it ( "models other provider families without enabling hidden attribution" , ( ) => {
0 commit comments