Platform Reference

OpenAI-Compatible API Troubleshooting: SDK, Chat and Responses

Fix OpenAI-compatible SDK issues: compare Python and Node options, timeout units, Base URL and Chat versus Responses bodies. Includes an offline official-SDK example and protocol matrix.

Updated on 2026-11-06Checked 2026-09-02Estimated reading time: 11 minutesSuitable for client selection, Agent access and compatibility verification before going online
Configuration fields were checked against public documentation. Models, prices, and capabilities can change; verify current values in the console and live API responses.

One sentence conclusion

"OpenAI Compatible" usually means that some request formats can be reused, but it does not mean that Chat Completions, Responses API, tool calls, images, videos, and Anthropic Messages are all compatible.

If the OpenAI SDK can send a request but your workload still fails, first use the OpenAI Compatible Base URL Checker to check the final path. Then use the Model Quality Check to verify model declarations, SSE and tool calls. Finally, follow the API Error Troubleshooting Guide to investigate specific status codes.

curl works but the OpenAI SDK fails: what should you check?

Compare the same model, key, protocol and request body before blaming SDK compatibility. A successful curl Chat Completions request does not validate an SDK Responses request. HTTP 200 with HTML, missing required fields or an unfinished stream is not a passing result.

Observed symptom Evidence to check first Next action
404, HTML or a duplicated /v1/v1 Final host, complete path and Content-Type Check how the client appends paths; a Docs URL is not an API endpoint. Base URL checker
401 or an unavailable model Key from the same platform, model ID and group access Check access before assuming the SDK is broken. authentication / model access
400 / unsupported parameter The field named in the redacted error, SDK version and selected protocol Remove one optional field at a time; do not silently disable required tools or structured output. minimal SDK example
Text works but streaming or tools fail Last stream event, tool arguments and returned tool results Test complete streams and tool tasks separately; the first text chunk is not a complete result. SSE cutoff / Codex acceptance checks

Python uses base_url and JavaScript uses baseURL. Record installed versions and differences between minimal requests. Disable automatic retries while diagnosing; after a timeout, check usage logs before repeating a potentially billed task. Remove authorization headers, cookies and customer input before sharing records.

Inspect request differences offline with the official SDK

With https://www.aifast.link/v1 as the base, Chat methods append /chat/completions and Responses methods append /responses. Their bodies also differ; changing the Base URL does not convert protocols. Align curl and SDK paths, models and fields before adding application parameters.

Option or behavior Python OpenAI SDK Node.js OpenAI SDK
Base URL option base_url baseURL
Disable SDK retries max_retries=0 maxRetries: 0
30-second timeout timeout=30.0 timeout: 30000
Chat request chat.completions.create + messages chat.completions.create + messages
Responses request responses.create + input responses.create + input

Python timeouts use seconds; Node uses milliseconds. timeout: 30 does not mean 30 seconds in Node. After disabling SDK retries, check application-level retry loops too. The 30-second value is a diagnostic example, not a universal production timeout for long tasks or proof that a timed-out request was not billed.

The dedicated Link GitHub repository provides an offline request fixture using [email protected]. A local replacement handles SDK fetch calls, reads no real keys and sends no model requests. It prints only fixed example URLs, methods and bodies. Installing dependencies connects to npm; the installed fixture runs offline. It demonstrates request construction, not successful Link model, SSE or tool-call tests.

Download and run the official-SDK offline example

npm ci --prefix examples/sdk --ignore-scripts
node examples/sdk/capture-request.mjs chat
node examples/sdk/capture-request.mjs responses
npm test --prefix examples/sdk

Download the repository above and run from its root. chat prints /v1/chat/completions with messages; responses prints /v1/responses with input. YOUR_MODEL_ID is a placeholder, and fixtureOnly: true marks an offline demonstration, not a successful live call. A regression case also checks that placing the full /chat/completions endpoint in baseURL duplicates the endpoint.

This section was checked against official SDK documentation on November 6, 2026; the page's live-verification date is unchanged. To verify account access and model behavior, continue with the bounded single requests below and reconcile usage yourself.

API capability matrix

AIFast Link offers GPT, Claude and Gemini models. The table describes protocols that must be verified separately; it does not mean every model supports every capability.

