Documentation

ApiLink is a drop-in OpenAI-compatible API gateway. Access models from OpenAI, Anthropic, Google, DeepSeek, Qwen, and more through a single endpoint.

Quickstart

Get your API key from the Dashboard, then replace OPENAI_BASE_URL and OPENAI_API_KEY in any OpenAI-compatible client.

typescript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey:  "al-your-key-here",          // Your ApiLink key
  baseURL: "https://apilink.io/v1",
});

const response = await client.chat.completions.create({
  model:    "anthropic/claude-sonnet-4.6",  // any model from /v1/models
  messages: [{ role: "user", content: "Hello!" }],
});

console.log(response.choices[0].message.content);
python
from openai import OpenAI

client = OpenAI(
    api_key  = "al-your-key-here",
    base_url = "https://apilink.io/v1",
)

response = client.chat.completions.create(
    model    = "openai/gpt-5.2",
    messages = [{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

Authentication

All requests require a Bearer token in the Authorization header. ApiLink keys always start with al-.

bash
curl https://apilink.io/v1/chat/completions \
  -H "Authorization: Bearer al-your-key-here" \
  -H "Content-Type: application/json" \
  -d '{"model":"anthropic/claude-sonnet-4.6","messages":[{"role":"user","content":"Hi"}]}'
Create and manage your API keys in the Dashboard → API Keys tab. Each key can be revoked independently.

Endpoints

MethodPathDescription
POST/v1/chat/completionsChat completions — streaming and non-streaming
POST/v1/embeddingsText embeddings — returns float vectors
POST/v1/responsesOpenAI Responses API — used by Codex CLI
GET/v1/modelsList all available models with pricing
All endpoints use the same Authorization: Bearer al-... header and are billed from the same credit balance.

Listing Models

Fetch the full list of available models programmatically:

bash
curl https://apilink.io/v1/models \
  -H "Authorization: Bearer al-your-key-here"
json
{
  "object": "list",
  "data": [
    {
      "id":             "anthropic/claude-sonnet-4.6",
      "object":         "model",
      "owned_by":       "anthropic",
      "context_window": 200000
    },
    {
      "id":             "openai/gpt-5.2",
      "object":         "model",
      "owned_by":       "openai",
      "context_window": 128000
    }
  ]
}

You can also browse all models with pricing on the Models page.

Embeddings

Generate vector embeddings for text. Use them for semantic search, RAG pipelines, clustering, and similarity matching. Works with any OpenAI-compatible embeddings model in the catalog.

typescript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey:  "al-your-key-here",
  baseURL: "https://apilink.io/v1",
});

const response = await client.embeddings.create({
  model: "openai/text-embedding-3-small",
  input: "The quick brown fox jumps over the lazy dog",
});

console.log(response.data[0].embedding); // float[] — 1536 dimensions
python
from openai import OpenAI

client = OpenAI(
    api_key  = "al-your-key-here",
    base_url = "https://apilink.io/v1",
)

response = client.embeddings.create(
    model = "openai/text-embedding-3-small",
    input = "The quick brown fox jumps over the lazy dog",
)
print(response.data[0].embedding)  # list[float]
ParameterTypeDescription
modelstringModel ID from /v1/models
inputstring | string[]Text to embed. Pass an array to batch multiple strings in one call
encoding_formatstringOptional. "float" (default) or "base64"
dimensionsnumberOptional. Reduce output dimensions (model-dependent)
Embeddings are billed by input tokens only — there are no output tokens. Check the Models page for embedding model prices.

Responses API

ApiLink supports the OpenAI Responses API — the newer format used by Codex CLI, Agents SDK, and other OpenAI tooling. You can use it as a drop-in replacement without changing your API key or base URL.

bash
# Codex CLI — just set these two env vars
export OPENAI_API_KEY="al-your-key-here"
export OPENAI_BASE_URL="https://apilink.io/v1"

codex "refactor this function to use async/await"
typescript
// Direct Responses API call
const response = await fetch("https://apilink.io/v1/responses", {
  method:  "POST",
  headers: {
    "Authorization": "Bearer al-your-key-here",
    "Content-Type":  "application/json",
  },
  body: JSON.stringify({
    model:        "anthropic/claude-sonnet-4.6",
    input:        "Write a haiku about recursion.",
    instructions: "You are a creative poet.",  // optional system prompt
    stream:       false,
  }),
});

const data = await response.json();
console.log(data.output[0].content[0].text);
ParameterTypeDescription
modelstringModel ID from /v1/models
inputstring | arrayUser message as a string, or an array of message objects
instructionsstringOptional system prompt
max_output_tokensnumberOptional. Max tokens to generate
streambooleanOptional. Set true for SSE streaming
temperaturenumberOptional. Sampling temperature (0–2)
The Responses API response format differs from Chat Completions — text is at output[0].content[0].text instead of choices[0].message.content. Streaming emits standard response.output_text.delta events.

Error Codes

HTTPerror.typeCause
401invalid_request_errorMissing or invalid API key
402insufficient_quotaBalance is $0.00 — recharge in the dashboard
404invalid_request_errorModel not found or not active
429rate_limit_exceededOver 60 requests/min per key (default limit)
500api_errorInternal server error
503api_errorAll upstream providers unavailable, retry shortly

Every error response includes a request_id field. Include it when contacting support:

json
{
  "error": {
    "message":    "Insufficient balance. Recharge at https://apilink.io/dashboard",
    "type":       "insufficient_quota",
    "request_id": "3f7a2b1c-..."
  }
}

Rate Limits

LimitValueScope
Requests per minute60 RPMPer API key
Max request timeout120 secondsPer request
Max contextModel-dependent (up to 1M tokens)Per request

Every response includes rate limit headers so your client can track usage automatically:

bash
X-RateLimit-Limit-Requests:     60
X-RateLimit-Remaining-Requests: 58
X-RateLimit-Reset-Requests:     42s
Need higher limits? Contact support@apilink.io — enterprise tiers are available.

Billing & Credits

ApiLink uses a prepaid credit model. Credits are deducted per request based on actual token usage.

ItemDetail
Pricing unitPer 1,000 tokens (input and output billed separately)
Minimum recharge$5 USD
Unused creditsRoll over indefinitely — no expiry
InvoicesAvailable for every completed payment (Dashboard → Credits)
InvoicesEmail support@apilink.io with your company details
See per-model pricing on the Models page. Prices are shown per 1M tokens for readability.

Client Setup Guides

Codex CLI

Set two environment variables — Codex uses the Responses API which ApiLink fully supports:

bash
export OPENAI_API_KEY="al-your-key-here"
export OPENAI_BASE_URL="https://apilink.io/v1"

codex "refactor this function to use async/await"
Cursor

Settings → Models → OpenAI API Key → paste your al-... key. Under "Base URL" enter:

bash
Base URL: https://apilink.io/v1
Continue (VS Code)

In config.json, add a provider with type "openai" and set baseUrl and apiKey:

json
{
  "models": [{
    "title":       "Claude via ApiLink",
    "provider":    "openai",
    "model":       "anthropic/claude-sonnet-4.6",
    "apiKey":      "al-your-key-here",
    "apiBase":     "https://apilink.io/v1"
  }]
}
Aider

Pass --openai-api-base and --openai-api-key on the command line, or set them as env vars:

bash
aider \
  --openai-api-base https://apilink.io/v1 \
  --openai-api-key  al-your-key-here \
  --model           anthropic/claude-sonnet-4.6
LiteLLM

Use the openai/ prefix for any model:

python
import litellm

response = litellm.completion(
    model     = "openai/anthropic/claude-sonnet-4.6",  # openai/ tells LiteLLM to use OpenAI-compatible adapter
    messages  = [{"role": "user", "content": "Hello"}],
    api_key   = "al-your-key-here",
    api_base  = "https://apilink.io/v1",
)

FAQ

Is ApiLink a reseller or the original provider?
ApiLink is a reseller. We route your requests to upstream providers (OpenAI, Anthropic, Google, etc.) and bill you at our listed rates. We are not affiliated with any upstream provider.
Which OpenAI features are supported?
Chat completions (streaming included), embeddings (/v1/embeddings), and the OpenAI Responses API (/v1/responses, used by Codex CLI). Image generation, audio, Assistants API, and fine-tuning are not currently supported.
Can I get an invoice for my company?
Yes. A receipt is available for every completed payment from Dashboard → Credits → Payment History. For a formal invoice, email support@apilink.io with your company details.
What happens if I run out of credits mid-request?
We pre-deduct an estimated amount before forwarding your request. If your balance is below the estimate, the request returns a 402 error before reaching the upstream provider.
How do I report a billing discrepancy?
Every API response includes an X-Request-Id header. Email support@apilink.io with the request ID and we will investigate.
Is my data stored?
We log request metadata (model, token counts, cost, timestamp) for billing and debugging. We do not store prompt or completion content. See our Privacy Policy for details.
Still have questions?
We usually reply within a few hours.
Contact support →