Skip to content
All guides

Integrations

AI Models Router speaks the OpenAI Chat Completions format, so most AI tools work with it by changing two settings: the base URL https://api.aimodelsrouter.ai/v1 and your API key. It also speaks the OpenAI Responses and Anthropic Messages APIs, for Codex and Claude Code. Below are exact steps for popular tools and frameworks.

Coding agents and apps

Codex CLI OpenAI's coding agent for the terminal

Tested 2026-11-03 against the live API· Codex CLI 0.166.0 on Windows 11
  1. Install Codex (npm i -g @openai/codex) and put your key in the AMR_API_KEY environment variable.
  2. Add the provider below to ~/.codex/config.toml. wire_api = "responses" uses our Responses API endpoint.
  3. Keep web_search = "disabled": Codex turns web search on by default, and it is a hosted OpenAI tool we don't run (requests that include it get a 400 saying so).
  4. Run codex, or codex exec "…", in your project.
model = "deepseek/deepseek-v4.1-flash-1017"
model_provider = "aimodelsrouter"
model_context_window = 1048576
web_search = "disabled"

[model_providers.aimodelsrouter]
name = "AI Models Router"
base_url = "https://api.aimodelsrouter.ai/v1"
env_key = "AMR_API_KEY"
wire_api = "responses"
  • Codex prints "Model metadata for … not found. Defaulting to fallback metadata": it knows only OpenAI's models. It works; model_context_window gives it the real context window.
  • Nothing is stored on our side, so Codex sends the whole conversation each turn (its default for this setup). previous_response_id is not supported.
  • Pick a model with Tool calling on its page. On Windows, Codex's workspace-write sandbox may need setting up; that is Codex, not the API.

What we tested: With this configuration, on DeepSeek V4.1 Flash 1017 through the production API, it created a file, read it back and ran a shell command.

Source: Codex docs: config.toml reference · Our Responses API reference

Claude Code Anthropic's coding agent for the terminal and IDEs

Tested 2026-11-03 against the live API· Claude Code 2.1.314 on Windows 11
  1. Set the variables below in the shell that starts claude, or in the env block of ~/.claude/settings.json.
  2. ANTHROPIC_BASE_URL is https://api.aimodelsrouter.ai, without /v1: Claude Code adds /v1/messages itself. ANTHROPIC_AUTH_TOKEN is your key.
  3. Set every model variable to one of our model IDs. Claude Code uses the Haiku model for background work and the subagent model for subagents; a claude-… ID gets a 404.
  4. CLAUDE_CODE_MAX_CONTEXT_TOKENS gives Claude Code the model's real context window (it assumes 200k for IDs it doesn't know).
export ANTHROPIC_BASE_URL="https://api.aimodelsrouter.ai"
export ANTHROPIC_AUTH_TOKEN="sk-amr-v1-..."
export ANTHROPIC_MODEL="deepseek/deepseek-v4.1-flash-1017"
export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek/deepseek-v4.1-flash-1017"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek/deepseek-v4.1-flash-1017"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek/deepseek-v4.1-flash-1017"
export CLAUDE_CODE_SUBAGENT_MODEL="deepseek/deepseek-v4.1-flash-1017"
export CLAUDE_CODE_MAX_CONTEXT_TOKENS="1048576"
claude
  • Claude Code's WebSearch tool uses a search Anthropic runs on its servers, so it returns an error here and the agent carries on without it. WebFetch, Bash, file tools and subagents work.
  • Our models take text and images: a PDF document block is replaced by a note telling the model it couldn't be read.
  • A [claude-code:unrecognized_model] line on startup is informational.

What we tested: With this configuration, on DeepSeek V4.1 Flash 1017 through the production API, it created a file, read it back and ran a shell command.

Source: Claude Code docs: model configuration · Our Anthropic Messages reference

Cline AI coding agent for VS Code

From Cline's official docs
  1. Open Cline's settings (the gear icon).
  2. Set API Provider to OpenAI Compatible.
  3. Base URL: https://api.aimodelsrouter.ai/v1 · API Key: your sk-amr-v1-… key · Model: a model ID, e.g. the one below.
  4. Under Model Configuration, tick Image Support only if the model accepts images, and set the context window.
deepseek/deepseek-v4.1-flash-1017
  • Coding agents rely on tool calling: pick a model marked Tool calling on its page.

Source: Cline docs: OpenAI Compatible (checked October 2026)

Kilo Code AI coding agent for VS Code and the terminal

