Skip to content

Commit b537b0a

Browse files
authored
Merge pull request #130 from cnblogs/add-api-regions
docs: update intl api address
2 parents c8d9f8c + 0509229 commit b537b0a

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Console.WriteLine(completion)
2626
Install NuGet package `Cnblogs.DashScope.Sdk`
2727
```csharp
2828
var client = new DashScopeClient("your-api-key");
29+
// you could use different api base, example:
30+
// var client = new DashScopeClient("your-api-key", "https://dashscope-intl.aliyuncs.com/api/v1/");
2931
var completion = await client.GetTextCompletionAsync(
3032
new ModelRequest<TextGenerationInput, ITextGenerationParameters>()
3133
{
@@ -57,7 +59,8 @@ builder.AddDashScopeClient(builder.Configuration);
5759
```json
5860
{
5961
"DashScope": {
60-
"ApiKey": "your-api-key"
62+
"ApiKey": "your-api-key",
63+
"BaseAddress": "https://dashscope-intl.aliyuncs.com/api/v1"
6164
}
6265
}
6366
```
@@ -90,15 +93,15 @@ public class YourService(IDashScopeClient client)
9093
## Supported APIs
9194
- [Text Generation](#text-generation) - QWen3, DeepSeek, etc. Supports reasoning/tool calling/web search/translation scenarios
9295
- [Conversation](#conversation)
93-
- [Deep Thinking](#deep-thinking)
96+
- [Thinking Models](#thinking-models)
9497
- [Web Search](#web-search)
9598
- [Tool Calling](#tool-calling)
9699
- [Prefix Completion](#prefix-completion)
97100
- [Long Context (Qwen-Long)](#long-context-qwen-long)
98101
- [Multimodal](#multimodal) - QWen-VL, QVQ, etc. Supports reasoning/visual understanding/OCR/audio understanding
99102
- [Text-to-Speech](#text-to-speech) - CosyVoice, Sambert, etc. For TTS applications
100103
- [Image Generation](#image-generation) - wanx2.1, etc. For text-to-image and portrait style transfer
101-
- [Application Invocation](#application-invocation)
104+
- [Application Call](#application-call)
102105
- [Text Embeddings](#text-embeddings)
103106

104107

@@ -167,13 +170,12 @@ while (true)
167170
}
168171
```
169172

170-
#### Thinking Models
173+
### Thinking Models
171174

172175
The model's thinking process is stored in a separate `ReasoningContent` property. When saving to conversation history, ignore it and only keep the model's reply `Content`.
173176

174177
Some models accept `EnableThinking` to control deep thinking, which can be set in `Parameters`.
175178

176-
For more settings on thinking models, see [Deep Thinking](#deep-thinking) below.
177179
```csharp
178180
var messages = new List<TextChatMessage>();
179181
messages.Add(TextChatMessage.System("You are a helpful assistant"));
@@ -504,7 +506,7 @@ Console.WriteLine(completion.Output.Choices[0].Message.Content);
504506
await dashScopeClient.DeleteFileAsync(uploadedFile.Id);
505507
```
506508

507-
### Multimodal
509+
## Multimodal
508510
Use `GetMultimodalGenerationAsync`/`GetMultimodalGenerationStreamAsync`
509511
[Official Documentation](https://help.aliyun.com/zh/model-studio/multimodal)
510512

@@ -562,7 +564,7 @@ await foreach (var modelResponse in response)
562564
}
563565
}
564566
```
565-
### Text-to-Speech
567+
## Text-to-Speech
566568

567569
Create a speech synthesis session using `dashScopeClient.CreateSpeechSynthesizerSocketSessionAsync()`.
568570

@@ -583,8 +585,8 @@ await foreach (var b in tts.GetAudioAsync())
583585
}
584586
Console.WriteLine($"Audio saved to {file.FullName}");
585587
```
586-
### Image Generation
587-
#### Text-to-Image
588+
## Image Generation
589+
### Text-to-Image
588590
Use shortcuts for Wanx models:
589591
```csharp
590592
var task = await dashScopeClient.CreateWanxImageSynthesisTaskAsync(
@@ -610,7 +612,7 @@ Use `CreateWanxImageGenerationTaskAsync` and `GetWanxImageGenerationTaskAsync`
610612

611613
Use `CreateWanxBackgroundGenerationTaskAsync` and `GetWanxBackgroundGenerationTaskAsync`
612614

613-
### Application Call
615+
## Application Call
614616
```csharp
615617
var request =
616618
new ApplicationRequest()
@@ -670,7 +672,7 @@ var response = await client.GetApplicationResponseAsync("your-application-id", r
670672
Console.WriteLine(response.Output.Text);
671673
```
672674

673-
### Text Vectorization
675+
## Text Embeddings
674676

675677
```csharp
676678
var text = "Sample text for embedding";

src/Cnblogs.DashScope.Core/Internals/DashScopeDefaults.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Cnblogs.DashScope.Core.Internals;
1010
public static class DashScopeDefaults
1111
{
1212
/// <summary>
13-
/// Base address for HTTP API.
13+
/// Base address of HTTP API.
1414
/// </summary>
1515
public const string HttpApiBaseAddress = "https://dashscope.aliyuncs.com/api/v1/";
1616

0 commit comments

Comments
 (0)