
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
@openrouter-dotnet/react
Advanced tools
React SDK for OpenRouter streaming chat with artifacts and tool calls
React SDK for OpenRouter streaming chat with artifacts and tool calls.
npm install @openrouter-dotnet/react
import { useOpenRouterChat } from '@openrouter-dotnet/react';
function ChatApp() {
const { state, actions } = useOpenRouterChat({
baseUrl: 'https://your-api.com',
defaultModel: 'openai/gpt-4o'
});
return (
<div>
{state.messages.map((message) => (
<div key={message.id}>
<strong>{message.role}:</strong>
{message.blocks.map((block) => (
<div key={block.id}>
{block.type === 'text' && <p>{block.content}</p>}
{block.type === 'artifact' && (
<pre>{block.content}</pre>
)}
</div>
))}
</div>
))}
<button onClick={() => actions.sendMessage('Hello!')}>
Send Message
</button>
</div>
);
}
import { useStreamingText } from '@openrouter-dotnet/react';
function SimpleChat() {
const { text, isStreaming, stream } = useStreamingText({
baseUrl: 'https://your-api.com'
});
return (
<div>
<div>{text}</div>
{isStreaming && <div>Streaming...</div>}
<button onClick={() => stream('Hello!')}>
Send
</button>
</div>
);
}
useOpenRouterChat(options)Main hook for full chat functionality with artifacts and tools.
Options:
baseUrl: string - Your API base URLconversationId?: string - Optional conversation IDdefaultModel?: string - Default model to useconfig?: ClientConfig - Client configurationReturns:
state: ChatState - Current chat stateactions: ChatActions - Chat actionsdebug: DebugControls - Debug controlsuseStreamingText(options)Simple hook for text-only streaming.
Options:
baseUrl: string - Your API base URLmodel?: string - Model to useconfig?: ClientConfig - Client configurationReturns:
text: string - Current text contentisStreaming: boolean - Is currently streamingerror: ErrorEvent | null - Last errorcompletion: CompletionEvent | null - Completion infostream(message: string) - Send a messagereset() - Reset stateuseOpenRouterModels(baseUrl)Fetch available models from your API.
Returns:
models: Model[] - Available modelsloading: boolean - Is loadingerror: Error | null - Error if anyOpenRouterClientLow-level client for direct API interaction.
import { OpenRouterClient } from '@openrouter-dotnet/react';
const client = new OpenRouterClient('https://your-api.com');
// Stream a message
await client.stream({
message: 'Hello!',
model: 'openai/gpt-4o'
}, {
onText: (delta) => console.log(delta),
onComplete: (event) => console.log('Done!', event)
});
The SDK uses a content block model where text, artifacts, and tool calls are interleaved in the order they appear in the stream.
interface TextBlock {
type: 'text';
content: string;
}
interface ArtifactBlock {
type: 'artifact';
artifactId: string;
artifactType: string;
title: string;
language?: string;
content: string;
isStreaming: boolean;
}
interface ToolCallBlock {
type: 'tool_call';
toolId: string;
toolName: string;
arguments: string;
result?: string;
error?: string;
status: 'executing' | 'completed' | 'error';
}
import {
getTextBlocks,
getArtifactBlocks,
getToolCallBlocks,
getTextContent,
hasArtifacts,
hasToolCalls
} from '@openrouter-dotnet/react';
// Extract specific block types
const textBlocks = getTextBlocks(message);
const artifactBlocks = getArtifactBlocks(message);
const toolBlocks = getToolCallBlocks(message);
// Get all text content
const textContent = getTextContent(message);
// Check for specific content
const hasArtifacts = hasArtifacts(message);
const hasTools = hasToolCalls(message);
Enable debug mode to see raw stream data and parsed events:
const { debug } = useOpenRouterChat({
baseUrl: 'https://your-api.com'
});
// Toggle debug mode
debug.toggle();
// Clear debug data
debug.clear();
// Access debug data
console.log(debug.data.rawLines);
console.log(debug.data.parsedEvents);
The package includes full TypeScript definitions:
import type {
ChatMessage,
ContentBlock,
TextBlock,
ArtifactBlock,
ToolCallBlock,
ChatState,
ChatActions,
UseChatReturn
} from '@openrouter-dotnet/react';
MIT
FAQs
React SDK for OpenRouter streaming chat with artifacts and tool calls
The npm package @openrouter-dotnet/react receives a total of 10 weekly downloads. As such, @openrouter-dotnet/react popularity was classified as not popular.
We found that @openrouter-dotnet/react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.