Migrate

Migrate from OpenRouter to ModelAPI

Change the base URL and key. Keep your SDK, prompts, and tools.

  1. Step 1

    Keep the OpenAI SDK

    Do not rewrite prompts or tool schemas. Only change base URL and key.

  2. Step 2

    Swap the endpoint

    Replace OpenRouter base URL with ModelAPI.

    base_url = "https://api.aimodelapi.ai/v1"
  3. Step 3

    Map model IDs

    Use catalog IDs such as claude-sonnet-5, gpt-5.6-sol, deepseek-v4-flash. OpenRouter provider suffixes are not required.

  4. Step 4

    Verify with curl

    Run one completion, then point Cursor / Claude Code at the same key.

curl · OpenAI compatible
curl https://api.aimodelapi.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-ama-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"ping"}]}'