Integrations
OpenAI SDK (any language)
The generic recipe — swap the base URL, keep everything else.
Any OpenAI-compatible client works with Linkex by changing two values: the base URL and the API key. This covers the official OpenAI SDKs, LangChain, LlamaIndex, Vercel AI SDK, and most agent frameworks.
The recipe
| Setting | Value |
|---|---|
| Base URL | https://linkex.ai/v1 |
| API key | your Linkex sk-... key |
| Model | any id from linkex.ai/pricing |
from openai import OpenAI
client = OpenAI(base_url="https://linkex.ai/v1", api_key="sk-YOUR_KEY")
# streaming works as usual
stream = client.chat.completions.create(
model="claude-sonnet-4-5",
messages=[{"role": "user", "content": "Stream me a haiku"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://linkex.ai/v1',
apiKey: process.env.LINKEX_API_KEY,
});
const stream = await client.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Stream me a haiku' }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}import (
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
client := openai.NewClient(
option.WithBaseURL("https://linkex.ai/v1"),
option.WithAPIKey(os.Getenv("LINKEX_API_KEY")),
)from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://linkex.ai/v1",
api_key="sk-YOUR_KEY",
model="gemini-2.5-pro",
)import { createOpenAI } from '@ai-sdk/openai';
const linkex = createOpenAI({
baseURL: 'https://linkex.ai/v1',
apiKey: process.env.LINKEX_API_KEY,
});
const model = linkex('claude-sonnet-4-5');Other request formats
Beyond the OpenAI format, the same key also authenticates:
- Anthropic Messages —
POST https://linkex.ai/v1/messages(see Claude Code) - Gemini —
https://linkex.ai/v1beta/models/...
Common errors
| HTTP | Cause | Fix |
|---|---|---|
| 401 | Bad or disabled key | Recreate the key in Console → Keys; check the Bearer prefix |
| 403 | Model not enabled for your token/group | Check the key's model restrictions in the console |
| 429 | Rate limit | Back off and retry; per-key limits protect the shared account |
| Insufficient balance error | Balance exhausted | Top up |
| 404 on model | Wrong model id | Copy the exact id from GET /v1/models or the pricing page |