Skip to main content
This page sets Eden AI as Lynkr’s provider and configures complexity-based tier routing, then points Claude Code or Codex at Lynkr. Cursor is covered by a link to Lynkr’s own guide.

Overview

Lynkr is an open-source, self-hosted LLM gateway for coding tools. Its tier-based routing scores each request for complexity (0-100) and maps it to one of four tiers, each with its own model. Eden AI is a built-in Lynkr provider, so a tier can point at any of 1000+ models from OpenAI, Anthropic, Google, Mistral and more, behind one key and one bill. Lynkr adds a hop that the Claude Code page does not have. There, Claude Code talks to Eden AI directly. Here, your tool talks to Lynkr on your machine, and Lynkr talks to Eden AI’s /v3/chat/completions with its own key. The key and the model are configured in Lynkr, not in the tool.

Prerequisites

  • Node.js 20 or later and npm, which every install method below requires
  • Eden AI API key from app.edenai.run → API Keys
  • A tool that can use a custom base URL: Claude Code, Cursor or Codex CLI

Installation

Quick Start

Run the setup wizard. Pick Direct API usage as the usage mode (the default, Claude Pro/Max passthrough, is not what this page sets up), then choose Eden AI as the provider for each of the four tiers and paste your key when it asks. It writes a .env that Lynkr reads, including the port:
lynkr start serves an Anthropic-compatible /v1/messages endpoint for Claude Code, an OpenAI-compatible /v1/chat/completions endpoint for Cursor, and a /v1/responses endpoint for Codex, on port 8081 (the port lynkr init writes). To configure by hand instead of using the wizard, set the variables in Configuration, including PORT, before lynkr start: without it Lynkr listens on port 8080.
Lynkr does not check the key a client sends, and it listens on every network interface, not only localhost. Anyone who can reach its port can send requests billed to your Eden AI key. On a shared network, block the port from other machines with a firewall, or put Lynkr behind a proxy that requires authentication.

Connect your tool

Point the tool at Lynkr, not at Eden AI. Your Eden AI key stays in Lynkr’s configuration, so the tool’s own key setting can hold any value.
The first time you launch claude with ANTHROPIC_API_KEY set, it asks whether to use that key and preselects No: choose Yes. To skip the prompt, export ANTHROPIC_AUTH_TOKEN="dummy" instead, which takes effect at once (Claude Code’s gateway documentation describes both variables). For Cursor, follow Lynkr’s Cursor guide, which covers Cursor’s base URL setting. The Claude Code settings differ from the Claude Code page on purpose: that page sets ANTHROPIC_BASE_URL to https://api.edenai.run/v3 and ANTHROPIC_API_KEY to your Eden AI key, because there the hop is Claude Code to Eden AI. With Lynkr in between, the hop is Claude Code to Lynkr, and Lynkr holds the Eden AI key. Test the gateway with a direct request:
curl
The model value in a request never becomes the Eden AI model. Lynkr chooses it: EDENAI_MODEL under static routing, or the model of the selected tier under tier routing. Under tier routing, a request model that contains -mini or -nano, or a reasoning.effort value, pins the tier instead of letting Lynkr score the request, and the pin governs only the first model call of a turn. The model that answers is still that tier’s.

Configuration

Lynkr reads provider credentials from environment variables or a .env file. EDENAI_API_KEY and EDENAI_MODEL are the two to set:
EDENAI_ENDPOINT already defaults to https://api.edenai.run/v3/chat/completions, so set it only to change it.

Routing modes

Static: every request goes to Eden AI:
Tier-based (recommended for cost): set all four tiers to Eden AI models and Lynkr routes by request complexity. MODEL_PROVIDER stays set because Lynkr uses it for startup checks and as the default provider for a tier value without a provider: prefix:

Model naming

Use a model name or ~ alias from GET /v3/models, such as ~claude-sonnet-latest; a provider/model id pins one provider. In a tier value, put it after the edenai: prefix: edenai:~claude-sonnet-latest. Lynkr forwards tool definitions, so choose models that support function calling.

Troubleshooting

Tier routing is not active

Lynkr turns tier routing off, with a warning at startup, unless all four of TIER_SIMPLE, TIER_MEDIUM, TIER_COMPLEX and TIER_REASONING are set. The warning names the missing ones. Until you set them, Lynkr routes statically and every request uses EDENAI_MODEL.

Authentication errors

Eden AI answers 401 with Invalid API key for a wrong or revoked sk-eden- key, and with Invalid token for a value of any other shape. Check EDENAI_API_KEY in the environment or .env that lynkr start reads, then restart Lynkr. The key in your tool’s own settings is not the one Eden AI sees.

Next Steps