@layer-ai/core 2.0.42 → 2.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"chat-completions.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/chat-completions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAcpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAkTpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"chat-completions.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/chat-completions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAapD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAkTpC,eAAe,MAAM,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import { Router } from 'express';
2
2
  import { nanoid } from 'nanoid';
3
3
  import { db } from '../../lib/db/postgres.js';
4
- import { authenticate } from '../../middleware/auth.js';
5
4
  import { spendingTracker } from '../../lib/spending-tracker.js';
6
5
  import { convertOpenAIRequestToLayer, convertLayerResponseToOpenAI, convertLayerChunkToOpenAI, } from '../../lib/openai-conversion.js';
7
6
  import { resolveFinalRequest } from '../v3/chat.js';
@@ -14,7 +13,7 @@ async function executeWithRouting(gateConfig, request, userId) {
14
13
  const result = await callAdapter(request, userId);
15
14
  return { result, modelUsed: request.model };
16
15
  }
17
- router.post('/', authenticate, async (req, res) => {
16
+ router.post('/', async (req, res) => {
18
17
  const startTime = Date.now();
19
18
  if (!req.userId) {
20
19
  const error = {
@@ -1 +1 @@
1
- {"version":3,"file":"gates.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/gates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AASpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AA4lBpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"gates.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/gates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAQpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAylBpC,eAAe,MAAM,CAAC"}
@@ -1,13 +1,10 @@
1
1
  import { Router } from 'express';
2
2
  import { db } from '../../lib/db/postgres.js';
3
3
  import { cache } from '../../lib/db/redis.js';
4
- import { authenticate } from '../../middleware/auth.js';
5
4
  import { callAdapter } from '../../lib/provider-factory.js';
6
5
  import { MODEL_REGISTRY } from '@layer-ai/sdk';
7
6
  import { detectSignificantChanges } from '../../lib/gate-utils.js';
8
7
  const router = Router();
9
- // All routes require authentication (SDK auth with Bearer token)
10
- router.use(authenticate);
11
8
  // POST / - Create a new gate
12
9
  router.post('/', async (req, res) => {
13
10
  if (!req.userId) {
@@ -1 +1 @@
1
- {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/keys.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAKpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AA4EpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/keys.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAIpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAyEpC,eAAe,MAAM,CAAC"}
@@ -1,10 +1,7 @@
1
1
  import { Router } from 'express';
2
2
  import crypto from 'crypto';
3
3
  import { db } from '../../lib/db/postgres.js';
4
- import { authenticate } from '../../middleware/auth.js';
5
4
  const router = Router();
6
- // All routes require sdk authentication
7
- router.use(authenticate);
8
5
  // Generate a random API key
9
6
  function generateApiKey() {
10
7
  const randomBytes = crypto.randomBytes(32).toString('hex');
@@ -1 +1 @@
1
- {"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/logs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAIpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAgMpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/logs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAGpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AA6LpC,eAAe,MAAM,CAAC"}
@@ -1,9 +1,6 @@
1
1
  import { Router } from 'express';
2
2
  import { db } from '../../lib/db/postgres.js';
3
- import { authenticate } from '../../middleware/auth.js';
4
3
  const router = Router();
5
- // All routes require SDK authentication
6
- router.use(authenticate);
7
4
  // GET /v1/logs - List request logs
8
5
  router.get('/', async (req, res) => {
9
6
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAcpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAyUpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAapD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAyUpC,eAAe,MAAM,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { Router } from 'express';
2
2
  import { db } from '../../lib/db/postgres.js';
3
- import { authenticateAnthropicCompatible } from '../../middleware/auth.js';
4
3
  import { spendingTracker } from '../../lib/spending-tracker.js';
5
4
  import { convertAnthropicRequestToLayer, convertLayerResponseToAnthropic, convertLayerStreamToAnthropicEvents, } from '../../lib/anthropic-conversion.js';
6
5
  import { resolveFinalRequest } from '../v3/chat.js';
@@ -13,7 +12,7 @@ async function executeWithRouting(gateConfig, request, userId) {
13
12
  const result = await callAdapter(request, userId);
14
13
  return { result, modelUsed: request.model };
15
14
  }
16
- router.post('/', authenticateAnthropicCompatible, async (req, res) => {
15
+ router.post('/', async (req, res) => {
17
16
  const startTime = Date.now();
18
17
  if (!req.userId) {
19
18
  const error = {
@@ -1 +1 @@
1
- {"version":3,"file":"spending.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/spending.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAKpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAyGpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"spending.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/spending.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAC,MAAM,SAAS,CAAC;AAInD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAuGpC,eAAe,MAAM,CAAC"}
@@ -1,9 +1,7 @@
1
1
  import { Router } from 'express';
2
2
  import { db } from '../../lib/db/postgres.js';
3
3
  import { cache } from '../../lib/db/redis.js';
4
- import { authenticate } from '../../middleware/auth.js';
5
4
  const router = Router();
6
- router.use(authenticate);
7
5
  // GET /spending - Get current spending information
8
6
  router.get('/', async (req, res) => {
9
7
  if (!req.userId) {
@@ -1 +1 @@
1
- {"version":3,"file":"complete.d.ts","sourceRoot":"","sources":["../../../src/routes/v2/complete.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAUpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAsVpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"complete.d.ts","sourceRoot":"","sources":["../../../src/routes/v2/complete.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AASpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAsVpC,eAAe,MAAM,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { Router } from 'express';
2
2
  import { db } from '../../lib/db/postgres.js';
3
- import { authenticate } from '../../middleware/auth.js';
4
3
  import { callAdapter, normalizeModelId } from '../../lib/provider-factory.js';
5
4
  import { OverrideField } from '@layer-ai/sdk';
6
5
  import { spendingTracker } from '../../lib/spending-tracker.js';
@@ -158,7 +157,7 @@ async function executeWithRouting(gateConfig, request, userId) {
158
157
  }
159
158
  }
160
159
  // MARK:- Route Handler
161
- router.post('/', authenticate, async (req, res) => {
160
+ router.post('/', async (req, res) => {
162
161
  const startTime = Date.now();
163
162
  if (!req.userId) {
164
163
  res.status(401).json({ error: 'unauthorized', message: 'Missing user ID' });
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/routes/v3/chat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAIpD,OAAO,KAAK,EAAE,YAAY,EAAiB,IAAI,EAA+C,MAAM,eAAe,CAAC;AAIpH,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAiBpC,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,IAAI,EAChB,OAAO,EAAE,YAAY,GACpB,YAAY,CAiFd;AAwWD,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/routes/v3/chat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAGpD,OAAO,KAAK,EAAE,YAAY,EAAiB,IAAI,EAA+C,MAAM,eAAe,CAAC;AAIpH,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAiBpC,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,IAAI,EAChB,OAAO,EAAE,YAAY,GACpB,YAAY,CAiFd;AAwWD,eAAe,MAAM,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { Router } from 'express';
2
2
  import { db } from '../../lib/db/postgres.js';
3
- import { authenticate } from '../../middleware/auth.js';
4
3
  import { callAdapter, callAdapterStream, normalizeModelId, getProviderForModel, PROVIDER } from '../../lib/provider-factory.js';
5
4
  import { OverrideField } from '@layer-ai/sdk';
6
5
  import { spendingTracker } from '../../lib/spending-tracker.js';
@@ -184,7 +183,7 @@ async function* executeWithRoutingStream(gateConfig, request, userId) {
184
183
  }
185
184
  }
186
185
  // MARK:- Route Handler
187
- router.post('/', authenticate, async (req, res) => {
186
+ router.post('/', async (req, res) => {
188
187
  const startTime = Date.now();
189
188
  if (!req.userId) {
190
189
  res.status(401).json({ error: 'unauthorized', message: 'Missing user ID' });
@@ -1 +1 @@
1
- {"version":3,"file":"embeddings.d.ts","sourceRoot":"","sources":["../../../src/routes/v3/embeddings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAOpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAmQpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"embeddings.d.ts","sourceRoot":"","sources":["../../../src/routes/v3/embeddings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAMpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAmQpC,eAAe,MAAM,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { Router } from 'express';
2
2
  import { db } from '../../lib/db/postgres.js';
3
- import { authenticate } from '../../middleware/auth.js';
4
3
  import { callAdapter, normalizeModelId } from '../../lib/provider-factory.js';
5
4
  import { OverrideField } from '@layer-ai/sdk';
6
5
  const router = Router();
@@ -84,7 +83,7 @@ async function executeWithRouting(gateConfig, request, userId) {
84
83
  }
85
84
  }
86
85
  // MARK:- Route Handler
87
- router.post('/', authenticate, async (req, res) => {
86
+ router.post('/', async (req, res) => {
88
87
  const startTime = Date.now();
89
88
  if (!req.userId) {
90
89
  res.status(401).json({ error: 'unauthorized', message: 'Missing user ID' });
@@ -1 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/routes/v3/image.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAOpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AA4PpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/routes/v3/image.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAMpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AA4PpC,eAAe,MAAM,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { Router } from 'express';
2
2
  import { db } from '../../lib/db/postgres.js';
3
- import { authenticate } from '../../middleware/auth.js';
4
3
  import { callAdapter, normalizeModelId } from '../../lib/provider-factory.js';
5
4
  import { OverrideField } from '@layer-ai/sdk';
6
5
  const router = Router();
@@ -94,7 +93,7 @@ async function executeWithRouting(gateConfig, request, userId) {
94
93
  }
95
94
  }
96
95
  // MARK:- Route Handler
97
- router.post('/', authenticate, async (req, res) => {
96
+ router.post('/', async (req, res) => {
98
97
  const startTime = Date.now();
99
98
  if (!req.userId) {
100
99
  res.status(401).json({ error: 'unauthorized', message: 'Missing user ID' });
@@ -1 +1 @@
1
- {"version":3,"file":"ocr.d.ts","sourceRoot":"","sources":["../../../src/routes/v3/ocr.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAOpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAqPpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"ocr.d.ts","sourceRoot":"","sources":["../../../src/routes/v3/ocr.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAMpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAqPpC,eAAe,MAAM,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { Router } from 'express';
2
2
  import { db } from '../../lib/db/postgres.js';
3
- import { authenticate } from '../../middleware/auth.js';
4
3
  import { callAdapter, normalizeModelId } from '../../lib/provider-factory.js';
5
4
  import { OverrideField } from '@layer-ai/sdk';
6
5
  const router = Router();
@@ -84,7 +83,7 @@ async function executeWithRouting(gateConfig, request, userId) {
84
83
  }
85
84
  }
86
85
  // MARK:- Route Handler
87
- router.post('/', authenticate, async (req, res) => {
86
+ router.post('/', async (req, res) => {
88
87
  const startTime = Date.now();
89
88
  if (!req.userId) {
90
89
  res.status(401).json({ error: 'unauthorized', message: 'Missing user ID' });
@@ -1 +1 @@
1
- {"version":3,"file":"tts.d.ts","sourceRoot":"","sources":["../../../src/routes/v3/tts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAOpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAiPpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"tts.d.ts","sourceRoot":"","sources":["../../../src/routes/v3/tts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAMpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AAiPpC,eAAe,MAAM,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { Router } from 'express';
2
2
  import { db } from '../../lib/db/postgres.js';
3
- import { authenticate } from '../../middleware/auth.js';
4
3
  import { callAdapter, normalizeModelId } from '../../lib/provider-factory.js';
5
4
  import { OverrideField } from '@layer-ai/sdk';
6
5
  const router = Router();
@@ -84,7 +83,7 @@ async function executeWithRouting(gateConfig, request, userId) {
84
83
  }
85
84
  }
86
85
  // MARK:- Route Handler
87
- router.post('/', authenticate, async (req, res) => {
86
+ router.post('/', async (req, res) => {
88
87
  const startTime = Date.now();
89
88
  if (!req.userId) {
90
89
  res.status(401).json({ error: 'unauthorized', message: 'Missing user ID' });
@@ -1 +1 @@
1
- {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/routes/v3/video.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAOpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AA4PpC,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/routes/v3/video.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC;AAMpD,QAAA,MAAM,MAAM,EAAE,UAAqB,CAAC;AA4PpC,eAAe,MAAM,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { Router } from 'express';
2
2
  import { db } from '../../lib/db/postgres.js';
3
- import { authenticate } from '../../middleware/auth.js';
4
3
  import { callAdapter, normalizeModelId } from '../../lib/provider-factory.js';
5
4
  import { OverrideField } from '@layer-ai/sdk';
6
5
  const router = Router();
@@ -94,7 +93,7 @@ async function executeWithRouting(gateConfig, request, userId) {
94
93
  }
95
94
  }
96
95
  // MARK:- Route Handler
97
- router.post('/', authenticate, async (req, res) => {
96
+ router.post('/', async (req, res) => {
98
97
  const startTime = Date.now();
99
98
  if (!req.userId) {
100
99
  res.status(401).json({ error: 'unauthorized', message: 'Missing user ID' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layer-ai/core",
3
- "version": "2.0.42",
3
+ "version": "2.0.44",
4
4
  "description": "Core API routes and services for Layer AI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",