


YOUR_API_KEY in the sample code with your actual API KEY.# Replace YOUR_API_KEY with the API KEY created in the previous steps# Replace the model name in the <model> field with the one you want to try outcurl -X POST 'https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions' \\-H 'Authorization: Bearer YOUR_API_KEY' \\-H 'Content-Type: application/json' \\-d '{"model": "deepseek-v3.2","messages": [{"role": "user", "content": "hello"}],"stream": true}'
from openai import OpenAIclient = OpenAI(# Replace YOUR_API_KEY with the API KEY created in the previous stepsapi_key="YOUR_API_KEY",base_url="https://tokenhub-intl.tencentcloudmaas.com/v1")response = client.chat.completions.create(# Replace the model name in the <model> field with the one you want to try outmodel="deepseek-v3.2",messages=[{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": "Hello, please introduce yourself"}])print(response.choices[0].message.content)
import OpenAI from 'openai';const client = new OpenAI({// Replace YOUR_API_KEY with the API KEY created in the previous stepsapiKey: 'YOUR_API_KEY',baseURL: 'https://tokenhub-intl.tencentcloudmaas.com/v1',});async function main() {const response = await client.chat.completions.create({// Replace the model name in the model field with the one you want to try outmodel: 'deepseek-v3.2',messages: [{ role: 'system', content: 'You are a helpful assistant.' },{ role: 'user', content: 'Hello, please introduce yourself' },],});console.log(response.choices[0].message.content);}main();
import java.net.http.*;import java.net.URI;public class MaaSExample {public static void main(String[] args) throws Exception {// Replace YOUR_API_KEY with the API KEY created in the previous stepsString apiKey = "YOUR_API_KEY";// Replace the model name in the model field with the one you want to try outString body = """{"model": "deepseek-v3.2","messages": [{"role": "user", "content": "hello"}]}""";HttpRequest request = HttpRequest.newBuilder().uri(URI.create("https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions")).header("Authorization", "Bearer " + apiKey).header("Content-Type", "application/json").POST(HttpRequest.BodyPublishers.ofString(body)).build();HttpClient client = HttpClient.newHttpClient();HttpResponse<String> response = client.send(request,HttpResponse.BodyHandlers.ofString());System.out.println(response.body());}}
package mainimport ("bytes""encoding/json""fmt""io""net/http")func main() {// Replace YOUR_API_KEY with the API KEY created in the previous stepsapiKey := "YOUR_API_KEY"body := map[string]interface{}{// Replace the model name in the model field with the one you want to try out"model": "deepseek-v3.2","messages": []map[string]string{{"role": "user", "content": "hello"},},}jsonBody, _ := json.Marshal(body)req, _ := http.NewRequest("POST","https://tokenhub-intl.tencentcloudmaas.com/v1/chat/completions",bytes.NewBuffer(jsonBody))req.Header.Set("Authorization", "Bearer "+apiKey)req.Header.Set("Content-Type", "application/json")resp, err := http.DefaultClient.Do(req)if err != nil {panic(err)}defer resp.Body.Close()result, _ := io.ReadAll(resp.Body)fmt.Println(string(result))}
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback