Fix an AI SDK 404 on /responses.

Check the actual request path, then select the SDK method that matches the API format the endpoint supports.

A custom base URL does not select the API format. In the AI SDK OpenAI provider, the default model factory uses the Responses API even when you set a custom baseURL. If the server only implements Chat Completions, the SDK can send POST /v1/responses and receive a 404.

Check the request path

Capture the outgoing method and URL before changing credentials. Compare the final path with the provider's current endpoint documentation:

Observed requestWhat to check
POST …/v1/responsesThe SDK is using Responses. Confirm that this API host and account support that endpoint.
POST …/v1/chat/completionsThe request is using Chat Completions. Check the exact base path, model ID and account access in the provider's docs.
The path contains a duplicated endpointSet baseURL to the documented API prefix, usually ending in /v1; the selected model method adds its own endpoint path.

A 404 can also mean the host, deployment path or API version is wrong. Use the actual captured URL and the provider's documented path to distinguish those cases.

Select Chat Completions when the endpoint supports it

For a Chat Completions-only endpoint, use the provider's .chat() factory. Keep the documented base URL as a prefix and use the exact model ID available to your key.

AI SDK Chat Completions setup
import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";

const provider = createOpenAI({
  baseURL: process.env.MODEL_API_BASE_URL,
  apiKey: process.env.MODEL_API_KEY,
});

// Use this when the endpoint documents Chat Completions.
const model = provider.chat(process.env.MODEL_ID ?? "MODEL_ID_FROM_PROVIDER");
const result = await generateText({ model, prompt: "Reply in one sentence." });
console.log(result.text);

Keep credentials in a local environment file or server-side secret store. Do not paste an API key into a browser page, public source file or support report.

Use Responses only when the endpoint supports it

Responses and Chat Completions are separate API surfaces. OpenAI's migration guide shows different endpoint paths and request/response shapes: Responses uses input and a typed output array, while Chat Completions uses messages and choices. If the host documents Responses, keep the Responses model method and confirm its supported features; otherwise select Chat Completions or the SDK's OpenAI-compatible provider.

ChinaGenAI endpoint

ChinaGenAI's site API exposes POST /v1/chat/completions. It does not expose POST /v1/responses. Use a Chat Completions client method with the site base URL, site key and free model label. Review the route and feature limits before connecting an app.

Check the source for your SDK version

Documentation checked 22 October 2026. This guide verifies the request method and path from documentation; no provider account, API key or model request was used.

Free API access and limits

Check the site free API access and limits before trying to obtain a site key. Read the current status and request limits before using a site key. It is not a source of official provider keys.

ChinaGenAI is not affiliated with the providers named here. This release contains setup guidance and explicitly labeled fictional examples, not claimed live model benchmarks.

Exact symptom wording and source

Use the quoted text to locate the relevant check. Providers and clients can phrase the same failure differently; compare the complete response before applying a fix.

  • Reported text: 404 at /v1/responses with an OpenAI-compatible custom base URL

    When a custom base URL only supports Chat Completions, the SDK docs recommend .chat() or the OpenAI-compatible provider.

    If your custom base URL only supports the Chat Completions API, create chat models with openai.chat('model-id') instead, or use the OpenAI-compatible provider.

    AI SDK OpenAI provider