Claude Code (CLI)
The Terminal-Native Experience
What is it?
Claude Code is Anthropic's command-line agentic coding tool. It lives in your terminal, understands your codebase, and helps you code faster through natural language commands.
Agentic by Design
Claude Code doesn't just answer questionsβit executes tasks, modifies files, runs commands, and handles entire git workflows autonomously.
Context-Aware
It reads your project structure, understands relationships between files, and maintains conversation history throughout your session.
Terminal-Native
Perfect for developers who live in the command line, integrating seamlessly with bash, git, and other CLI tools.
# macOS/Linux (recommended) curl -fsSL https://claude.ai/install.sh | sh # Or via npm (deprecated but still works) npm install -g @anthropic-ai/claude-code
Best For
Interactive coding sessions, code reviews, refactoring, debugging, git workflow automation, learning new codebases, and quick prototyping.
Not For
Production applications needing programmatic AI integration, automated pipelines requiring API responses, or applications needing fine-grained control over parameters.
Claude API
Direct HTTP Access
What is it?
The Claude API is the foundational RESTful interface at https://api.anthropic.com.
It's the raw HTTP endpoint that all other integrations ultimately use.
Universal Compatibility
Works with any programming language that can make HTTP requests. No SDK dependencies required.
Full Control
Direct access to all parameters, headers, and response handling. Complete flexibility over every aspect of the request.
Stateless
Each request is independent; you manage conversation history yourself. Full control over context management.
curl https://api.anthropic.com/v1/messages \ --header "x-api-key: $ANTHROPIC_API_KEY" \ --header "anthropic-version: 2023-06-01" \ --header "content-type: application/json" \ --data '{ "model": "claude-sonnet-4-5", "max_tokens": 1024, "messages": [ {"role": "user", "content": "Analyze this tender document for compliance issues"} ] }'
Languages without official SDK support, serverless environments with strict dependency constraints, learning/understanding how Claude's API works internally, or custom HTTP clients and proxy scenarios.
Claude SDK
The Developer-Friendly Wrapper
What is it?
Anthropic provides official SDKs for Python, TypeScript, Java, Go, C#, Ruby, and PHP. These SDKs wrap the API, providing type safety, automatic retries, streaming support, and error handling.
As of version 10+, the Anthropic NuGet package is the official SDK. Earlier versions
(3.x and below) were the community-built tryAGI SDK, which has moved to tryAGI.Anthropic.
dotnet add package Anthropic
using Anthropic; using Anthropic.Models.Messages; AnthropicClient client = new(); MessageCreateParams parameters = new() { MaxTokens = 1024, Messages = [ new() { Role = Role.User, Content = "Analyze this procurement document for compliance", }, ], Model = Model.ClaudeSonnet4_5_20250929, }; var message = await client.Messages.Create(parameters); Console.WriteLine(message);
await foreach (var chunk in client.Messages.CreateStreaming(parameters)) { Console.Write(chunk); }
Type Safety
Strongly-typed request/response models. Catch errors at compile time rather than runtime.
Automatic Retries
Built-in exponential backoff for transient failures. Handle rate limits gracefully.
IChatClient Support
Integrates with Microsoft.Extensions.AI.Abstractions for standardized AI interfaces.
Comparison Matrix
Side-by-Side Overview
| Aspect | Claude Code (CLI) | API (Direct HTTP) | SDK (C#/.NET) |
|---|---|---|---|
| Use Case | Interactive coding | Universal access | Application integration |
| Learning Curve | Low | Medium | Low |
| Type Safety | N/A | None | Full |
| Retry Logic | Built-in | Manual | Built-in |
| Streaming | Native | Manual parsing | IAsyncEnumerable |
| Best For | Developers | Any language | .NET applications |
| Authentication | OAuth token or API key | API key | API key or Auth token |
Azure AI Foundry
Enterprise Cloud Integration
What is Azure AI Foundry?
Azure AI Foundry (formerly Azure AI Studio) is Microsoft's unified platform for AI development. As of November 2025, Claude models are available directly through Foundry, making Azure the only cloud provider offering both Claude and GPT frontier models on a single platform.
Claude Opus 4.5
Most intelligent modelβideal for complex coding, agents, and enterprise workflows.
Claude Sonnet 4.5
Best-in-class for coding and building agents. Balanced performance and cost.
Claude Haiku 4.5
Near-frontier performance at one-third the costβperfect for high-volume applications.
Consolidated Billing
Use existing Azure agreements and MACC (Microsoft Azure Consumption Commitment).
Enterprise Compliance
Leverage Azure's security, governance, and compliance frameworks.
Familiar Tooling
Integrate with Azure Monitor, Log Analytics, and Cost Management.
Single Platform
Access both Claude and GPT models without managing multiple vendor relationships.
// Set environment variable // ANTHROPIC_FOUNDRY_API_KEY=your-azure-api-key var client = new AnthropicClient { BaseUrl = "https://{resource}.services.ai.azure.com/anthropic" };
using Azure.Identity; // Supports Azure CLI login, Managed Identity, etc. var credential = new DefaultAzureCredential(); var token = await credential.GetTokenAsync( new TokenRequestContext(new[] { "https://cognitiveservices.azure.com/.default" }) );
# Environment variables for Azure Foundry export ANTHROPIC_FOUNDRY_RESOURCE={your-resource-name} # Or full URL: export ANTHROPIC_FOUNDRY_BASE_URL=https://{resource}.services.ai.azure.com
API Key vs Auth Token
Understanding Authentication
This is one of the most confusing aspects of Claude authentication. Let's clarify the differences.
API Key (ANTHROPIC_API_KEY)
A static secret string generated in the Anthropic Console. Format: sk-ant-api03-...
Sent via the x-api-key HTTP header.
- Long-lived: Doesn't expire unless revoked
- Pay-as-you-go: Billed based on token usage
- Programmatic: Designed for server-to-server communication
- Workspace-scoped: Can be tied to specific workspaces
Auth Token (ANTHROPIC_AUTH_TOKEN)
An OAuth 2.0 bearer token obtained through authentication flow.
Used with the Authorization: Bearer header.
- Time-limited: Typically expires after 1 hour
- Subscription-based: Uses your Claude Pro/Max plan
- User-scoped: Tied to your personal account
- Interactive: Designed for tools like Claude Code
When to Use
Backend services and APIs, automated pipelines, production applications, and team/enterprise environments where billing is centralized.
When to Use
Claude Code CLI sessions, personal development with Claude Pro/Max subscription, and interactive tools that can handle OAuth flows.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β Authentication Methods β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β βββββββββββββββββββ βββββββββββββββββββ β β β API Key β β Auth Token β β β β (x-api-key) β β (Authorization) β β β ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ β β β β β β βΌ βΌ β β βββββββββββββββββββ βββββββββββββββββββ β β β Pay-per-use β β Subscription β β β β billing β β (Pro/Max plan) β β β βββββββββββββββββββ βββββββββββββββββββ β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
If you have both authentication methods configured, you'll see:
"Auth conflict: Both a token (ANTHROPIC_AUTH_TOKEN) and an API key (ANTHROPIC_API_KEY) are set.
This may lead to unexpected behavior."
Resolution: For Claude Code with subscription, unset ANTHROPIC_API_KEY.
For programmatic access, unset ANTHROPIC_AUTH_TOKEN.
Whether you're building tender analysis systems, document processing pipelines, or intelligent assistants, understanding these integration options ensures you pick the right tool for the job.