API地址/ai/模型/v1/chat/completions
https://kfmapi.natappvip.cc/ai/baidu/v1/chat/completions
https://kfmapi.natappvip.cc/ai/hunyuan/v1/chat/completions
https://kfmapi.natappvip.cc/ai/tongyi/v1/chat/completions
API地址/vip
https://kfmapi.natappvip.cc/vip/
AP I地址/svip
https://kfmapi.natappvip.cc/svip
API地址/v1
模型 | 厂商 | 价格 | 地址 |
---|---|---|---|
gpt4-o,gpt-3.5-turbo | |||
gpt-4o | |||
claude-3-5-sonnet-20241022 | |||
gemini-1.5-flash | |||
glm-4-plus | |||
Model | Parameter Count | Context Length | Model Type |
---|---|---|---|
llama-3.1-sonar-small-128k-online |
8B | 127,072 | Chat Completion |
llama-3.1-sonar-large-128k-online |
70B | 127,072 | Chat Completion |
llama-3.1-sonar-huge-128k-online |
405B | 127,072 | Chat Completion |
curl -X POST 'https://kfmapi.natappvip.cc/v1/chat/completions' \
-H 'Authorization: Bearer you-key' \
-H 'Content-Type: application/json' \
-d '{
"model":"gpt-4o",
"messages": [
{
"role": "user",
"content": "来一个只有程序员能听懂的笑话"
}
],
"stream": true
}'
注意要加Bearer,地址需要完整地址
from openai import OpenAI
client = OpenAI(
base_url="https://kfmapi.natappvip.cc/v1",
api_key="you-key"
)
stream = client.chat.completions.create(
messages=[
{
"role": "user",
"content": "你是哪个模型",
}
],
model="gpt-4o",
stream=True,
)
for chunk in stream:
print(f"{chunk}\n")
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
public class OpenAIStreamingExample {
public static void main(String[] args) {
String apiKey = "ak_147258wxHaoHaoyzab";
String baseUrl = "https://kfmapi.natappvip.cc/v1";
String endpoint = baseUrl + "/chat/completions";
String requestBody = """
{
"messages": [
{
"role": "user",
"content": "你是哪个模型"
}
],
"model": "gpt-4o",
"stream": true
}
""";
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(endpoint))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer " + apiKey)
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
try {
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 200) {
System.out.println("Response: " + response.body());
} else {
System.out.println("Error: " + response.statusCode() + " " + response.body());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
powered by kaifamiao