Quick Start

Claude API domestic access tutorial: OpenAI Compatible configuration and verification

Use AIFast to access Claude from networks in China, query live model IDs, run a minimal OpenAI-compatible call, verify streaming, and troubleshoot 401, 404, and 429 errors.

Updated on 2026-07-16Checked 2026-07-16Estimated reading time: 9 minutesApplicable to calling Claude series models through the OpenAI Compatible API
Configuration fields were checked against public documentation. Models, prices, and capabilities can change; verify current values in the console and live API responses.

Let me conclude first: When calling the Claude series model in AIFast, first use https://www.aifast.club/v1/models Query the real model ID available in the current account, and then use OpenAI Compatible's /v1/chat/completions Complete minimal requests. Do not guess the model ID based on the promotional name, and do not default to native Anthropic Messages parameters that can be reused directly.

When is it appropriate to access this way?

If the existing project already uses the OpenAI SDK, or the tool supports custom OpenAI Compatible addresses, this method usually only requires replacing three configurations:

Configuration items Fill in the content
Base URL https://www.aifast.club/v1
API Key Independent Key created in AIFast console
Model from /v1/models or the real Claude model ID copied by the console

What is verified here is the OpenAI Compatible call link. If the project relies on Anthropic Messages, Prompt Caching, or other vendor-specific fields, you should check firstCompatibility Matrix, and then use the temporary Key for function acceptance.

Step 1: Query the current Claude model

export AIFAST_API_KEY="yours_API_Key"

curl --fail-with-body --silent --show-error \
  https://www.aifast.club/v1/models \
  -H "Authorization: Bearer $AIFAST_API_KEY"

on return data Find the required Claude model in the array and copy it completely id. Model versions, availability and prices will change, so this article does not specify specific models.

Step 2: Send a minimal request

First set the ID copied from the model list:

export MODEL_ID="real copied from model list_ID"

Send a non-streaming request:

curl --fail-with-body --silent --show-error \
  https://www.aifast.club/v1/chat/completions \
  -H "Authorization: Bearer $AIFAST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "'"$MODEL_ID"'",
    "messages": [
      {"role": "user", "content": "Reply only CLAUDE_API_READY"}
    ],
    "temperature": 0
  }'

A successful response should contain at least a parsable choices. Also record the response modelusage and request ID; these fields facilitate subsequent verification of routing and billing, but a single model Fields cannot independently prove the identity of the underlying model.

Step 3: Use the Python SDK

python -m pip install --upgrade openai
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AIFAST_API_KEY"],
    base_url="https://www.aifast.club/v1",
)

response = client.chat.completions.create(
    model=os.environ["MODEL_ID"],
    messages=[
        {"role": "user", "content": "Organize this requirement into three acceptance conditions。"}
    ],
)

print(response.choices[0].message.content)

In production, store the API key, model ID, and Base URL in server-side environment variables or a secrets manager, never in frontend code or a public repository.

Must be verified before going online

  1. Use real business prompt words to verify constraint compliance, not just test "hello".
  2. Use stream=true Check for SSE delta and end events.
  3. If the business relies on tool calls, use random tool names and random parameters to verify the structured results.
  4. Record multi-period success rate, P50, P95, error distribution and complete task cost.
  5. Set limited retry, backoff and fallback models for 429s, timeouts and 5xx.

You can run it firstFree model checkingGenerate itemized reports. This test is a black box compatibility and risk screening and is not an official Anthropic certification.

How to troubleshoot common failures

401 or 403

Check whether the Key has extra quotes, spaces, whether it has been revoked, and whether the request header is used Authorization: Bearer. Do not mix OpenAI official Key, Anthropic official Key and third-party platform Key.

404 or return HTML

Check the final request address. A common mistake is to fill in https://www.aifast.club/v1 After that, the client appends again /v1, form /v1/v1/chat/completions

model not found

Request /v1/models, confirm that you are using id Instead of the webpage title, manufacturer name or model series name, and confirm that the model is open to the current account.

Claude Code cannot be reused directly

Claude Code may rely on the Anthropic protocol and specialized environment variables and is not equivalent to the normal OpenAI Compatible client. Please useClaude Code configuration tutorialandClaude Code Gateway Acceptance ChecklistCheck item by item.

Next step

After the basic call is successful, continue verificationStreaming SSEAPI Cost ControlandProduction on-line checklist. Model ID, price and open status are always based on the console and live API.

Source checked

Reference and Check Sources

Next step

Check the model and price first, then create an independent test Key

The model ID, open status and price will change; it will be added to production after passing small-scale verification.

Model PricingCreate Account View API documentation