Fyoulink API Documentation
An integration guide for developers. Sign up, create a key, and top up your balance in minutes, then connect to the Claude model family from Claude Code, the official Anthropic SDK, the OpenAI SDK, or cURL.
01Overview & Advantages
Fyoulink API is an independently operated third-party AI model API relay / acceleration service that gives developers stable, convenient access to the Claude model family.
- Dual-format compatibility: Supports both the native Anthropic format (
/v1/messages) and the OpenAI-compatible format (/v1/chat/completions), so you can migrate with almost no changes to existing code. - Works out of the box: Compatible with Claude Code, the official Anthropic SDK, the OpenAI SDK, and cURL — just swap the base URL and key.
- Transparent pricing: Top up at 1 RMB = 1 USD of credit, with a 1:1 model rate matching official pricing, billed by actual token usage.
- Extended context: Supports up to 1M (1,000,000) tokens of extended context (requires the corresponding beta header).
- Chinese-friendly: Built for Chinese-speaking developers — docs, examples, and support are all in Simplified Chinese.
02Quickstart (5-Minute Setup)
The whole process takes just four steps: create an account → verify your email → create an API key → top up → start calling the API.
Open the official site and click "Log In / Sign Up" in the top right, enter your email and password, then click "Send verification code."
Check for the verification email from Fyoulink (also check your spam folder), copy the code back into the form to complete activation, then log in to the dashboard.
Go to "API Keys / Key Management," click "Create key" to generate a key starting with sk-. Copy and save it immediately — for security reasons the full key is usually shown only once.
Go to "Top-up / Balance" and add credit at a rate of 1 RMB = 1 USD. Once payment succeeds, credit is added instantly and you're ready to call the API.
03Base URL & Authentication
API Base URL
| Purpose | Address |
|---|---|
| General base URL | https://www.fyoulink.com/v1 |
| Anthropic native format | https://www.fyoulink.com/v1/messages |
| OpenAI-compatible format | https://www.fyoulink.com/v1/chat/completions |
Authentication
Every request must include your API key (starting with sk-). Two delivery methods are supported — choose either one:
- Anthropic style: header
x-api-key: sk-your-key - Bearer style: header
Authorization: Bearer sk-your-key
04Configuring Claude Code
Connecting Claude Code only requires setting two environment variables: ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN.
Method A: Environment Variables (Quick Test)
export ANTHROPIC_BASE_URL="https://www.fyoulink.com" export ANTHROPIC_AUTH_TOKEN="sk-your-key" claude
$env:ANTHROPIC_BASE_URL = "https://www.fyoulink.com" $env:ANTHROPIC_AUTH_TOKEN = "sk-your-key" claude
Method B: settings.json (Persistent, Recommended)
Create or edit settings.json inside the .claude directory in your home directory (Windows path %userprofile%\.claude; macOS / Linux path ~/.claude; if the directory doesn't exist, run claude once first to generate it automatically):
{
"env": {
"ANTHROPIC_BASE_URL": "https://www.fyoulink.com",
"ANTHROPIC_AUTH_TOKEN": "sk-your-key"
}
}claude. If a chat message returns normally, the relay is working. You can also use the cURL command below to quickly test connectivity and authentication.05Usage Examples (Copy & Run)
The examples below run as-is once you swap in your key. They default to the claude-sonnet-5 model — see Section 6 to switch to a different one.
Official Anthropic SDK (Python)
from anthropic import Anthropic client = Anthropic( base_url="https://www.fyoulink.com", api_key="sk-your-key", ) resp = client.messages.create( model="claude-sonnet-5", max_tokens=1024, messages=[{"role": "user", "content": "Introduce Fyoulink API in one sentence."}], ) print(resp.content[0].text)
OpenAI-Compatible SDK (Python)
from openai import OpenAI client = OpenAI( base_url="https://www.fyoulink.com/v1", api_key="sk-your-key", ) resp = client.chat.completions.create( model="claude-sonnet-5", messages=[{"role": "user", "content": "Introduce Fyoulink API in one sentence."}], ) print(resp.choices[0].message.content)
cURL — Anthropic Native Format
curl https://www.fyoulink.com/v1/messages \ -H "x-api-key: sk-your-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{"model":"claude-sonnet-5","max_tokens":1024, "messages":[{"role":"user","content":"Hello, Fyoulink!"}]}'
cURL — OpenAI-Compatible Format
curl https://www.fyoulink.com/v1/chat/completions \ -H "Authorization: Bearer sk-your-key" \ -H "content-type: application/json" \ -d '{"model":"claude-sonnet-5", "messages":[{"role":"user","content":"Hello, Fyoulink!"}]}'
06Supported Models
Fyoulink supports the full Claude model family. The table below lists commonly used models — the live list shown in the dashboard is authoritative (updated as new models ship). Prices are in USD per million tokens.
| Model ID | Best For | Input / 1M | Output / 1M |
|---|---|---|---|
claude-opus-4-8 | Flagship · strongest reasoning | $5.00 | $25.00 |
claude-fable-5 | Top-tier reasoning · long-horizon agents | $10.00 | $50.00 |
claude-sonnet-5 | High-performance general use · cost-effective | $3.00 | $15.00 |
07Billing & Top-up
- Exchange rate: Top up at 1 RMB = 1 USD of credit.
- Model rate: 1:1, matching official model pricing with no markup.
- Billing method: Billed by actual token usage — cost = input tokens + output tokens, charged at the price of the model used.
- Balance rules: Credit is deducted in real time on each call; calls are paused once the balance runs out and resume automatically after you top up.
max_tokens outputs significantly increase token consumption — set them according to your needs. You can review detailed usage on the "Usage / Billing" page in the dashboard.08Extended Context (1M)
Fyoulink supports up to 1M (1,000,000) tokens of extended context, ideal for very large codebases, long-document analysis, and similar scenarios. Your request must include the corresponding beta header (refer to the latest identifier announced on the official site).
curl https://www.fyoulink.com/v1/messages \ -H "x-api-key: sk-your-key" \ -H "anthropic-version: 2023-06-01" \ -H "anthropic-beta: context-1m-2025-08-07" \ -H "content-type: application/json" \ -d '{"model":"claude-sonnet-5","max_tokens":2048, ...}'
09Concurrency & Rate Limits
- Default concurrency: Each account defaults to 5 concurrent requests.
- How to adjust: Upgrade based on your plan, or contact support at
email@fyoulink.comto request a change. - If you exceed the concurrency limit or trigger rate limiting, the API may return
429 Too Many Requests. We recommend implementing exponential backoff retries on the client side (start with a 1s wait, doubling each time).
stream: true) to keep receiving incremental output and avoid connection drops caused by prolonged silence.10Frequently Asked Questions
What if a call returns 401 / 403?
This is usually an authentication issue: check that your key starts with sk- and is complete with no stray spaces; that the header is correct (x-api-key or Authorization: Bearer); that the key hasn't been disabled; and that the base URL is correct.
Getting a 429?
You've hit the concurrency or rate limit. Reduce concurrency, add backoff retries, or contact support to raise your concurrency cap.
Seeing a "model not found / unsupported" error?
Check that the model ID exactly matches the dashboard list (watch for case and date suffixes), and avoid calling deprecated models.
Seeing an insufficient balance / calls paused message?
Go to the dashboard and top up — service resumes automatically once credit lands. We recommend enabling usage monitoring to avoid interruptions.
Requests timing out or failing to connect?
Confirm you can reach https://www.fyoulink.com normally; check for local proxy / firewall issues; make sure the base URL has no extra path segments or typos; if it's intermittent, retry later.
Claude Code configuration not taking effect?
Make sure settings.json is valid JSON (no trailing commas), that both variables are filled in correctly, and reopen your terminal before running claude again.
Can I use both the OpenAI SDK and the Anthropic SDK?
Yes. The OpenAI client uses /v1/chat/completions and the Anthropic client uses /v1/messages — both share the same key.
11Contact & Support
- Technical support email: email@fyoulink.com (placeholder address — replace with the actual one)
- Official site: https://www.fyoulink.com
- When reporting an issue, please include: the model used, a sample request (be sure to redact the full key), the error code, and the timestamp, so we can resolve it quickly.
- Fyoulink is an independently operated third-party relay / acceleration service and has no affiliation, authorization, agency, or partnership relationship with Anthropic, OpenAI, or other model vendors.
- "Claude," "Anthropic," and related names and trademarks belong to their respective owners and are used here for technical reference only.
- Users are solely responsible for complying with Anthropic's official usage policies and all applicable laws and regulations, and for any content they submit or generate through this service.
- This service is provided "as-is" and on a "best-effort" basis; it does not constitute a formal SLA and comes with no express or implied warranties. Because the service depends on upstream providers, fluctuations, maintenance, or interruptions may occur.
- The models, pricing, concurrency, and context limits listed here are subject to change at any time — the live information on the official site and dashboard is authoritative.