94 lines
1.9 KiB
Markdown
94 lines
1.9 KiB
Markdown
curl -X POST https://app.resetdata.ai/api/v1/chat/completions \
|
|
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"model": "zai-org/glm-4.7-fp8",
|
|
"messages": [
|
|
{"role": "user", "content": "Hello!"}
|
|
],
|
|
"temperature": 0.7,
|
|
"top_p": 0.9,
|
|
"max_tokens": 2048,
|
|
"frequency_penalty": 0,
|
|
"presence_penalty": 0
|
|
}'
|
|
|
|
|
|
from openai import OpenAI
|
|
|
|
client = OpenAI(
|
|
api_key="YOUR_API_KEY",
|
|
base_url="https://app.resetdata.ai/api/v1"
|
|
)
|
|
|
|
response = client.chat.completions.create(
|
|
model="zai-org/glm-4.7-fp8",
|
|
messages=[
|
|
{"role": "user", "content": "Hello!"}
|
|
],
|
|
temperature=0.7,
|
|
top_p=0.9,
|
|
max_tokens=2048,
|
|
frequency_penalty=0,
|
|
presence_penalty=0
|
|
)
|
|
|
|
print(response.choices[0].message.content)
|
|
|
|
|
|
const response = await fetch('https://app.resetdata.ai/api/v1/chat/completions', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Authorization': 'Bearer YOUR_API_KEY',
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({
|
|
model: 'zai-org/glm-4.7-fp8',
|
|
messages: [
|
|
{ role: 'user', content: 'Hello!' }
|
|
],
|
|
temperature: 0.7,
|
|
top_p: 0.9,
|
|
max_tokens: 2048,
|
|
frequency_penalty: 0,
|
|
presence_penalty: 0
|
|
})
|
|
});
|
|
|
|
const data = await response.json();
|
|
console.log(data.choices[0].message.content);
|
|
|
|
|
|
import { streamText } from 'ai';
|
|
import { createOpenAI } from '@ai-sdk/openai';
|
|
|
|
const openai = createOpenAI({
|
|
apiKey: 'YOUR_API_KEY',
|
|
baseURL: 'https://app.resetdata.ai/api/v1',
|
|
});
|
|
|
|
const { textStream } = await streamText({
|
|
model: openai('zai-org/glm-4.7-fp8'),
|
|
messages: [
|
|
{ role: 'user', content: 'Hello!' }
|
|
],
|
|
temperature: 0.7,
|
|
topP: 0.9,
|
|
maxTokens: 2048,
|
|
frequencyPenalty: 0,
|
|
presencePenalty: 0
|
|
});
|
|
|
|
for await (const chunk of textStream) {
|
|
process.stdout.write(chunk);
|
|
}
|
|
|
|
|
|
API Configuration
|
|
|
|
Base URL: https://app.resetdata.ai/api/v1
|
|
|
|
Authentication: Bearer token in Authorization header
|
|
|
|
Model: zai-org/glm-4.7-fp8
|