VS Code - Directly call 58API
Use the .http file of REST Client to call 58API, enter the key when running the request, and do not write the .http file.
This tutorial uses third-party extensions
VS Code itself will not execute directly .http ask. This tutorial uses the REST Client extension published by Huachao Mao (ID:humao.rest-client), send an OpenAI Chat Completions request in the editor and view the response.
- VS Code official extension installation instructions:Extension Marketplace
- REST Client extension:Visual Studio Marketplace
- REST Client source code and syntax description:https://github.com/Huachao/vscode-restclient
Preparation before use
- Log in 58API, create an API Key, and confirm that the account has available balance.
- Install the latest version Visual Studio Code。
- Prepare a currently available model ID. The following is
gpt-6.1-solFor example.
Install REST Client
- In VS Code press
Ctrl+Shift+X(macOS isCommand+Shift+X) to open the extension panel. - search
@id:humao.rest-client。 - Confirm that the extension name is REST Client, the publisher is Huachao Mao, and then click Install / Install.
- Create a new file and save it as
58API.http。
Write the first request
Paste the entire content below into 58API.http:
@baseUrl = https://api.58api.net/v1
@model = gpt-6.1-sol
### 58API Chat Completions
# @prompt password 粘贴 58API API Key(输入时自动隐藏)
POST {{baseUrl}}/chat/completions
Authorization: Bearer {{password}}
Content-Type: application/json
{
"model": "{{model}}",
"messages": [
{
"role": "user",
"content": "请用一句话介绍你自己。"
}
],
"stream": false
}This example does not include the real API Key 58API.http。# @prompt password An input box will pop up each time a request is run; the variable name is password The REST Client will hide the input content. Note: REST Client will replace requests that receive responses (including those that have been replaced with real keys). Authorization Request header) is saved to the local request history ~/.rest-client/history.json(Windows is %USERPROFILE%\.rest-client\history.json, keep the most recent 50 items). After testing on a shared or public computer, press F1 Execute Rest Client: Clear Request History.
Template file does not contain key
save to 58API.http yes {{password}} Placeholder, not the real key; but the actual key sent is retained in the native request history. You should still check before sharing files Authorization It has not been changed to plain text Key.
Send request
- Place cursor on
POSTRequest area. - Click Send Request above the request, or press
Ctrl+Alt+R(macOS isCommand+Option+R)。 - Paste the 58API API Key in the pop-up input box and press Enter.
- The REST Client opens a response preview on the right.

The screenshot is an old version of the example, please refer to the text for variable names (
# @prompt password、Bearer {{password}})。
In the figure, ① is the 58API Base URL, ② is the Prompt Variable for inputting the key during runtime, and ③ is the Send Request provided by the REST Client. The right side is an example of a non-sensitive response structure; the actual returned content depends on the selected model.
When the request is successful, the status code should be 200. The answer is usually located at:
choices[0].message.contentAt the same time, you can open the usage log of the 58API console to confirm that the model generated corresponding requests.
Change model and prompt word
Modify the model variables at the top of the file:
@model = 账户中另一个可用模型IDModifying JSON messages of content The problem can be replaced. Each click on Send Request results in a 58API call and may incur charges.
Add system message
"messages": [
{
"role": "system",
"content": "你是一名简洁的编程助手。"
},
{
"role": "user",
"content": "解释 JavaScript 中 Promise.all 的作用。"
}
]View full original response
REST Client response panel displays HTTP status, response headers and JSON body, suitable for verification id、model、choices and usage fields. When debugging the interface, it is recommended to keep "stream": false, so the response is full JSON.
FAQ
Can't see Send Request
Confirm that the file suffix is .http or .rest, and confirm that the installed humao.rest-client. If the language mode in the lower right corner is not HTTP, you can click the language mode and select HTTP, and then execute Developer: Reload Window.
Each request requires re-entering the API Key
This is # @prompt expected behavior to avoid writing keys into 58API.http. If you need to repeat the test, you can keep the input content copied in the password manager, but do not rewrite the plaintext Key into the request file ready to be submitted or shared.
Return 401
Copy the 58API API Key again and make sure there are no leading or trailing spaces when pasting.Authorization must be maintained Bearer {{password}} Format.
Return 404
examine @baseUrl Is it https://api.58api.net/v1, whether the request path is /chat/completions. don't put /v1 Write it in the variable and request path at the same time.
Return model does not exist
Will @model = gpt-6.1-sol Replace with the full model ID actually available for the account. The model list and permissions may change depending on the account configuration.
Return 429
Check account balances, token limits, and concurrency limits. Clicking Send Request continuously will send multiple independent requests. Wait for the current limiting window to be restored and try again.
The response window always outputs the content starting with data:
This is the streaming SSE response. in the request body "stream" Change to false, you can see the full JSON after resending.
Can call API, but cannot automatically modify code
REST Client is an HTTP debugging tool, not a programming agent. When you need to read a project, generate a patch, or invoke a terminal, use Cline, Continue, Codex, or other programming assistants.
official basis
- VS Code: Install and manage extensions
- REST Client: sending requests and shortcut keys
- REST Client:File Variables
- REST Client:Prompt Variables
- 58API: OpenAI Chat Completions call instructions
Related tutorials
CC Switch - All-in-One AI CLI Management Tool
CC Switch tutorial — a cross-platform tool for unified management of provider configs, MCP servers, and system prompts for Claude Code, Codex, Gemini CLI, OpenCode and other AI coding tools. One-click import from 58API.
TRAE - AI Programming Assistant
Added 58API custom models in TRAE for AI conversations, code analysis, code generation and agent programming tasks