Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(sdp): stop attaching the org API key to public doc and health fetches

nirholas5adb0c4700fe
diff --git a/api/_lib/sdp.js b/api/_lib/sdp.js
index 892a977ce..410917093 100644
--- a/api/_lib/sdp.js
+++ b/api/_lib/sdp.js
@@ -108,7 +108,10 @@ export async function sdpRequest(
}
const reqHeaders = { accept: 'application/json', ...headers };
- if (apiKey) reqHeaders.authorization = `Bearer ${apiKey}`;
+ // Only the privileged routes carry our key. The public doc/health surfaces
+ // are reachable unauthenticated, so attributing those fetches to our org key
+ // would let an anonymous caller burn our upstream quota for nothing.
+ if (needsKey && apiKey) reqHeaders.authorization = `Bearer ${apiKey}`;
const init = { method, headers: reqHeaders, signal: AbortSignal.timeout(timeoutMs) };
if (body != null && method !== 'GET' && method !== 'HEAD') {
diff --git a/tests/api-sdp-client.test.js b/tests/api-sdp-client.test.js
index 4bccfc321..60f218892 100644
--- a/tests/api-sdp-client.test.js
+++ b/tests/api-sdp-client.test.js
@@ -126,6 +126,14 @@ describe('sdpRequest', () => {
expect(lastRequest.headers.authorization).toBeUndefined();
});
+ it('omits the key on the public doc surfaces even when one is configured', async () => {
+ process.env.SDP_API_KEY = 'sdp_live_abc';
+ mockFetch(200, { openapi: '3.1.0' });
+ await sdpRequest('openapi.json');
+ expect(lastRequest.url).toBe('https://api.solana.com/openapi.json');
+ expect(lastRequest.headers.authorization).toBeUndefined();
+ });
+
it('attaches the Bearer key and honors SDP_API_BASE', async () => {
process.env.SDP_API_KEY = 'sdp_live_abc';
process.env.SDP_API_BASE = 'https://sandbox.example.com/';