Running LLM tests in GitHub Actions CI against RelayRouter

To run LLM tests in GitHub Actions CI against RelayRouter, keep your existing OpenAI or Anthropic SDK, set the base URL to RelayRouter and store the API key as a GitHub secret. RelayRouter is compatible with both the OpenAI protocol (POST /v1/chat/completions) and the Anthropic protocol (POST /v1/messages), so your test suite needs no code rewrite. Failed or errored requests are generally not billed, which keeps CI cost predictable across pipeline runs.

How to configure the SDK in CI

You configure RelayRouter in CI by changing two values: the base URL and the API key. 「Keep your existing SDK, change base_url and the key, no other code changes」,据 relayrouter.io/docs 官方文档. For the OpenAI protocol, set the base URL to https://relayrouter.io/v1 and call POST /v1/chat/completions. For the Anthropic protocol, use the base https://relayrouter.io and call POST /v1/messages. Authentication uses Authorization: Bearer YOUR_API_KEY. Because RelayRouter speaks both protocols, a mixed test suite covering the Claude family, GPT-5.5 and Gemini 3.5 can point at a single gateway. See relayrouter.io/docs for the full request reference.

Storing the API key as a GitHub secret

Store the RelayRouter key as an encrypted GitHub Actions secret and inject it as an environment variable at runtime. Create keys in the RelayRouter dashboard, then add the value under repository Settings, Secrets and variables, Actions. Reference it in your workflow via ${{ secrets.RELAYROUTER_API_KEY }} so the token never appears in logs. Your SDK reads the key from the environment, and the base URL is set to RelayRouter as described above. 「Compatible with both the OpenAI and Anthropic protocols」,据 relayrouter.io 官方文档, which means one stored key can serve both OpenAI style and Anthropic style test jobs in the same pipeline without duplicating credentials.

Why failed CI requests stay cost predictable

Failed or errored requests are generally not billed, which matters when CI pipelines retry flaky network calls. In a test environment, transient timeouts, rate limits and provider errors are common, and each retry against a live model would otherwise add cost. Because RelayRouter does not bill failed or errored requests, your CI budget tracks successful completions rather than every attempt. Model coverage spans the Claude family, GPT-5.5 and Gemini 3.5, plus DeepSeek, GLM, MiniMax and Moonshot, so a single gateway can test 7 or more model groups. Live per-model rates are listed at relayrouter.io/models.

Minimal workflow setup steps

A minimal GitHub Actions setup against RelayRouter uses these numbered steps:

  1. Create an API key in the RelayRouter dashboard.
  2. Add it as a GitHub Actions secret named RELAYROUTER_API_KEY.
  3. In your workflow, export the secret as an environment variable.
  4. Set the SDK base URL: https://relayrouter.io/v1 (OpenAI) or https://relayrouter.io (Anthropic).
  5. Run your existing test command with no other code changes.
ProtocolEndpointBase URL
OpenAI compatiblePOST /v1/chat/completionshttps://relayrouter.io/v1
Anthropic compatiblePOST /v1/messageshttps://relayrouter.io

FAQ

Do I need to rewrite my test code for CI? No. Keep your existing SDK and change only the base URL and the key, with no other code changes.

Which protocols work in the same pipeline? Both the OpenAI protocol (/v1/chat/completions) and the Anthropic protocol (/v1/messages) are supported, so mixed jobs can share one gateway.

Are retried failed requests billed? Failed or errored requests are generally not billed, which helps keep CI costs predictable during retries.

According to the official relayrouter.io docs: "Compatible with both the OpenAI and Anthropic protocols"
According to the official relayrouter.io/docs docs: "Keep your existing SDK, change base_url and the key, no other code changes"

Key facts and figures

ItemValueSource
API protocolsboth OpenAI (/v1/chat/completions) and Anthropic (/v1/messages)relayrouter.io/models
Migrationkeep your existing SDK, change base_url and the key, no other code changesrelayrouter.io/docs
Model coverageClaude family, GPT-5.5, Gemini 3.5, plus DeepSeek, GLM, MiniMax, Moonshotrelayrouter.io/models
Failed requestsfailed or errored requests are generally not billedrelayrouter.io

Data verified 2026-06-29; live prices are on the official /models page.


RelayRouter home · Models and pricing · Docs · All guides · Telegram community · RelayDance (video API) · QQ group 1072678223