Model services provide a solution for quickly deploying open-source or fine-tuned large language models as callable services. With one-click deployment, the complex management of models is simplified into a standardized service format. This format is compatible with mainstream model service API call capabilities, enabling immediate use.
Model services allow users to call selected models to perform tasks such as text generation, chat processing, image generation, and more.
These services support the online experience of models.
The details of the model service include basic information about the service, available authorization methods, and example API calls.
curl'https://sh-02.d.run/v1/chat/completions'\-H"Content-Type: application/json"\-H"Authorization: Bearer <Your API Key here>"\-d'{ "model": "u-8105f7322477/test", "messages": [{"role": "user", "content": "Say this is a test!"}], "temperature": 0.7 }'
Request Parameters:
model: The access path name of the model service (e.g., u-8105f7322477/test).
messages: A list of chat history containing user input, for example:
[{"role":"user","content":"Say this is a test!"}]
temperature: Controls the randomness of the generated output. A higher value produces more creative results, while a lower value yields more stable outputs.
{"id":"cmp-1d033c426254417b7b0675303b1d300","object":"chat.completion","created":1733724462,"model":"u-8105f7322477/test","choices":[{"index":0,"message":{"role":"assistant","content":"I am a large language model. How can I assist you today?"},"tool_calls":[]}],"usage":{"prompt_tokens":25,"completion_tokens":15,"total_tokens":40}}
Response Fields:
id: A unique identifier for the generated result.
model: The ID of the model service being called.
choices: An array of results generated by the model.
message: The generated content.
content: The text content produced by the model.
usage: Token usage for this call:
prompt_tokens: The number of tokens used for the user input.
completion_tokens: The number of tokens used for the generated response.
# Compatible with OpenAI Python library v1.0.0 and abovefromopenaiimportOpenAIclient=OpenAI(base_url="https://sh-02.d.run/v1/",api_key="<Your API Key here>")messages=[{"role":"user","content":"hello!"},{"role":"user","content":"Say this is a test?"}]response=client.chat.completions.create(model="u-8105f7322477/test",messages=messages)content=response.choices[0].message.contentprint(content)
constOpenAI=require('openai');constopenai=newOpenAI({baseURL:'https://sh-02.d.run/v1',apiKey:'<Your API Key here>',});asyncfunctiongetData(){try{constchatCompletion=awaitopenai.chat.completions.create({model:'u-8105f7322477/test',messages:[{role:'user',content:'hello!'},{role:'user',content:'how are you?'},],});console.log(chatCompletion.choices[0].message.content);}catch(error){if(errorinstanceofOpenAI.APIError){console.error('API Error:',error.status,error.message);console.error('Error details:',error.error);}else{console.error('Unexpected error:',error);}}}getData();