Jump to content
CodeRelayHub

API reference

Every route the hub relays, how keys are sent, what errors look like and which limits apply.

Endpoints

RouteUse
POST /v1/chat/completionsOpenAI Chat Completions; streamed calls carry usage automatically.
POST /v1/responsesOpenAI Responses API, used by Codex.
POST /v1/embeddingsEmbeddings, for models that offer them.
POST /v1/messagesAnthropic Messages, for Claude Code and Claude Desktop.
POST /v1/messages/count_tokensToken counting; never billed.
POST /v1beta/models/{model}:generateContentGemini native, one response.
POST /v1beta/models/{model}:streamGenerateContent?alt=sseGemini native, streamed as server-sent events.
GET /v1/models · GET /v1beta/modelsModel lists in OpenAI and Gemini format; need a key, cost nothing.

Sending the key

Use Authorization: Bearer, x-api-key or x-goog-api-key; Gemini clients may also append ?key=, which is stripped before forwarding.

curl · Gemini
curl --request POST "https://api.coderelayhub.com/v1beta/models/gemini-3.8-flash:generateContent" \
  --header "x-goog-api-key: crh_paste_your_key_here" --header "Content-Type: application/json" \
  --data '{"contents":[{"role":"user","parts":[{"text":"Summarize git rebase in one line"}]}]}'

Error codes

Every call is billed on the tokens the provider reports. Errors come back in the OpenAI error envelope.

HTTPtypeWhat it means on the hub
400invalid_request_error · model_not_foundMalformed request, missing model, unknown model, or a model sent to the wrong protocol.
401authentication_errorNo API key was sent, or the key is unknown or revoked.
402insufficient_quotaBalance is at zero (pay-as-you-go key) or the matching monthly plan is used up. Top up to continue.
403permission_errorThe account is suspended, or a monthly-plan key called a model outside its family.
413invalid_request_errorRequest body larger than 25 MB.
429rate_limit_errorMore than 120 calls a minute on one key, or 8 calls already in flight for the account.
502api_errorThe provider could not be reached, and nothing was charged.

Limits

  • 120 requests per rolling minute per key.
  • 8 requests in flight per account.
  • 25 MB per request body; long streams are never cut by a timeout.