From Kilo Code's official docs
  1. In settings open the Providers tab and choose Custom provider.
  2. Set Provider API to OpenAI Compatible (not "OpenAI Responses" or "Anthropic Messages"), Base URL to https://api.aimodelsrouter.ai/v1 and paste your key.
  3. Models are fetched from the API automatically; pick one and submit. Or configure it in kilo.jsonc as below.
{
  "$schema": "https://app.kilo.ai/config.json",
  "model": "aimodelsrouter/deepseek/deepseek-v4.1-flash-1017",
  "provider": {
    "aimodelsrouter": {
      "options": {
        "apiKey": "{env:AMR_API_KEY}",
        "baseURL": "https://api.aimodelsrouter.ai/v1"
      },
      "models": {
        "deepseek/deepseek-v4.1-flash-1017": {
          "name": "DeepSeek V4.1 Flash 1017",
          "tool_call": true,
          "limit": {
            "context": 1048576,
            "output": 32768
          }
        }
      }
    }
  }
}
  • Set tool_call: true so the agent can edit files and run commands; set limit so context management works.

Source: Kilo Code docs: OpenAI compatible (checked October 2026) · Kilo Code docs: custom models

Continue Open-source AI assistant for VS Code and JetBrains

From Continue's official docs
  1. Add the model to your config.yaml as below.
  2. Use it for chat, edit and agent mode.
name: My Config
version: 0.0.1
schema: v1
models:
  - name: DeepSeek V4.1 Flash 1017 (AI Models Router)
    provider: openai
    model: deepseek/deepseek-v4.1-flash-1017
    apiBase: https://api.aimodelsrouter.ai/v1
    apiKey: sk-amr-v1-...  # your API key
    roles: [chat, edit, apply]
    capabilities: [tool_use, image_input]
    defaultCompletionOptions:
      contextLength: 1048576
      maxTokens: 32768
  • Set capabilities explicitly: tool_use is required for agent mode.
  • Don't assign the embed or autocomplete roles to these models: we don't offer an embeddings endpoint.

Source: Continue docs: OpenAI provider (checked October 2026) · Continue config reference

Aider AI pair programming in your terminal

From Aider's official docs
  1. Point Aider's OpenAI-compatible settings at us and prefix the model ID with openai/.
export OPENAI_API_BASE=https://api.aimodelsrouter.ai/v1
export OPENAI_API_KEY=sk-amr-v1-...
aider --model openai/deepseek/deepseek-v4.1-flash-1017
  • Aider warns about an unknown context window for custom models; add an .aider.model.metadata.json with max_input_tokens and prices to silence it.
  • On Windows use setx instead of export, then open a new terminal.

Source: Aider docs: OpenAI compatible APIs (checked October 2026) · Aider docs: model warnings

OpenCode AI coding agent for the terminal

Tested 2026-11-02 against the live API· OpenCode 1.19.5 on Windows 11
  1. Install OpenCode (npm i -g opencode-ai) and put your key in the AMR_API_KEY environment variable.
  2. Add the provider to opencode.json in your project as below. Use @ai-sdk/openai-compatible, not @ai-sdk/openai.
  3. Start opencode and pick the model with /models, or run one task without the UI as shown.
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "aimodelsrouter": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "AI Models Router",
      "options": {
        "baseURL": "https://api.aimodelsrouter.ai/v1",
        "apiKey": "{env:AMR_API_KEY}"
      },
      "models": {
        "deepseek/deepseek-v4-flash": {
          "name": "DeepSeek V4 Flash 0423",
          "limit": {
            "context": 1048576,
            "output": 32768
          }
        }
      }
    }
  }
}
  • Model IDs contain a slash, and that works: aimodelsrouter/deepseek/deepseek-v4-flash.
  • OpenCode shows $0 cost for custom providers. What you paid is in each response's usage and on your Activity page.
  • OpenCode asks for at most 32,000 output tokens per reply, whatever limit.output says.
  • opencode run edits files and runs commands without asking; use it in a project you are happy for it to change.

What we tested: Headless runs on DeepSeek V4 Flash and V4.1 Flash 1017: it read, edited and ran files (up to 4 tool calls in 5 steps), streaming with usage, and the fixed file printed the right answer. The /connect key prompt was not tested.

Source: OpenCode docs: providers (checked November 2026)

Open WebUI Self-hosted ChatGPT-style interface for your team

From Open WebUI's official docs
  1. Admin Settings → Connections → OpenAI → Add Connection.
  2. URL: https://api.aimodelsrouter.ai/v1 · API Key: your key. Leave Model IDs empty to load every model, or list the ones your team may use.
  3. Click Verify Connection (saving alone does not test it).
  • Keep Open WebUI's built-in embedding model for document search; we don't offer an embeddings endpoint.

Source: Open WebUI docs: OpenAI-compatible providers (checked October 2026)

LibreChat Open-source multi-model chat app

From LibreChat's official docs
  1. Add a custom endpoint to librechat.yaml and set AMR_API_KEY in your environment.
