Advanced

OpenAI-Compatible API

Use LinkHarbor with the official OpenAI SDK, Cursor, Cline, OpenWebUI, and other OpenAI-compatible tools without modifying the 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 endpoint.

Install OpenAI SDK

Install the official OpenAI SDK for your runtime. Make sure Python or Node.js is already available on your system.

Configure API Key

Your API key authenticates requests to the OpenAI-compatible API. Store it in an environment variable instead of hardcoding it in source code.

Configure OpenAI-Compatible Endpoint

Set the base URL so the SDK sends requests to LinkHarbor instead of the default OpenAI endpoint.

Start Using

Once configured, start sending OpenAI-compatible requests.

API Reference

The platform supports the standard OpenAI-compatible API format. All requests should include an Authorization header and a JSON content type.

Base URL

https://api.linkharbor.ai/v1

Send chat completion requests through the standard OpenAI-compatible endpoint.

Chat Completions Endpoint

https://api.linkharbor.ai/v1/chat/completions

Send chat completion requests through the standard OpenAI-compatible endpoint.

Headers

All OpenAI-compatible requests must include the following headers.

Headers

Request Example

All requests follow the standard OpenAI Chat Completions format.

JSON

Examples

Use the official OpenAI 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

Cursor, Cline, OpenWebUI, the OpenAI SDK, and similar OpenAI-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.

Why am I getting 401 Unauthorized?
Check that the API key is valid, not expired or revoked, and sent as Authorization: Bearer YOUR_API_KEY.
Why is the API not responding?
Check your network connection, model name, and that OPENAI_BASE_URL points to the LinkHarbor OpenAI-compatible endpoint.
Is the official OpenAI SDK supported?
Yes. You can integrate directly with the official OpenAI SDK by changing the base URL and API key.

What's next