can1357/oh-my-pi · error · AIError.ConfigurationError

CoreWeave Serverless Inference requires OpenAI-Project. Set

Error message

CoreWeave Serverless Inference requires OpenAI-Project. Set COREWEAVE_PROJECT=<team>/<project> before running /login coreweave. To persist it, ${PROJECT_PERSIST_INSTRUCTIONS}.

What it means

CoreWeave Serverless Inference requires an OpenAI-Project header identifying the <team>/<project> the request targets. requireCoreWeaveProjectHeaders() reads COREWEAVE_PROJECT (via coreWeaveProjectHeaders($env)) and, when absent, throws this ConfigurationError telling the user to set the variable before running /login coreweave. The library refuses to authenticate or call CoreWeave without it because the OpenAI-Project header is mandatory on CoreWeave's OpenAI-compatible endpoint.

Source

Thrown at packages/ai/src/registry/coreweave.ts:15

import { coreWeaveProjectHeaders } from "@oh-my-pi/pi-catalog/wire/coreweave";
import { $env } from "@oh-my-pi/pi-utils";
import * as AIError from "../error";
import { createApiKeyLogin } from "./api-key-login";
import type { OAuthLoginCallbacks } from "./oauth/types";
import type { ProviderDefinition } from "./types";

const PROJECT_PERSIST_INSTRUCTIONS =
	"add export COREWEAVE_PROJECT=<team>/<project> to your shell startup file (for example ~/.zshrc, ~/.bashrc, or your shell's profile/rc file)";
const PROJECT_SETUP_INSTRUCTIONS = `Create or select a CoreWeave Serverless Inference project, ${PROJECT_PERSIST_INSTRUCTIONS} for the OpenAI-Project header, then copy your API key from account settings`;

function requireCoreWeaveProjectHeaders(): Record<string, string> {
	const headers = coreWeaveProjectHeaders($env);
	if (!headers) {
		throw new AIError.ConfigurationError(
			`CoreWeave Serverless Inference requires OpenAI-Project. Set COREWEAVE_PROJECT=<team>/<project> before running /login coreweave. To persist it, ${PROJECT_PERSIST_INSTRUCTIONS}.`,
		);
	}
	return headers;
}

export const loginCoreWeave = createApiKeyLogin({
	providerLabel: "CoreWeave Serverless Inference",
	authUrl: "https://wandb.ai/settings",
	instructions: PROJECT_SETUP_INSTRUCTIONS,
	promptMessage: "Paste your CoreWeave Serverless Inference API key",
	placeholder: "api-key",
	validation: {
		kind: "models-endpoint",
		provider: "CoreWeave Serverless Inference",
		modelsUrl: "https://api.inference.wandb.ai/v1/models",
		headers: requireCoreWeaveProjectHeaders,
	},

View on GitHub (pinned to 9690622007)

Solutions

  1. Create or select a project in CoreWeave Serverless Inference, then export COREWEAVE_PROJECT=<team>/<project> (e.g. export COREWEAVE_PROJECT=my-team/my-proj).
  2. Persist the variable by adding `export COREWEAVE_PROJECT=<team>/<project>` to ~/.zshrc, ~/.bashrc, or your shell profile/rc file.
  3. Re-run /login coreweave after setting the variable so the OpenAI-Project header is attached.
  4. Verify the value uses the team/project slash format — a bare project name is insufficient.

Example fix

// before (shell)
$ omp /login coreweave
// Error: CoreWeave Serverless Inference requires OpenAI-Project...
// after (shell)
$ export COREWEAVE_PROJECT=acme-team/prod-inference
$ omp /login coreweave
Defensive patterns

Strategy: validation

Validate before calling

// before invoking CoreWeave login/requests
const v = process.env.COREWEAVE_PROJECT;
if (!v || !/^[^/]+\/[^/]+$/.test(v)) {
  throw new Error('Set COREWEAVE_PROJECT=<team>/<project> (e.g. my-team/my-proj) before /login coreweave');
}

Try / catch

try {
  await coreWeaveLogin();
} catch (err) {
  if (err instanceof AIError.ConfigurationError && err.message.includes("OpenAI-Project")) {
    console.error("Set COREWEAVE_PROJECT=<team>/<project> and retry");
  } else throw err;
}

Prevention

When it happens

Trigger: Calling any CoreWeave login/credential path (requireCoreWeaveProjectHeaders) when COREWEAVE_PROJECT is not set to a non-empty <team>/<project> value in the environment.

Common situations: New CoreWeave users who created an API key but never selected a Serverless Inference project; CI environments where the variable was set in an interactive shell but not in the CI env; users copying only COREWEAVE_API_KEY from docs; team/project renamed so the old value no longer matches the expected format.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/cad47c04fcc9eab4. Report an issue: GitHub.