endpoints:
  custom:
    - name: "AI Models Router"
      apiKey: "${AMR_API_KEY}"
      baseURL: "https://api.aimodelsrouter.ai/v1"
      models:
        default: ["deepseek/deepseek-v4.1-flash"]
        fetch: true
      titleConvo: true
      titleModel: "deepseek/deepseek-v4.1-flash"
      modelDisplayLabel: "AI Models Router"
  • Use a distinct environment variable name such as AMR_API_KEY; don't name the endpoint openAI.

Source: LibreChat docs: custom endpoints (checked October 2026)

n8n Workflow automation with AI steps

From n8n's official docs
  1. Create an OpenAI credential: API Key = your key, Base URL = https://api.aimodelsrouter.ai/v1.
  2. In the OpenAI Chat Model node, choose the model By ID and paste a model ID.
  3. Turn Use Responses API off. Recent node versions turn it on by default; Chat Completions is the path we have checked with n8n.
deepseek/deepseek-v4.1-flash-1017
  • The credential test only lists models, so a green check doesn't prove chat works: run the node once to confirm.

Source: n8n docs: OpenAI Chat Model (checked October 2026) · n8n source: OpenAI credential

Cursor AI code editor (chat only)

From Cursor's official docs
  1. Cursor Settings → Models: paste your key into OpenAI API Key and turn on Override OpenAI Base URL.
  2. Base URL: https://api.aimodelsrouter.ai/v1. Add a model ID with the name exactly as below.
deepseek/deepseek-v4.1-flash-1017
  • Cursor documents custom keys for chat models only. Agent mode with a custom base URL sends a request format we don't serve, and Tab completion always uses Cursor's own models.
  • While the override is on, Cursor sends its other OpenAI-family models through it too; turn it off when you switch back.

Source: Cursor docs: API keys (checked October 2026) · Cursor forum: custom URL and Agent mode

DeepSeek Harness (DSH) DeepSeek's open-source agent app: desktop, web UI and CLI

Tested 2026-11-02 against the live API· DSH 0.2.1-rc.5 on Windows 11
  1. Install it (npm i -g @deepseek-ai/dsh) and put your key in the AMR_API_KEY environment variable. The CLI reads the key from the environment, ./.env or ~/.dsh/.env, not from keys saved in the app.
  2. Add AI Models Router as a provider in ~/.dsh/cordis.patch.yml as below. In the app the same is Settings → Models → Add model provider → Custom model API, protocol OpenAI Chat Completions; Fetch available models lists every model.
  3. Open the app and pick the model, or run one task from the terminal with dsh headless "…" (the first argument of a bare dsh is a profile name, not a task).
- id: llm-pi-ai
  config:
    providers:
      aimodelsrouter:
        displayName: AI Models Router
        apiKeyEnv: AMR_API_KEY
        api: openai-completions
        baseURL: https://api.aimodelsrouter.ai/v1
        reasoning: high
        compat: { thinkingFormat: deepseek }
        models:
          - { id: deepseek/deepseek-v4.1-flash-1017, name: DeepSeek V4.1 Flash 1017, contextWindow: 1048576, reasoningEfforts: { off: null, high: high } }
- id: agent-default-model
  config: { provider: aimodelsrouter, model: deepseek/deepseek-v4.1-flash-1017, reasoningEffort: high }
  • For DeepSeek models, the reasoning, compat and reasoningEfforts lines turn thinking on. Without them DSH treats the model as non-reasoning, which also works.
  • Through AI Models Router, DSH sends only chat requests and the model list. Its "Upload Session Log" setting applies to DeepSeek's own API, not to ours.
  • If you set maxTokens on a model, DSH asks for that many output tokens on every request (and holds that much); leave it out unless you need it.

What we tested: dsh headless with only ~/.dsh/cordis.patch.yml, on DeepSeek V4 Flash and V4.1 Flash 1017: coding tasks with up to 6 tool calls, thinking on and off, reasoning passed back across tool turns, and the developer role; the files it wrote ran correctly. The web UI listed all our models. The desktop app was not tested.

Source: DeepSeek Harness on GitHub (checked November 2026)

OpenMausBot Desktop app for running a team of AI bots (mausbot)

Tested 2026-11-02 against the live API· openmausbot 0.1.138 on Windows 11
  1. In the app: your avatar → Settings → AI → API keys → Your own model servers. Paste your key as the OpenAI-compatible API key and set the base URL to https://api.aimodelsrouter.ai/v1.
  2. On each bot, pick its model under Other (OpenAI-compatible). After you add the server, bots default to the first model in our list, so choose one explicitly.
  3. Or run it headless with the CLI, as below: start the server, point its OpenAI-compatible engine at us, create a bot and give it a job.
npm install -g openmausbot          # needs Node 24 or newer
export AMR_API_KEY=sk-amr-v1-...
openmausbot serve --no-pair --port 18899 &
openmausbot engine set openai-compatible --key-env AMR_API_KEY \
  --base-url https://api.aimodelsrouter.ai/v1 --port 18899