Capabilities Common uses Verification key points You cannot judge based on what
Chat Completions Dialog, text generation messages、model, streaming return /v1/models success
Responses API Codex, tool tasks, unified response events Event structure, tool invocation, output analysis Chat request successful
Anthropic Messages Claude Code, Claude Client Anthropic path, request header, message structure OpenAI address available
Gemini generateContent Native Gemini clients Native path, authentication, contents and parts; requires request testing A gemini catalog label or a successful Chat request
SSE Streaming Output Display generated content in real time text/event-stream, proxy buffering, disconnection Non-streaming request successful
Tool Calls Agent, function call, workflow Parameter structure, tool result return, multi-round status Normal text answer is normal

The catalog checked on 12 October 2026 includes the image-generation model gpt-image-2. Image input and image generation use different endpoints; verify Gemini multimodal capabilities for the selected model as well. The current catalog lists no standalone video, embedding or reranking model. Check retrieval services separately.

Gemini protocol setup and verification boundaries

Distinguish catalog claims from test results

This is a verification checklist, not a list of tests passed by every Link model. Record the evidence status for your selected model and group.

Evidence status What to record What the evidence establishes
Catalog claim Model ID, page date and listed protocol or capability What the public catalog lists, not whether your current key can use it
Verified Date, client version, model and group, request path and sanitized results Only the tests performed under these conditions, not untested capabilities
Unverified Untested capabilities and steps still to run Keep the status unknown; do not claim support or infer lack of support

For SDK initialization and a minimal request, read the OpenAI-compatible API setup tutorial; use this page to record verification results for each capability your workload needs.

Why do Codex or Claude Code fail when Chat succeeds?

A successful Chat Completions request proves only that the model, group and Chat path worked for that request. Check Responses separately for Codex and Anthropic Messages for Claude Code. Keep the test conditions consistent, then add streaming and tool calls one at a time to isolate differences.

Record a minimal, verifiable result

The following is a template to complete, not a report of passed Link tests. Change one condition at a time. Keep results unverified until you have response evidence; stop automatic retries on failure and check for charges. Remove keys, cookies, user inputs and personal information before sharing.

Checked at / timezone:
Client / version:
Model ID / API Key group (no key):
Protocol / final request path:
HTTP status / Content-Type:
Non-streaming output: unverified
Stream terminal event: unverified
Tool call and result round-trip: unverified
Usage / billing record: unverified
Request ID / redacted error:

Recommended verification sequence

1. Verify authentication and list available models

curl --fail-with-body --silent --show-error \
  --connect-timeout 10 --max-time 30 \
  https://www.aifast.link/v1/models \
  -H "Authorization: Bearer ${AIFAST_LINK_API_KEY:?Set AIFAST_LINK_API_KEY locally before running}"

2. Verify minimal Chat request

curl --fail-with-body --silent --show-error \
  --connect-timeout 10 --max-time 30 \
  https://www.aifast.link/v1/chat/completions \
  -H "Authorization: Bearer ${AIFAST_LINK_API_KEY:?Set AIFAST_LINK_API_KEY locally before running}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR_MODEL_ID",
    "messages": [{"role": "user", "content": "Reply with OK only."}],
    "stream": false
  }'

Set the separate AIFAST_LINK_API_KEY locally and replace YOUR_MODEL_ID. These are examples to run yourself, not completed request records; generation may incur charges. Missing keys stop the command before sending. Each request has a 30-second limit and no automatic retries; a timeout does not prove that processing or billing stopped.

3. Individually verify the capabilities required by the target client

  • Codex: Focus on validating Responses API and tool events.
  • Claude Code: Focus on verifying the Anthropic Messages entry and authentication variables.
  • Dify: Validates the selected model type, credentials, and workflow nodes.
  • OpenWebUI, Chatbox, Cherry Studio: Verify Base URL auto-splicing and model ID.
  • Agent: Individually tests tool calls, long tasks, timeouts and failure recovery.

Online Judgment Criteria

Only when all the capabilities actually used by the target business pass, can the access be judged to be suitable for production. It is recommended to save:

  • Final request URL and status code.
  • response Content-Type.
  • Request ID or error text.
  • Actual model ID.
  • Client version and configuration method.
  • Streaming, tool invocation, and timeout test results.
Source checked

Reference and Check Sources

Next step

Test the current API before fixing, migrating, or creating a test key

Use a temporary, limited key to inspect model declarations, token fields, SSE, and tool calls. Review current models and pricing only when you need a replacement API.

Model Quality CheckModel PricingCreate Account