Advanced

Anthropic-Compatible API

Use LinkHarbor with Claude Code, OpenClaw, Cline, OpenCode, and other Anthropic-compatible tools without modifying the official Anthropic SDK.

It is recommended to configure the API key and endpoint using environment variables. You can get started in just four simple steps.

Quick Start

The recommended setup uses environment variables for both the API key and the Anthropic-compatible endpoint.

Install Claude Code

Claude Code connects your local development environment to Anthropic-compatible models. Make sure Node.js 18 or later is installed before running the install command.

Configure API Key

Your API key authenticates requests to the Anthropic-compatible API. Store it in ANTHROPIC_API_KEY instead of hardcoding it in source code.

ANTHROPIC_API_KEY is the recommended variable for x-api-key authentication. Use ANTHROPIC_AUTH_TOKEN only if your gateway explicitly requires Bearer authentication.

Configure Anthropic-Compatible Endpoint

Set the base URL so Claude Code and Anthropic SDKs send requests to LinkHarbor instead of the default Anthropic endpoint.

Launch Claude Code

After configuring the API key and endpoint, start Claude Code from your terminal. You can also specify a model manually.

API Reference

The platform supports the standard Anthropic-Compatible API format. All requests should include x-api-key, anthropic-version, and content-type headers.

Base URL

https://api.linkharbor.ai/anthropic

Send messages to Anthropic-compatible models using the standard /v1/messages endpoint and request schema.

Messages Endpoint

https://api.linkharbor.ai/anthropic/v1/messages

Send messages to Anthropic-compatible models using the standard /v1/messages endpoint and request schema.

Headers

All Anthropic-compatible requests must include the following headers.

Headers

Request Example

Standard Anthropic Messages format with model, max_tokens, and a messages array.

JSON

Examples

Use the official Anthropic SDK directly — no modification required. The same call shown in three languages.

Best Practices

Three habits that keep your integration secure and resilient over time.

Use environment variables

Avoid committing API keys to source code, examples, terminal history, or public repositories.

Use compatible tools

Claude Code, OpenClaw, Cline, OpenCode, and similar Anthropic-compatible clients can use this endpoint.

Use stable API keys

Long-lived keys reduce unexpected tool failures caused by frequent key rotation.

FAQ

Quick answers to the questions developers ask most.

Claude Code cannot connect. What should I check?
Verify that the API key is correct, ANTHROPIC_BASE_URL points to the LinkHarbor endpoint, and Node.js is version 18 or later.
Why am I getting 401 Unauthorized?
Check that the API key is valid, not expired or revoked, and sent as x-api-key: YOUR_API_KEY.
Is the official Anthropic SDK supported?
Yes. You can use the official Anthropic SDK by changing the base URL and API key.

What's next