Skip to content

Case Study

Building with
Claude API
+ Nodus Design System

This case study documents how we built the Agent Chat Interface template using the Anthropic SDK and five purpose-built Nodus DS components. From first token to accessible, production-ready UI — the complete integration story.

Claude APIAnthropic SDKStreamingAccessibilitySprint 26
<50msFirst token render
4.5:1WCAG AA contrast
0Layout shifts (CLS)
5Claude API primitives

Architecture

Five layers. One rendering pipeline.

The Agent Chat Interface is a vertical stack from API call to rendered UI. Each Nodus DS component owns exactly one layer of the pipeline — no component reaches across layers.

Claude APIAnthropic SDKModel provider

claude-opus-4-6 with streaming enabled. Messages API with tool_use blocks for structured function calls. Streaming events: message_start, content_block_delta, message_stop.

StreamingArtifactNodus DSOutput renderer

Consumes the Anthropic stream and renders token-by-token output. Handles partial markdown, code fences, and JSON artifacts. Manages streaming state machine: idle → streaming → complete → error.

FunctionCallVisualizerNodus DSTool call display

Renders tool_use content blocks as structured inspector cards. Shows function name, input arguments (syntax-highlighted JSON), and the tool_result response. Collapsible by default.

ContextWindowMeterNodus DSToken budget

Reads usage.input_tokens + usage.output_tokens from message events. Renders a segmented bar with model-specific max context (200k for Opus 4). Warning threshold at 80%, critical at 95%.

ModelSelectorNodus DSModel configuration

Dropdown with Haiku 4.5, Sonnet 4.6, Opus 4.6 variants. Shows context window, vision support, speed tier, and relative cost per token. Persists selection to localStorage.

Implementation

Three steps to production.

01

Install and configure

# Nodus is in private preview — distribution details TBD
# Install the Anthropic SDK separately:
npm install @anthropic-ai/sdk
02

Create the streaming client

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

export async function createStream(messages: MessageParam[]) {
  return client.messages.stream({
    model: "claude-opus-4-6",
    max_tokens: 4096,
    messages,
    tools: [/* your tool definitions */],
  });
}
03

Wire up the components

import {
  StreamingArtifact,
  FunctionCallVisualizer,
  ContextWindowMeter,
  ModelSelector,
} from "nodus-design-system";

export function AgentChat() {
  const [stream, setStream] = useState(null);
  const [usage, setUsage] = useState({ input: 0, output: 0 });
  const [model, setModel] = useState("claude-opus-4-6");

  async function send(prompt: string) {
    const s = await createStream([{ role: "user", content: prompt }]);
    s.on("message", (msg) => setUsage({
      input: msg.usage.input_tokens,
      output: msg.usage.output_tokens,
    }));
    setStream(s);
  }

  return (
    <div>
      <ModelSelector value={model} onChange={setModel} />
      <ContextWindowMeter
        used={usage.input + usage.output}
        model={model}
      />
      <StreamingArtifact stream={stream} />
      {stream && <FunctionCallVisualizer stream={stream} />}
    </div>
  );
}

Token Economics

Context window in context.

ContextWindowMeter renders real-time token consumption against the model's max context. This example shows a typical treasury analysis session with tool calls.

Context Window — claude-opus-4-624,382 / 200,000
System prompt: 8,192
User messages: 6,440
Tool results: 6,144
Assistant: 3,606

12.2% used — well within budget. Warning at 80%, critical at 95%.

Accessibility Audit

WCAG AA across all states.

Streaming UI is uniquely challenging for accessibility — content changes rapidly without user interaction. We handle this through aria-live regions with debounced announcements, preventing screen reader flood.

Color contrast — body text

WCAG AA requires 4.5:1

14:1PASS

Color contrast — streaming tokens

WCAG AA requires 4.5:1

7:1PASS

Keyboard navigation

Tab, Arrow keys, Enter, Escape

FullPASS

Screen reader — live regions

Streaming tokens announced progressively

aria-live=politePASS

Reduced motion

Streaming animation disabled on prefers-reduced-motion

RespectedPASS

Focus management

3px offset, agency-colored ring

Visible outlinePASS

Awards Submission

Exhibit A for the agent era.

This case study is submitted as the primary exhibit for the Awwwards SOTD and CSS Design Awards nominations. The Agent Chat Interface template demonstrates the complete Claude API integration story — from API call to accessible, production-ready UI — using only Nodus DS components.

No other design system has built primitives specifically for Claude API. StreamingArtifact, ContextWindowMeter, and FunctionCallVisualizer are novel problem domains. This case study is evidence that design systems can lead — not follow — the tooling required by the agent era.

Awards submission →