cencori 1.17.0 → 1.18.0

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.
package/README.md CHANGED
@@ -412,6 +412,39 @@ console.log(response.images[0].b64_json); // base64 image data
412
412
  | **OpenAI** | `gpt-image-2`, `gpt-image-1.5`, `gpt-image-1`, `gpt-image-1-mini` | Text rendering, creative |
413
413
  | **Google** | `gemini-3-pro-image`, `imagen-3` | High photorealism |
414
414
 
415
+ ## Observe
416
+
417
+ Traces of your AI app in Cencori → Observability, whatever framework you use and whether or not your model calls go through the Cencori gateway. Your `CENCORI_API_KEY` is the only setting.
418
+
419
+ ```ts
420
+ import 'cencori/observe'; // first line of your app
421
+ ```
422
+
423
+ OpenAI and Anthropic SDK calls are recorded with their prompts, responses, tokens, cost and timing. LangChain chains and tools are recorded too when `@arizeai/openinference-instrumentation-langchain` is installed.
424
+
425
+ **Next.js, other bundlers, and ESM apps** load your modules before any hook can see them, so pass the clients you use:
426
+
427
+ ```ts
428
+ import OpenAI from 'openai';
429
+ import { observe } from 'cencori/observe';
430
+
431
+ observe({ openai: OpenAI });
432
+ ```
433
+
434
+ **Who and what.** Put a user, session or tags on everything inside a block, and record your own steps:
435
+
436
+ ```ts
437
+ import { withContext, trace } from 'cencori/observe';
438
+
439
+ await withContext({ userId: user.id, sessionId: chat.id }, () =>
440
+ trace('answer-ticket', () => agent.run(ticket), { type: 'agent', input: ticket.text }),
441
+ );
442
+ ```
443
+
444
+ **Serverless.** Spans are sent in batches. Before a function returns, `await flush()` (or `waitUntil(flush())` on Vercel).
445
+
446
+ Options: `observe({ serviceName, captureContent: false })` keeps prompts and responses out of Cencori (or `CENCORI_OBSERVE_CONTENT=false`); options apply even after the import has started it. `CENCORI_OBSERVE=false` turns it off. `CENCORI_OBSERVE_DEBUG=1` logs each batch sent. Already running OpenTelemetry? Add `new BatchSpanProcessor(new CencoriSpanExporter())` to your setup.
447
+
415
448
  ## Framework Integrations
416
449
 
417
450
  ### Vercel AI SDK
package/dist/index.d.mts CHANGED
@@ -462,6 +462,8 @@ interface UnifiedModel {
462
462
  retires_at?: string | null;
463
463
  /** What the vendor says to use instead. */
464
464
  replaced_by?: string | null;
465
+ /** How a row with no price of its own is charged, e.g. `auto`; null otherwise. */
466
+ pricing_note?: string | null;
465
467
  }
466
468
  declare class ModelsNamespace {
467
469
  private config;
package/dist/index.d.ts CHANGED
@@ -462,6 +462,8 @@ interface UnifiedModel {
462
462
  retires_at?: string | null;
463
463
  /** What the vendor says to use instead. */
464
464
  replaced_by?: string | null;
465
+ /** How a row with no price of its own is charged, e.g. `auto`; null otherwise. */
466
+ pricing_note?: string | null;
465
467
  }
466
468
  declare class ModelsNamespace {
467
469
  private config;