今日已更新 269 条资讯 | 累计 34134 条内容
关于我们

今日精选

HOT

最新资讯

共 34134 篇
第 1400/1707 页
AI 资讯 Dev.to

LLM integration with OpenRouter

OpenRouter is a unified API gateway to hundreds of language models from providers such as OpenAI, Anthropic, Google, and Meta. You use one API key and one billing surface, and swap models by changing a provider/model slug. OpenRouter exposes a Chat Completions -compatible HTTP API. This post shows three Node.js integration paths: the official @openrouter/sdk , the openai package with baseURL , and the Vercel AI SDK with @openrouter/ai-sdk-provider . For deeper patterns on each stack, see the Chat Completions API , OpenAI Responses API (OpenAI direct only), and Vercel AI SDK posts. Prerequisites OpenRouter account API key Credits or billing enabled as needed Node.js version 26 Install packages for the path you use: @openrouter/sdk ( npm i @openrouter/sdk ) openai ( npm i openai ) ai and @openrouter/ai-sdk-provider ( npm i ai @openrouter/ai-sdk-provider ) Configuration Read credentials from the environment in production. Variable Purpose OPENROUTER_API_KEY Bearer token from OpenRouter settings OPENROUTER_MODEL Default model slug, for example openai/gpt-5.5 OPENROUTER_SITE_URL Optional site URL sent as HTTP-Referer for rankings on openrouter.ai OPENROUTER_SITE_TITLE Optional app name sent as X-OpenRouter-Title Model IDs use the provider/model format, for example openai/gpt-5.5 , anthropic/claude-opus-4.8 , or google/gemini-3.1-flash-lite . Browse the full catalog at openrouter.ai/models . The examples below use openai/gpt-5.5 , matching the model in the other LLM posts in this series. Override it with OPENROUTER_MODEL when you want a different model. @openrouter/sdk OpenRouter's official TypeScript SDK is type-safe and generated from the OpenAPI spec. Client setup import { OpenRouter } from ' @openrouter/sdk ' ; const client = new OpenRouter ({ apiKey : process . env . OPENROUTER_API_KEY , httpReferer : process . env . OPENROUTER_SITE_URL , appTitle : process . env . OPENROUTER_SITE_TITLE , }); Basic integration const response = await client . chat . send ({ chatReques

Željko Šević 2026-06-08 23:52 12 原文
AI 资讯 Reddit r/artificial

Anyone else completely sick of re-explaining their background to Claude/ChatGPT every single day?

I use AI tools all day for work and the thing that drives me crazy is starting a new chat window.If I don't paste a massive block of text about my current project stack, my writing guidelines, and what I'm trying to do, the model just defaults to that generic, robotic corporate speak. But keeping a sloppy text file on my desktop and copying it in over and over feels incredibly stupid.Even worse is that ChatGPT custom instructions don't format right when you try to move them over to Claude or DeepSeek. They just drift or start ignoring instructions after a few prompts. How are you guys managing your background data across different browser tabs? Are you just dealing with the text dumps or is there a way to actually lock this context in permanently so it doesn't get messed up? submitted by /u/alazar_tesema [link] [留言]

/u/alazar_tesema 2026-06-08 23:49 7 原文
AI 资讯 Dev.to

Self-Host Postgres or Use Supabase? Here's How to Decide

Short answer first: use Supabase if you want Postgres plus auth, realtime, storage, and a dashboard as one managed bundle. Self-host Postgres – or use a managed Postgres – if you mostly need a database and your app already handles its own auth and logic. The choice is not really "Postgres vs Supabase". It's whether you need the extra layers Supabase puts on top of Postgres. Supabase is not a database Supabase runs on PostgreSQL, but it's a stack of services around it: Postgres – the actual database Auth – user signup, login, JWT tokens Realtime – live updates over websockets Storage – an S3-style file store Edge Functions – serverless functions Studio – dashboard + auto-generated REST/GraphQL API So "self-host Postgres or use Supabase" compares a plain database to a full backend. The honest question: do you need those extra layers, or just the database underneath them? A quick test: You use Supabase Auth, Storage, and Realtime → Supabase earns its place. You use one of them → it's replaceable. You use none and treat it as "Postgres with a nice dashboard" → you want plain Postgres. Side-by-side comparison Factor Supabase (managed) Self-hosted Supabase Plain Postgres (managed or self-hosted) Database engine PostgreSQL PostgreSQL PostgreSQL Built-in auth Yes Yes No (bring your own) Realtime / websockets Yes Yes No File storage Yes Yes No Dashboard + auto API Yes Yes No (use any SQL client) Backups Managed (limits by plan) You manage Managed or you manage Cost shape Metered, grows with usage Server cost + your time Database only Self-host effort None High (many containers) Low–medium Lock-in Medium–high Medium Very low The lock-in point decides it for many teams. Your data is standard Postgres in every option ( pg_dump portable). The lock-in is everything else: Auth tokens, Storage paths, Supabase-specific RLS policies, Edge Function code. The more Supabase-specific features you adopt, the harder the exit. When each option wins Pick managed Supabase when: You're startin

