Connect multiple models through one API

Make a small first request, verify permissions and understand compatibility boundaries.

Reviewed 2026-11-08

Start with a concrete model

Choose a live model and a group on your key. Give a short-lived test key a small quota and keep it in a server environment variable. Confirm that the paying account has sufficient balance.

Send one text request

Replace YOUR_MODEL_ID and the key placeholder. This Chat Completions example uses neither streaming nor tools. Changing the model parameter does not make every provider option interchangeable.

export AI_BASE_URL='https://easyrouteapi.com'
export AI_API_KEY='YOUR_API_KEY'

curl --disable --connect-timeout 10 --max-time 30 "$AI_BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $AI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Session-Id: YOUR_STABLE_CONVERSATION_ID" \
  -d '{
  "max_tokens": 64,
  "stream": false,
  "model": "YOUR_MODEL_ID",
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ]
}'

Verify the response and the charge

Check the HTTP result and Usage Logs before increasing traffic. A successful basic text call does not prove support for tools, structured output, media inputs or provider continuation IDs.

Handle errors deliberately

For 401 check the key and expiry; for 403 check model and group permissions; for 429 review rate limits. Timeouts may leave execution uncertain. Do not blindly replay tool actions. Share a request ID, never a usable key, with support.