@@ -7,10 +7,10 @@ Chat completion operations
77
88### Available Operations
99
10- * [ createChatCompletion ] ( #createchatcompletion ) - Create a chat completion
11- * [ streamChatCompletion ] ( #streamchatcompletion ) - Create a chat completion
10+ * [ complete ] ( #complete ) - Create a chat completion
11+ * [ completeStream ] ( #completestream ) - Create a chat completion
1212
13- ## createChatCompletion
13+ ## complete
1414
1515Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes.
1616
@@ -25,7 +25,7 @@ const openRouter = new OpenRouter({
2525});
2626
2727async function run() {
28- const result = await openRouter .chat .createChatCompletion ({
28+ const result = await openRouter .chat .complete ({
2929 messages: [
3030 {
3131 role: " user" ,
@@ -46,7 +46,7 @@ The standalone function version of this method:
4646
4747``` typescript
4848import { OpenRouterCore } from " open-router/core.js" ;
49- import { chatCreateChatCompletion } from " open-router/funcs/chatCreateChatCompletion .js" ;
49+ import { chatComplete } from " open-router/funcs/chatComplete .js" ;
5050
5151// Use `OpenRouterCore` for best tree-shaking performance.
5252// You can create one instance of it to use across an application.
@@ -55,7 +55,7 @@ const openRouter = new OpenRouterCore({
5555});
5656
5757async function run() {
58- const res = await chatCreateChatCompletion (openRouter , {
58+ const res = await chatComplete (openRouter , {
5959 messages: [
6060 {
6161 role: " user" ,
@@ -67,7 +67,7 @@ async function run() {
6767 const { value : result } = res ;
6868 console .log (result );
6969 } else {
70- console .log (" chatCreateChatCompletion failed:" , res .error );
70+ console .log (" chatComplete failed:" , res .error );
7171 }
7272}
7373
9595| errors.ChatCompletionError | 500 | application/json |
9696| errors.OpenRouterDefaultError | 4XX, 5XX | \* /\* |
9797
98- ## streamChatCompletion
98+ ## completeStream
9999
100100Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes.
101101
@@ -110,7 +110,7 @@ const openRouter = new OpenRouter({
110110});
111111
112112async function run() {
113- const result = await openRouter .chat .streamChatCompletion ({
113+ const result = await openRouter .chat .completeStream ({
114114 messages: [
115115 {
116116 role: " user" ,
@@ -134,7 +134,7 @@ The standalone function version of this method:
134134
135135``` typescript
136136import { OpenRouterCore } from " open-router/core.js" ;
137- import { chatStreamChatCompletion } from " open-router/funcs/chatStreamChatCompletion .js" ;
137+ import { chatCompleteStream } from " open-router/funcs/chatCompleteStream .js" ;
138138
139139// Use `OpenRouterCore` for best tree-shaking performance.
140140// You can create one instance of it to use across an application.
@@ -143,7 +143,7 @@ const openRouter = new OpenRouterCore({
143143});
144144
145145async function run() {
146- const res = await chatStreamChatCompletion (openRouter , {
146+ const res = await chatCompleteStream (openRouter , {
147147 messages: [
148148 {
149149 role: " user" ,
@@ -158,7 +158,7 @@ async function run() {
158158 console .log (event );
159159 }
160160 } else {
161- console .log (" chatStreamChatCompletion failed:" , res .error );
161+ console .log (" chatCompleteStream failed:" , res .error );
162162 }
163163}
164164
0 commit comments