MyRelay

Help, one question at a time

Everything goes through one address: https://api.myapirelay.com. Use the key from your console wherever a tool asks for an API key.

  1. Where are my address and key?
  2. Can I try it with one command first?
  3. I use Claude Code. What do I change?
  4. What about Codex, Cursor or the OpenAI SDK?
  5. How do Gemini CLI and the Gemini API connect?
  6. How am I charged, and what does a 402 mean?

Where are my address and key?

The address is https://api.myapirelay.com. Keys are made under API keys in your dashboard, where you can copy or retire them at any time.

Send your key as Authorization: Bearer for OpenAI-style calls, or as x-api-key for Anthropic-style calls.

Can I try it with one command first?

curl -sS -H "Content-Type: application/json" -H "Authorization: Bearer myr_your_key_here" \
  https://api.myapirelay.com/v1/chat/completions \
  -d '{"model":"gpt-6.1-sol","messages":[{"role":"user","content":"Hi from my own relay"}]}'

GPT model IDs that work well here:

  • gpt-6.1-sol
  • gpt-6-astra
  • gpt-5.6-sol

I use Claude Code. What do I change?

Set two environment variables, then start Claude Code the usual way. Use the address without /v1.

export ANTHROPIC_BASE_URL=https://api.myapirelay.com
export ANTHROPIC_AUTH_TOKEN=myr_your_key_here
claude
setx ANTHROPIC_BASE_URL https://api.myapirelay.com
setx ANTHROPIC_AUTH_TOKEN myr_your_key_here
claude

Claude models are only served to the official Claude Code and Claude Desktop clients, version 2.1.285 or newer. This rule comes from the model provider. GPT, Gemini and the other families work with any client.

What about Codex, Cursor or the OpenAI SDK?

OpenAI-style clients take the address with /v1 at the end, plus your key. Chat requests go to /v1/chat/completions.

base_url = "https://api.myapirelay.com/v1"
api_key  = "myr_your_key_here"
# chat endpoint: https://api.myapirelay.com/v1/chat/completions

Codex and most editors have a base URL field (or read OPENAI_BASE_URL); give it the /v1 address shown above.

How do Gemini CLI and the Gemini API connect?

Gemini uses its own native protocol. Give Gemini CLI the bare address, without /v1beta, and your key.

export GOOGLE_GEMINI_BASE_URL=https://api.myapirelay.com
export GEMINI_API_KEY=myr_your_key_here
gemini
curl -sS -H "Content-Type: application/json" -H "x-goog-api-key: myr_your_key_here" \
  "https://api.myapirelay.com/v1beta/models/gemini-3.8-flash:generateContent" \
  -d '{"contents":[{"role":"user","parts":[{"text":"Hi from my own relay"}]}]}'

Gemini models do not go through /v1/chat/completions. For streaming, call :streamGenerateContent?alt=sse. Gemini model IDs:

  • gemini-2.5-flash
  • gemini-3.1-pro
  • gemini-3.8-flash

How am I charged, and what does a 402 mean?

Each request is charged on the tokens the model really used, cache reads and writes included, at the prices on the menu.

An HTTP 402 reply means your budget is empty (or the pass behind a pass key has nothing left). Top up and try again.