@bitkyc08/opencodex
Version:
Universal provider proxy for OpenAI Codex & Claude Code — use any LLM with Codex CLI/App/SDK and Claude Code
16 lines (14 loc) • 789 B
text/typescript
/**
* Vertex regional hosts are formed as `<location>-aiplatform.googleapis.com`, and the `us`/`eu`
* multi-regions as `aiplatform.<location>.rep.googleapis.com` (vertexHostForLocation).
* Restricting the location to one lowercase DNS label keeps user configuration
* from changing the request authority while remaining forward-compatible with
* new Google regions and multi-regions.
*/
const GOOGLE_VERTEX_LOCATION_LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
export function googleVertexLocationConfigError(location: unknown): string | null {
if (typeof location !== "string" || !GOOGLE_VERTEX_LOCATION_LABEL.test(location)) {
return "Vertex AI location must be a single lowercase Google Cloud location label (for example, us-central1 or global)";
}
return null;
}