Skip to content

Add attested AI Gateway client with automatic Cloudflare failover#171

Open
rajarshidattapy wants to merge 1 commit into
Layr-Labs:masterfrom
rajarshidattapy:master
Open

Add attested AI Gateway client with automatic Cloudflare failover#171
rajarshidattapy wants to merge 1 commit into
Layr-Labs:masterfrom
rajarshidattapy:master

Conversation

@rajarshidattapy

@rajarshidattapy rajarshidattapy commented Jul 15, 2026

Copy link
Copy Markdown

Summary

Fixes #170

This PR introduces an attested AI Gateway client for the EigenCloud SDK, providing authenticated access to the AI Gateway while improving resilience against transient Cloudflare edge failures.

What's included

  • Add @layr-labs/ecloud-sdk/ai as a dedicated AI Gateway client
  • Support attestation-based Bearer authentication using the existing AttestClient and JwtProvider
  • Add helpers for:
    • /v1/models
    • /v1/chat/completions
  • Automatically detect transient Cloudflare 5xx HTML responses and fail over to configured alternate gateway URLs
  • Surface richer diagnostics on failures, including:
    • HTTP status
    • Content-Type
    • Response body snippet
    • cf-ray identifier

Testing

  • pnpm.cmd -C packages/sdk exec vitest run
  • pnpm.cmd -C packages/sdk run typecheck
  • pnpm.cmd -C packages/sdk run lint
  • pnpm.cmd -C packages/sdk run build

…les/ai/index.ts and packages/sdk/src/ai.ts. It supports attestation bearer auth, /v1/models, /v1/chat/completions,

  ECLOUD_AI_GATEWAY_URL, ECLOUD_AI_GATEWAY_FALLBACK_URLS, Cloudflare transient 5xx failover, and diagnostic errors with cf-ray details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI-gateway calls from mainnet-alpha enclaves 502 at Cloudflare edge (asia-southeast1); same calls succeed from outside

1 participant