Pavel 2026-06-08 23:36 12 原文
AI 资讯 Dev.to

Return to the Planet of the Autistics

Field journal of Dr. E. Rempel, Department of Minority Neurological Studies, University of New Carthage (A work of fiction. "Allism" is a real term used by some autistic people to describe the neurological profile of the non-autistic majority.) March 3, 2089 I have now spent three months embedded with an allistic community in the outer provinces. Allism, for those unfamiliar, is a rare neurological variant affecting approximately 1% of our population. My colleagues at the University have long debated its origins and persistence. After direct observation, I am no more certain of the answers, but I have accumulated a remarkable set of field notes. The allistic subjects I have observed appear, on the surface, entirely functional. They hold jobs, maintain relationships, raise children. And yet their neurological profile diverges from the norm in ways that are at once fascinating and bewildering. March 11, 2089 The most immediately striking feature of the allistic profile is their relationship with information. Where a typical individual experiences the sharing of useful knowledge as a basic social reflex, the allistic subject appears to require an elaborate ritual before any information exchange can occur. Approach an allistic subject directly with a piece of useful data and observe what happens. Rather than receiving it, they freeze. A threat-assessment process appears to engage, entirely pre-consciously, before the content of the communication can be evaluated at all. One subject described it to me as feeling "strange" when a stranger approached with unsolicited information, though she could not articulate why. I have learned to preface all information exchanges with what my translator calls "the preamble ritual" — a sequence of social signals that appears to deactivate the threat response and allow communication to proceed. The exact form varies, but typically involves eye contact, a softening of posture, and verbal acknowledgment that one is about to speak. Only the

Raphaël Pinson 2026-06-08 23:33 12 原文
AI 资讯 Dev.to

ContextLens — py-spy/pprof but for what's inside your LLM prompt

In multi-turn agent loops, the full context re-sends on every API call. A tool result added at turn 3 gets billed again at turns 4, 5, 6, 7... forever. Most of it is never read again. Standard observability tools tell you the total token count. They never tell you what's in there or how much of it is waste . That's what ContextLens fixes. What it does ContextLens is a diagnostic profiler for LLM agent context windows. It: Decomposes the context window into regions: system prompt, tool schemas, tool results, retrieved chunks, user messages, assistant messages Tracks which blocks get re-billed across turns using SHA-256 content hashing Runs 5 waste detectors and ranks findings by dollar cost Prints a concrete one-line fix for each finding Renders an interactive D3 treemap report as a self-contained HTML file No API key required. Works offline on saved traces. The five detectors Detector What it finds Duplicate Same block re-sent verbatim across multiple turns Near-Duplicate >85% Jaccard similarity between distinct blocks Stale Tool Result Tool output never referenced by a later assistant message Unused Tool Schema Tool defined every turn but never called Redundant Retrieval Retrieved chunk with <15% overlap with model output ---Run the built-in demo (simulates a 30-turn agent loop, no API key needed): python -c "import contextlens; contextlens.demo()" python examples/demo.py Live capture — Anthropic import anthropic import contextlens as cl client = anthropic.Anthropic() with cl.capture_anthropic(client, model="claude-3-5-sonnet-20241022") as collector: for turn in range(20): client.messages.create( model="claude-3-5-sonnet-20241022", max_tokens=1024, system="You are a helpful assistant.", messages=build_messages(turn), ) report = cl.analyze_trace(collector.build_trace()) print(f"Recoverable waste: {report.recoverable_tokens:,} tokens (${report.recoverable_cost_usd:.4f})") Live capture — OpenAI import openai import contextlens as cl client = openai.OpenAI() with cl.ca

Harshal Sant 2026-06-08 23:32 6 原文
AI 资讯 The Verge AI

Eero’s Pro 6E routers are down to their cheapest price yet in 2026

The Pro 6E was Eero’s top-end mesh Wi-Fi router back in 2022, and it’s still a solid pick if you want fast, reliable Wi-Fi coverage around your multi-room or multi-story abode. It can also deliver beyond gigabit wired speeds if your internet plan supports it. Ahead of Prime Day 2026, Amazon and Best Buy have […]

Cameron Faulkner 2026-06-08 23:25 9 原文