As large language models become part of everyday development workflows, many developers and teams need a flexible way to access different AI models through a unified API relay platform. 4SAPI is one such LLM API relay platform that allows users to connect to multiple model providers through API keys, model groups, and configurable endpoints.
This guide walks through the complete 4SAPI integration process, from account registration and balance top-up to API key creation, model selection, endpoint configuration, code integration, and common troubleshooting tips.
Whether you are building a chatbot, connecting an AI coding assistant, or integrating large language models into an internal application, this article can serve as a practical step-by-step reference.
1. Overall Integration Flow
The full setup process can be summarized in one simple workflow:
At the technical level, API access mainly consists of two key elements:
A typical configuration looks like this:
However, one important detail must be emphasized:
The final API endpoint may vary depending on the model you want to call. Before integration, always check the technical documentation or the model details page to confirm whether the URL should include
/v1or/v1/chat/completions.
4SAPI technical documentation:
2. Step One: Register and Top Up Your Account
2.1 Register an Account
First, visit the official 4SAPI website and create an account using your email address. In most cases, a domestic email address is sufficient, and no overseas phone number is required.
After registration, log in to the user console.
2.2 Add Account Balance
Go to the Console page and open Wallet Management from the left sidebar. From there, you can top up your balance based on your expected usage.
Make sure your account balance is greater than 0, otherwise API requests cannot be processed.
4SAPI supports payment methods such as Alipay and corporate bank transfer. It uses a pay-as-you-go pricing model and does not require a minimum spending threshold.
3. Step Two: Create an API Key
Creating an API key is the most important step in the entire integration process. The API key is your credential for calling all available models on the platform.
3.1 Add a New Token
In the left sidebar, open Key Management, then click Add Token.
3.2 Fill in Token Information
When creating a token, you need to configure several fields:
| Field | Description | Recommendation |
|---|---|---|
| Token Name | A custom name for this API key | Use the project name or usage scenario, such as my-chatbot or cursor-dev |
| Group | Different groups represent different resource channels | Check model pricing in the model marketplace or consult customer support |
| Token Quota | The maximum available budget for this key | Set it based on your project budget |
| Expiration Date | The validity period of the API key | For long-term projects, monthly or yearly expiration is recommended |
After filling in the information, click Submit to generate the API key.
3.3 Save the API Key Immediately
The API key is usually displayed only once after creation.
Make sure to copy and store it immediately. If you lose the key, it cannot be recovered. You will need to create a new one.
3.4 Check API Key Details
After the key is created, you can view its details in the Key Management page, including:
4. Step Three: Select a Group and Model
4.1 What Is a Group?
In 4SAPI, different groups correspond to different resource channels. These groups may vary in terms of model coverage, stability, and response quality.
The main differences include:
For most users, the recommended approach is to select the group with the best cost-performance ratio based on actual usage needs. If you are not sure which group to choose, you can contact customer support for assistance.
4.2 Check the Model Marketplace
Open the Model Marketplace page in the console. This page shows available models under different groups, along with their corresponding usage costs.
Before calling a model, check the following information carefully:
4.3 View Model Details
Click the model name to open its detail page. The detail page usually includes:
This information is important because different models may use different endpoint paths.
4.4 Copy the Exact Model Name
The model name must be exactly the same as the one registered on the platform.
For example:
Incorrect examples:
Even a missing hyphen, wrong capitalization, or missing date suffix may cause the request to fail.
The safest method is to copy the model name directly from the Model Marketplace instead of typing it manually.
5. Step Four: Get the API Relay Address
On the right side of the console page, you can find different site or node information provided by 4SAPI.
The platform may provide multiple access nodes. You can select the node with the lowest latency based on your network environment.
In most cases, the commonly used base URL is:
But the final endpoint still depends on the model and the software or SDK you are using.
6. Step Five: Confirm the API Endpoint and Model Name
This is one of the most common sources of integration errors.
The API URL is not always fixed. Different models or third-party tools may require different URL formats.
6.1 Common URL Formats
| URL Format | Typical Use Case |
|---|---|
https://4sapi.com | Basic endpoint for some models or tools |
https://4sapi.com/v1 | Common OpenAI-compatible API base URL |
https://4sapi.com/v1/chat/completions | Full endpoint required by some third-party tools |
To confirm the correct endpoint, open the target model in the Model Marketplace and check its supported API endpoint. You can also refer to the technical documentation:
6.2 Required Configuration Information
Before calling any model, make sure you have confirmed these three items:
If any of these three values is incorrect, the request may fail.
7. Step Six: Integrate with Code
7.1 Prepare the Environment
For Python projects, make sure your Python version is 3.8 or later.
Install the OpenAI SDK:
If you need to use the Anthropic native format, install the Anthropic SDK:
8. Method One: OpenAI-Compatible Format
For most users, the OpenAI-compatible format is the easiest integration method.
You only need to set the base_url to the 4SAPI endpoint and use your 4SAPI API key for authentication.
In this example:
9. Method Two: Anthropic Native Format
If you want to call Claude models using the Anthropic native message format, you can use the Anthropic SDK.
Claude models may also support the native /v1/messages endpoint. For exact configuration details, refer to the Claude native API documentation provided by the platform.
10. Replace the API Address in Existing Projects
If your existing project already uses the official OpenAI API, migration is usually simple.
In many cases, you only need to replace the original OpenAI API address:
with:
The rest of the code may remain unchanged if the project uses an OpenAI-compatible request format.
However, you should still verify the exact endpoint required by the model. Some projects require an API base URL, while others require a complete endpoint such as:
11. Configure Third-Party Software or Platforms
When configuring 4SAPI in third-party AI tools, coding assistants, or development platforms, the required URL format may vary.
Common formats include:
Some tools ask for an API Base URL, while others ask for the full Chat Completions endpoint.
If the connection fails, check the tool’s custom API configuration guide and compare it with the endpoint shown in the 4SAPI Model Marketplace.
12. Step Seven: Verify the Integration
After completing the configuration, run a simple test request.
If the terminal returns a normal model response, the integration is successful.
12.1 Connectivity Test
12.2 Long Text Test
This test helps verify whether your timeout and token settings are reasonable.
12.3 Concurrency Test
For production scenarios, you should also test concurrent requests.
For example, send five requests at the same time. If all requests return successfully, the basic concurrency test is passed.
13. Common Integration Issues and Solutions
| Issue | Possible Cause | Solution |
|---|---|---|
| Request fails | Missing /v1 in the URL | Check the correct endpoint in the Model Marketplace |
| 404 error | Wrong endpoint path | Some models do not require /chat/completions |
| 401 authentication error | Wrong credential used | Use the API key from Key Management, not the login password |
| Model not found | Incorrect model name | Copy the model name directly from the Model Marketplace |
| Insufficient balance | Account balance is 0 | Top up your account in Wallet Management |
| Third-party tool cannot connect | URL format mismatch | Try /v1, /v1/chat/completions, or the base URL according to the tool’s requirements |
14. Practical Integration Checklist
Before using 4SAPI in a real project, go through the following checklist:
This checklist can help avoid most common configuration errors.
15. Final Thoughts
4SAPI provides a practical relay solution for developers who need to access multiple large language models through API calls. The core integration process is not complicated, but several details require careful attention, especially the API endpoint, model name, group selection, account balance, and API key management.
For first-time users, the safest workflow is:
Once these steps are completed, developers can connect 4SAPI to Python scripts, backend services, AI coding tools, chatbot systems, or other applications that support custom LLM API configuration.
This article uses 4SAPI as the example platform in the LLM API relay series. Developers can evaluate the platform based on their own model requirements, budget, stability needs, and integration environment.