openmausbot team apply team.yaml --port 18899
openmausbot run "Researcher" "List the bots in this workspace and save that to memory" --timeout 4m --port 18899
  • Each bot step sends about 20,000 input tokens (its instructions and tool definitions), so pick a model with a low input price for busy bots.
  • mausbot stores the key in plain text in its config.json. Give it its own key with a spending limit.
  • The Check button only lists our models, which needs no key, so a wrong key shows up at the bot's first reply.
  • Leave out effort in team.yaml: "none" is refused for this engine.

What we tested: The headless server and CLI with DeepSeek V4 Flash: a bot listed the workspace's bots and wrote its memory file with tool calls over streamed requests (3 model steps). The settings screen showed the server as connected and the model in the picker. The key was set with the CLI rather than typed into the app, and the Electron window itself was not driven.

Source: OpenMausBot on GitHub (checked November 2026)

Frameworks and agent tools

For the plain OpenAI SDKs, see the Quickstart.

LangChain Python and JavaScript framework for LLM apps

Tested 2026-10-28 against the live API
  1. Use ChatOpenAI with our base URL.
# pip install langchain-openai
import os

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(model="deepseek/deepseek-v4.1-flash", base_url="https://api.aimodelsrouter.ai/v1", api_key=os.environ["AMR_API_KEY"])
print(llm.invoke("Write a one-line slogan for a bakery.").content)
  • Avoid LangChain's Responses-API-only features (built-in OpenAI tools); regular tool calling works.

Source: LangChain docs: ChatOpenAI

Vercel AI SDK TypeScript toolkit for AI apps

Tested 2026-10-28 against the live API
  1. Create an OpenAI-compatible provider once and use it everywhere.
// npm install ai @ai-sdk/openai-compatible
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";

const amr = createOpenAICompatible({
  name: "aimodelsrouter",
  baseURL: "https://api.aimodelsrouter.ai/v1",
  apiKey: process.env.AMR_API_KEY,
  includeUsage: true,
  supportsStructuredOutputs: true,
});

const { text, usage } = await generateText({
  model: amr("deepseek/deepseek-v4.1-flash"),
  prompt: "Write a one-line slogan for a bakery.",
});
console.log(text, usage);

Source: AI SDK docs: OpenAI compatible providers

LlamaIndex Python framework for data and RAG apps

Tested 2026-10-28 against the live API
  1. Use OpenAILike with is_chat_model=True (the default sends requests to an endpoint we don't serve).
# pip install llama-index-llms-openai-like
import os

from llama_index.llms.openai_like import OpenAILike

llm = OpenAILike(
    model="deepseek/deepseek-v4.1-flash",
    api_base="https://api.aimodelsrouter.ai/v1",
    api_key=os.environ["AMR_API_KEY"],
    context_window=1048576,
    is_chat_model=True,
    is_function_calling_model=True,
)
print(llm.complete("Write a one-line slogan for a bakery."))

Source: LlamaIndex docs: OpenAILike

agent-desktop Computer use for your own agent, through the accessibility tree (Vercel Labs)

Tested 2026-11-02 against the live API· agent-desktop 1.0.2 on Windows 11
  1. agent-desktop has no model inside: your agent calls it as a tool. It reads a window's accessibility tree as text, so a cheap text model can operate desktop apps without screenshots.
  2. Install it with the OpenAI SDK, open the window you want the agent to work in, and run the loop below with a goal.
  3. The loop gives the model three tools (snapshot, act, read_text), keeps it inside that one window, and stops after 12 turns.
npm install agent-desktop openai
export AMR_API_KEY=sk-amr-v1-...
node computer-use.mjs "Notepad" 'Type "Hello from AI Models Router" into the document, then verify it is there.'
  • Use set_value to type: agent-desktop refuses a plain type into a field it can't focus without a visible cursor (POLICY_DENIED). Refs look like @s1a2b3c:e4; a bare @e1 is refused.
  • Point it at a throwaway window. Snapshots send the window's text to the model, and typed text travels in process arguments, which other programs on the machine can read.
  • Windows 11 Notepad reopens earlier tabs on launch; their titles appear in the snapshot too. To close an app from the CLI, close-app --force worked where the graceful close timed out.

What we tested: This loop typed into Notepad and verified the text by reading it back, on DeepSeek V4 Flash and V4.1 Flash 1017 (3 to 5 tool calls, under 23,000 input tokens a run). Not tested: macOS and Linux, streaming, and recovery from a stale ref.

Source: agent-desktop on GitHub (checked November 2026)

Not supported yet: embeddings, and OpenAI's and Anthropic's hosted tools (web search, file search, code execution). Tools that require them won't work until we add them. Ask us at support@aimodelsrouter.ai if you need one.