Compare models
curl --request GET \
--url https://api.openmodex.com/v1/models/compare \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.openmodex.com/v1/models/compare"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.openmodex.com/v1/models/compare', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openmodex.com/v1/models/compare",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.openmodex.com/v1/models/compare"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.openmodex.com/v1/models/compare")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openmodex.com/v1/models/compare")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "model_comparison",
"models": [
"<string>"
],
"comparison": {},
"highlights": {
"cheapest": "<string>",
"fastest": "<string>",
"best_quality": "<string>",
"best_code": "<string>",
"longest_context": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}Mô hình
So sánh mô hình
GET /v1/models/compare — So sánh nhiều mô hình song song.
GET
/
v1
/
models
/
compare
Compare models
curl --request GET \
--url https://api.openmodex.com/v1/models/compare \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.openmodex.com/v1/models/compare"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.openmodex.com/v1/models/compare', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openmodex.com/v1/models/compare",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.openmodex.com/v1/models/compare"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.openmodex.com/v1/models/compare")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openmodex.com/v1/models/compare")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "model_comparison",
"models": [
"<string>"
],
"comparison": {},
"highlights": {
"cheapest": "<string>",
"fastest": "<string>",
"best_quality": "<string>",
"best_code": "<string>",
"longest_context": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}Tham Số Truy Vấn
string
bắt buộc
Danh sách ID mô hình phân cách bằng dấu phẩy để so sánh (ví dụ:
openai/gpt-4o,anthropic/claude-3.5-sonnet).Phản Hồi
{
"object": "model_comparison",
"models": ["openai/gpt-4o", "anthropic/claude-3.5-sonnet"],
"comparison": {
"openai/gpt-4o": {
"name": "GPT-4o",
"provider": "openai",
"context_length": 128000,
"pricing": {
"openmodex_input_per_m": 2.50,
"openmodex_output_per_m": 10.00
},
"performance": {
"latency_p50_ms": 800,
"availability": 99.9
},
"quality_scores": {
"overall": 92,
"code": 90,
"math": 88,
"reasoning": 91
}
},
"anthropic/claude-3.5-sonnet": {
"name": "Claude 3.5 Sonnet",
"provider": "anthropic",
"context_length": 200000,
"pricing": {
"openmodex_input_per_m": 3.00,
"openmodex_output_per_m": 15.00
},
"performance": {
"latency_p50_ms": 900,
"availability": 99.8
},
"quality_scores": {
"overall": 93,
"code": 93,
"math": 90,
"reasoning": 94
}
}
},
"highlights": {
"cheapest": "openai/gpt-4o",
"fastest": "openai/gpt-4o",
"best_quality": "anthropic/claude-3.5-sonnet",
"best_code": "anthropic/claude-3.5-sonnet",
"longest_context": "anthropic/claude-3.5-sonnet"
}
}
Ví Dụ
curl "https://api.openmodex.com/v1/models/compare?models=openai/gpt-4o,anthropic/claude-3.5-sonnet" \
-H "Authorization: Bearer omx_sk_YOUR_KEY"
const comparison = await client.models.compare([
'openai/gpt-4o',
'anthropic/claude-3.5-sonnet',
]);
console.log(comparison.highlights);
comparison = client.models.compare([
"openai/gpt-4o",
"anthropic/claude-3.5-sonnet",
])
print(comparison.highlights)
Ủy quyền
BearerAuthApiKeyAuth
API key authentication. Pass your OpenModex API key as a Bearer token in the Authorization header: Authorization: Bearer omx_sk_...
Tham số truy vấn
Comma-separated list of model IDs to compare (2-4 models).
Phản hồi
Model comparison response.
Response from comparing models.
The object type, always 'model_comparison'.
Tùy chọn có sẵn:
model_comparison The list of model IDs being compared.
An object mapping each model ID to its comparison data including pricing, performance, and quality scores.
Show child attributes
Show child attributes
Highlights identifying the best model in each category.
Show child attributes
Show child attributes