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>"
}
}模型
比較模型
GET /v1/models/compare — 並排比較多個模型。
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>"
}
}查詢參數
string
必填
以逗號分隔的模型 ID 列表(例如
openai/gpt-4o,anthropic/claude-3.5-sonnet)。回應
{
"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"
}
}
範例
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)
授權
BearerAuthApiKeyAuth
API key authentication. Pass your OpenModex API key as a Bearer token in the Authorization header: Authorization: Bearer omx_sk_...
查詢參數
Comma-separated list of model IDs to compare (2-4 models).
回應
Model comparison response.
Response from comparing models.
The object type, always 'model_comparison'.
可用選項:
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