Configuring the Together.ai client for DeepSeek R1 integration involves several key steps. Here's a detailed guide to help you set up and integrate DeepSeek R1 with Together.ai:
Step 1: Obtain a Together.ai API Key
To start integrating DeepSeek R1 with Together.ai, you first need to obtain an API key from Together.ai. This key is essential for authenticating your requests to the Together.ai API.Step 2: Set Up the API Request in Appsmith
1. Open Appsmith Editor: Navigate to the Appsmith editor and go to the Queries tab.2. Create a New Query: Click on the "+" button and select "New Curl Import."
3. Paste the API Request: Copy and paste the following `curl` command into the import field:
bash
curl -X POST "https://api.together.xyz/v1/chat/completions" \
-H "Authorization: Bearer $TOGETHER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-ai/DeepSeek-R1",
"messages": [
{"role": "user", "content": "Your Prompt Here"}
],
"max_tokens": null,
"temperature": 0.7,
"top_p": 0.7,
"top_k": 50,
"repetition_penalty": 1,
"stop": [""],
"stream": false
}'
4. Replace the API Key Placeholder: Replace `$TOGETHER_API_KEY` with your actual API key from Together.ai.
Step 3: Configure the API in Appsmith
1. Import the API: Click the "Import" button to create the API query in Appsmith.2. Rename the API: Rename the API to something meaningful, like "sendMessage."
3. Adjust Timeout: Click on the gear icon next to the run button and increase the timeout to 60,000 milliseconds (60 seconds) to ensure the API has enough time to respond.
Step 4: Save API Credentials Securely
1. Save the API Key: After running the API, save the API key securely by moving it to the Authentication section of your Appsmith datasource. This ensures that your API key is encrypted and not exposed in plain text.2. Re-run the API: Re-run the API to confirm that the datasource is configured correctly.
Step 5: Build a Simple UI for the Chat App
1. Drag Widgets: Drag a Text widget, an Input widget, and a Button widget onto your Appsmith canvas.2. Configure Widgets:
- Text Widget: Use the expression `
- Input Widget: This will be where users input their prompts.
- Button Widget: Configure the button to trigger the "sendMessage" API when clicked.
3. Test the App: Enter a prompt in the Input widget and click the Send button to interact with DeepSeek R1 via the Together.ai API.
By following these steps, you can successfully integrate DeepSeek R1 with Together.ai and build a simple chat application using Appsmith[1][5].
Citations:
[1] https://community.appsmith.com/content/guide/building-chat-app-deepseek-r1-and-togetherai-under-5-minutes
[2] https://618media.com/en/blog/integrating-deepseek-r1-into-existing-systems-a-guide/
[3] https://ikiran.vercel.app/insights/running-deepseek-r1-locally-setup-guide
[4] https://www.datacamp.com/tutorial/deepseek-api
[5] https://www.together.ai/models/deepseek-r1
[6] https://www.datacamp.com/tutorial/deepseek-r1-ollama
[7] https://www.reddit.com/r/selfhosted/comments/1iekz8o/beginner_guide_run_deepseekr1_671b_on_your_own/
[8] https://www.reddit.com/r/ollama/comments/1i6gmgq/got_deepseek_r1_running_locally_full_setup_guide/
[9] https://www.together.ai/blog/deploy-deepseek-r1-at-scale-fast-secure-serverless-apis-and-large-scale-together-reasoning-clusters
[10] https://www.youtube.com/watch?v=TWlBGA3x3cQ
[11] https://www.together.ai/blog/deploy-deepseek-r1-and-distilled-models-securely-on-together-ai