← CJ Inference

Configuration guide

Use CJ Inference with OpenRouter

OpenRouter provides the model access and provider routing. CJ Inference supplies the configuration boundary: keep credentials private, validate request settings, and make model selection explicit.

1. Configure credentials

Set your OpenRouter key in the server-side environment for the application that uses CJ Inference. Do not expose the key in browser code or commit it to source control.

2. Validate configuration

Use Zod to describe the model ID and generation options your application accepts. Validate before constructing the OpenRouter request so invalid selections fail early and predictably.

const config = z.object({
	model: z.string().min(1),
	temperature: z.number().min(0).max(2)
});

3. Select the model

Pass the selected model ID to your OpenRouter client. The default example for this project is:

qwen/qwen-2.5-7b-instruct
OpenRouter remains responsible for upstream model requests and provider routing. This project does not require a separate inference gateway.