Skip to content

Commit b667673

Browse files
authored
Merge pull request #8277 from ovh/QM-add-virtual-models
FR Add AI Endpoints guide for virtual models
2 parents cf2db50 + 853729c commit b667673

File tree

4 files changed

+292
-0
lines changed

4 files changed

+292
-0
lines changed

pages/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@
12061206
+ [AI Endpoints - Billing and lifecycle](public_cloud/ai_machine_learning/endpoints_guide_04_billing_concept)
12071207
+ [AI Endpoints - Structured Output](public_cloud/ai_machine_learning/endpoints_guide_05_structured_output)
12081208
+ [AI Endpoints - Function Calling](public_cloud/ai_machine_learning/endpoints_guide_06_function_calling)
1209+
+ [AI Endpoints - Virtual Models](public_cloud/ai_machine_learning/endpoints_guide_07_virtual_models/)
12091210
+ [Tutorials](public-cloud-ai-and-machine-learning-ai-endpointstutorials)
12101211
+ [AI Endpoints - Create your own audio summarizer](public_cloud/ai_machine_learning/endpoints_tuto_01_audio_summarizer)
12111212
+ [AI Endpoints - Create your own voice assistant](public_cloud/ai_machine_learning/endpoints_tuto_02_voice_virtual_assistant)
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
---
2+
title: AI Endpoints - Using Virtual Models
3+
excerpt: Learn how to use OVHcloud AI Endpoints Virtual Models
4+
updated: 2025-08-18
5+
---
6+
7+
> [!primary]
8+
>
9+
> AI Endpoints is covered by the **[OVHcloud AI Endpoints Conditions](https://storage.gra.cloud.ovh.net/v1/AUTH_325716a587c64897acbef9a4a4726e38/contracts/48743bf-AI_Endpoints-ALL-1.1.pdf)** and the **[OVHcloud Public Cloud Special Conditions](https://storage.gra.cloud.ovh.net/v1/AUTH_325716a587c64897acbef9a4a4726e38/contracts/d2a208c-Conditions_particulieres_OVH_Stack-WE-9.0.pdf)**.
10+
>
11+
12+
## Introduction
13+
14+
Choosing the right Large Language Model (LLM) is not always straightforward. Models vary in strengths, performance, cost, and licensing, and new ones appear regularly, often outperforming previous options. This rapid evolution makes it essential to match your choice to your specific needs, while staying ready to adapt as better models emerge.
15+
16+
To make this easier, we developed a system of virtual models. Instead of requesting a hard-coded model, you specify the expected specifications of the model you need (size, price, etc.) andthe system automatically maps your request to the best available match in our catalog. In this guide, you will learn about the different capabilities of this feature and how to use it with your OpenAI compatible code.
17+
18+
## Requirements
19+
20+
The examples provided in this guide can be used with one of the following environments:
21+
22+
> [!tabs]
23+
> **Python**
24+
>>
25+
>> A [Python](https://www.python.org/) environment with the [openai client](https://pypi.org/project/openai/).
26+
>>
27+
>> ```sh
28+
>> pip install openai
29+
>> ```
30+
>>
31+
> **Curl**
32+
>>
33+
>> A standard terminal, with [curl](https://curl.se/) installed on the system.
34+
>>
35+
36+
### Authentication & rate limiting
37+
38+
Most of the examples provided in this guide use anonymous authentication, which makes it simpler to use but may cause rate limiting issues.
39+
If you wish to enable authentication using your own token, simply specify your API key within the requests.
40+
41+
Follow the instructions in the [AI Endpoints - Getting Started](/pages/public_cloud/ai_machine_learning/endpoints_guide_01_getting_started) guide for more information on authentication.
42+
43+
## Model DSL
44+
45+
When you request an LLM generation through our unified endpoint, you can provide in the OpenAI-compliant `model` field a model DSL query instead of a hardcoded model name.
46+
47+
These queries are divided into three parts: tag, ranker, and condition:
48+
49+
- **Tag**: A tag can be a model series (llama, mistral, codestral, ...), a publisher (meta-llama, mistralai, ...) or use case tag (code_chat, code_completion, summarization, etc.)
50+
- **Ranker**: The ranker defines a model's capability compared to other models. We support multiple rankers such as fastest, cheapest, biggest, latest or smallest.
51+
- **Condition**: The condition allows you to filter models based on strict requirements on some of the model specifications such as context_size, max_tokens and input_cost. These conditions support basic operators (<, >, =).
52+
53+
Below are some example queries and the models they currently resolve to. Please note that the resolved model can change, as we continuously update our catalog with new model releases.
54+
55+
| Model Query | Current Target Model | Usage |
56+
|-----------|-----------|-----------|
57+
| code_chat@latest | Qwen3-32B | The most recently released model optimized for code chat tasks |
58+
| meta-llama@latest | Llama-3.1-8B-Instruct | The latest Meta-released LLaMA model |
59+
| mistral@latest?context_size > 100000 | Mistral-Small-3.2-24B-Instruct-2506 | The latest Mistral model with a context window greater than 100k tokens |
60+
| llama@biggest?input_cost<0.5 | Llama-3.1-8B-Instruct | The largest LLaMA model whose input token cost is under €0.50 per 1M tokens |
61+
62+
You can visit our [catalog](https://endpoints.ai.cloud.ovh.net/catalog) to learn more about the different model specifications.
63+
64+
### Example Usage
65+
66+
The following code samples provide a simple example on how to query our API with a model query.
67+
68+
> [!tabs]
69+
> **Python**
70+
>> ```python
71+
>> import os
72+
>> from openai import OpenAI
73+
>>
74+
>> url = "https://oai.endpoints.kepler.ai.cloud.ovh.net/v1"
75+
>>
76+
>> client = OpenAI(
77+
>> base_url=url,
78+
>> api_key=os.getenv("OVH_AI_ENDPOINTS_ACCESS_TOKEN")
79+
>> )
80+
>>
81+
>> def chat_completion(new_message: str) -> str:
82+
>> history_openai_format = [{"role": "user", "content": new_message}]
83+
>> result = client.chat.completions.create(
84+
>> model="mistral@latest",
85+
>> messages=history_openai_format,
86+
>> temperature=0,
87+
>> max_tokens=1024
88+
>> )
89+
>> return result.model, result.choices.pop().message.content
90+
>>
91+
>> if __name__ == '__main__':
92+
>> model, message = chat_completion("Explain gravity for a 6 years old")
93+
>> print(f"Model: {model}:", message)
94+
>> ```
95+
>>
96+
>> Output:
97+
>>
98+
>> ```sh
99+
>> Model: Mistral-Small-3.2-24B-Instruct-2506: Sure! Here’s a simple way to explain gravity to a 6-year-old:
100+
>>
101+
>> **"Gravity is like a big, invisible hug from the Earth! It’s what keeps us from floating away into space. When you jump, gravity pulls you back down to the ground. It’s also why things fall—like when you drop your toy, it doesn’t float up, it falls down because of gravity. Even the Moon stays close to Earth because of gravity!"**
102+
>>
103+
>> You can also add:
104+
>> - *"If you throw a ball up, gravity pulls it back down."*
105+
>> - *"Without gravity, we’d all be floating like astronauts in space!"*
106+
>>
107+
>> Would you like a fun example or a little experiment to go with it? 😊
108+
>> ```
109+
>>
110+
> **Curl**
111+
>>
112+
>> ```sh
113+
>> curl https://oai.endpoints.kepler.ai.cloud.ovh.net/v1/chat/completions -H "Content-Type: application/json" -d '{
114+
>> "messages": [{
115+
>> "role": "user",
116+
>> "content": "What is the capital of France ?"
117+
>> }], "model": "llama@biggest?input_cost<0.5",
118+
>> "seed": 21, "max_tokens": 20
119+
>> }'
120+
>> ```
121+
>>
122+
>> Output response:
123+
>>
124+
>> ```sh
125+
>> {"id":"chatcmpl-5df407ebdf23464f891b1b1d8cb3e76d","object":"chat.completion","created":1755007630,"model":"Llama-3.1-8B-Instruct","choices":[{"index":0,"message":{"role":"assistant","content":"The capital of France is Paris."},"finish_reason":"stop","logprobs":null}],"usage":{"prompt_tokens":42,"completion_tokens":8,"total_tokens":50}}
126+
>> ```
127+
>>
128+
129+
## Conclusion
130+
131+
Using OVHcloud AI Endpoints with virtual models allows you to stay up to date with the best available LLMs without having to change your code whenever a new release arrives.
132+
By defining your requirements through tags, rankers, and conditions, you can ensure your application always runs on the most suitable model for your needs, whether you prioritize speed, cost, size, or capabilities. This flexibility makes it easier to build, maintain, and scale AI-powered solutions over time.
133+
134+
## Go further
135+
136+
To discover how to build complete and powerful applications using AI Endpoints, explore our dedicated [AI Endpoints guides](/products/public-cloud-ai-and-machine-learning-ai-endpoints).
137+
138+
If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link](/links/professional-services) to get a quote and ask our Professional Services experts for a custom analysis of your project.
139+
140+
## Feedback
141+
142+
Please send us your questions, feedback and suggestions to improve the service:
143+
144+
- On the OVHcloud [Discord server](https://discord.gg/ovhcloud).
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
---
2+
title: AI Endpoints - Modèles virtuels
3+
excerpt: "Découvrez comment utiliser les modèles virtuels d'AI Endpoints"
4+
updated: 2025-08-18
5+
---
6+
7+
> [!primary]
8+
>
9+
> AI Endpoints is covered by the **[OVHcloud AI Endpoints Conditions](https://storage.gra.cloud.ovh.net/v1/AUTH_325716a587c64897acbef9a4a4726e38/contracts/48743bf-AI_Endpoints-ALL-1.1.pdf)** and the **[OVHcloud Public Cloud Special Conditions](https://storage.gra.cloud.ovh.net/v1/AUTH_325716a587c64897acbef9a4a4726e38/contracts/d2a208c-Conditions_particulieres_OVH_Stack-WE-9.0.pdf)**.
10+
>
11+
12+
## Introduction
13+
14+
Choosing the right Large Language Model (LLM) is not always straightforward. Models vary in strengths, performance, cost, and licensing, and new ones appear regularly, often outperforming previous options. This rapid evolution makes it essential to match your choice to your specific needs, while staying ready to adapt as better models emerge.
15+
16+
To make this easier, we developed a system of virtual models. Instead of requesting a hard-coded model, you specify the expected specifications of the model you need (size, price, etc.) andthe system automatically maps your request to the best available match in our catalog. In this guide, you will learn about the different capabilities of this feature and how to use it with your OpenAI compatible code.
17+
18+
## Requirements
19+
20+
The examples provided in this guide can be used with one of the following environments:
21+
22+
> [!tabs]
23+
> **Python**
24+
>>
25+
>> A [Python](https://www.python.org/) environment with the [openai client](https://pypi.org/project/openai/).
26+
>>
27+
>> ```sh
28+
>> pip install openai
29+
>> ```
30+
>>
31+
> **Curl**
32+
>>
33+
>> A standard terminal, with [curl](https://curl.se/) installed on the system.
34+
>>
35+
36+
### Authentication & rate limiting
37+
38+
Most of the examples provided in this guide use anonymous authentication, which makes it simpler to use but may cause rate limiting issues.
39+
If you wish to enable authentication using your own token, simply specify your API key within the requests.
40+
41+
Follow the instructions in the [AI Endpoints - Getting Started](/pages/public_cloud/ai_machine_learning/endpoints_guide_01_getting_started) guide for more information on authentication.
42+
43+
## Model DSL
44+
45+
When you request an LLM generation through our unified endpoint, you can provide in the OpenAI-compliant `model` field a model DSL query instead of a hardcoded model name.
46+
47+
These queries are divided into three parts: tag, ranker, and condition:
48+
49+
- **Tag**: A tag can be a model series (llama, mistral, codestral, ...), a publisher (meta-llama, mistralai, ...) or use case tag (code_chat, code_completion, summarization, etc.)
50+
- **Ranker**: The ranker defines a model's capability compared to other models. We support multiple rankers such as fastest, cheapest, biggest, latest or smallest.
51+
- **Condition**: The condition allows you to filter models based on strict requirements on some of the model specifications such as context_size, max_tokens and input_cost. These conditions support basic operators (<, >, =).
52+
53+
Below are some example queries and the models they currently resolve to. Please note that the resolved model can change, as we continuously update our catalog with new model releases.
54+
55+
| Model Query | Current Target Model | Usage |
56+
|-----------|-----------|-----------|
57+
| code_chat@latest | Qwen3-32B | The most recently released model optimized for code chat tasks |
58+
| meta-llama@latest | Llama-3.1-8B-Instruct | The latest Meta-released LLaMA model |
59+
| mistral@latest?context_size > 100000 | Mistral-Small-3.2-24B-Instruct-2506 | The latest Mistral model with a context window greater than 100k tokens |
60+
| llama@biggest?input_cost<0.5 | Llama-3.1-8B-Instruct | The largest LLaMA model whose input token cost is under €0.50 per 1M tokens |
61+
62+
You can visit our [catalog](https://endpoints.ai.cloud.ovh.net/catalog) to learn more about the different model specifications.
63+
64+
### Example Usage
65+
66+
The following code samples provide a simple example on how to query our API with a model query.
67+
68+
> [!tabs]
69+
> **Python**
70+
>> ```python
71+
>> import os
72+
>> from openai import OpenAI
73+
>>
74+
>> url = "https://oai.endpoints.kepler.ai.cloud.ovh.net/v1"
75+
>>
76+
>> client = OpenAI(
77+
>> base_url=url,
78+
>> api_key=os.getenv("OVH_AI_ENDPOINTS_ACCESS_TOKEN")
79+
>> )
80+
>>
81+
>> def chat_completion(new_message: str) -> str:
82+
>> history_openai_format = [{"role": "user", "content": new_message}]
83+
>> result = client.chat.completions.create(
84+
>> model="mistral@latest",
85+
>> messages=history_openai_format,
86+
>> temperature=0,
87+
>> max_tokens=1024
88+
>> )
89+
>> return result.model, result.choices.pop().message.content
90+
>>
91+
>> if __name__ == '__main__':
92+
>> model, message = chat_completion("Explain gravity for a 6 years old")
93+
>> print(f"Model: {model}:", message)
94+
>> ```
95+
>>
96+
>> Output:
97+
>>
98+
>> ```sh
99+
>> Model: Mistral-Small-3.2-24B-Instruct-2506: Sure! Here’s a simple way to explain gravity to a 6-year-old:
100+
>>
101+
>> **"Gravity is like a big, invisible hug from the Earth! It’s what keeps us from floating away into space. When you jump, gravity pulls you back down to the ground. It’s also why things fall—like when you drop your toy, it doesn’t float up, it falls down because of gravity. Even the Moon stays close to Earth because of gravity!"**
102+
>>
103+
>> You can also add:
104+
>> - *"If you throw a ball up, gravity pulls it back down."*
105+
>> - *"Without gravity, we’d all be floating like astronauts in space!"*
106+
>>
107+
>> Would you like a fun example or a little experiment to go with it? 😊
108+
>> ```
109+
>>
110+
> **Curl**
111+
>>
112+
>> ```sh
113+
>> curl https://oai.endpoints.kepler.ai.cloud.ovh.net/v1/chat/completions -H "Content-Type: application/json" -d '{
114+
>> "messages": [{
115+
>> "role": "user",
116+
>> "content": "What is the capital of France ?"
117+
>> }], "model": "llama@biggest?input_cost<0.5",
118+
>> "seed": 21, "max_tokens": 20
119+
>> }'
120+
>> ```
121+
>>
122+
>> Output response:
123+
>>
124+
>> ```sh
125+
>> {"id":"chatcmpl-5df407ebdf23464f891b1b1d8cb3e76d","object":"chat.completion","created":1755007630,"model":"Llama-3.1-8B-Instruct","choices":[{"index":0,"message":{"role":"assistant","content":"The capital of France is Paris."},"finish_reason":"stop","logprobs":null}],"usage":{"prompt_tokens":42,"completion_tokens":8,"total_tokens":50}}
126+
>> ```
127+
>>
128+
129+
## Conclusion
130+
131+
Using OVHcloud AI Endpoints with virtual models allows you to stay up to date with the best available LLMs without having to change your code whenever a new release arrives.
132+
By defining your requirements through tags, rankers, and conditions, you can ensure your application always runs on the most suitable model for your needs, whether you prioritize speed, cost, size, or capabilities. This flexibility makes it easier to build, maintain, and scale AI-powered solutions over time.
133+
134+
## Go further
135+
136+
To discover how to build complete and powerful applications using AI Endpoints, explore our dedicated [AI Endpoints guides](/products/public-cloud-ai-and-machine-learning-ai-endpoints).
137+
138+
If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link](/links/professional-services) to get a quote and ask our Professional Services experts for a custom analysis of your project.
139+
140+
## Feedback
141+
142+
Please send us your questions, feedback and suggestions to improve the service:
143+
144+
- On the OVHcloud [Discord server](https://discord.gg/ovhcloud).
145+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
id: 59fdc7b6-933e-4884-9834-c73f007ee512
2+
full_slug: public-cloud-ai-endpoints-virtual-models

0 commit comments

Comments
 (0)