Python
import honeyhive
from honeyhive.models import components, operations
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.events.create_model_event(request=operations.CreateModelEventRequestBody(
model_event=components.CreateModelEvent(
project='New Project',
model='gpt-4o',
provider='openai',
messages=[
{
'role': 'system',
'content': 'Hello, world!',
},
],
response={
'role': 'assistant',
'content': 'Hello, world!',
},
duration=42,
usage={
'prompt_tokens': 10,
'completion_tokens': 10,
'total_tokens': 20,
},
cost=0.00008,
error=None,
source='playground',
event_name='Model Completion',
hyperparameters={
'temperature': 0,
'top_p': 1,
'max_tokens': 1000,
'presence_penalty': 0,
'frequency_penalty': 0,
'stop': [
'<value>',
],
'n': 1,
},
template=[
{
'role': 'system',
'content': 'Hello, {{ name }}!',
},
],
template_inputs={
'name': 'world',
},
tools=[
{
'key': '<value>',
},
],
tool_choice='none',
response_format={
'type': 'text',
},
),
))
if res.object is not None:
# handle response
passimport { HoneyHive } from "honeyhive";
async function run() {
const sdk = new HoneyHive({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
const res = await sdk.events.createModelEvent({
modelEvent: {
project: "New Project",
model: "gpt-4o",
provider: "openai",
messages: [
{
"role": "system",
"content": "Hello, world!",
},
],
response: {
"role": "assistant",
"content": "Hello, world!",
},
duration: 42,
usage: {
"prompt_tokens": 10,
"completion_tokens": 10,
"total_tokens": 20,
},
cost: 0.00008,
error: null,
source: "playground",
eventName: "Model Completion",
hyperparameters: {
"temperature": 0,
"top_p": 1,
"max_tokens": 1000,
"presence_penalty": 0,
"frequency_penalty": 0,
"stop": [
"<value>",
],
"n": 1,
},
template: [
{
"role": "system",
"content": "Hello, {{ name }}!",
},
],
templateInputs: {
"name": "world",
},
tools: [
{
"key": "<value>",
},
],
toolChoice: "none",
responseFormat: {
"type": "text",
},
},
});
if (res.statusCode == 200) {
// handle response
}
}
run();curl --request POST \
--url https://api.honeyhive.ai/events/model \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model_event": {
"project": "New Project",
"model": "gpt-4o",
"provider": "openai",
"messages": [
{
"role": "system",
"content": "Hello, world!"
}
],
"response": {
"role": "assistant",
"content": "Hello, world!"
},
"duration": 42,
"usage": {
"prompt_tokens": 10,
"completion_tokens": 10,
"total_tokens": 20
},
"cost": 0.00008,
"error": null,
"source": "playground",
"event_name": "Model Completion",
"hyperparameters": {
"temperature": 0,
"top_p": 1,
"max_tokens": 1000,
"presence_penalty": 0,
"frequency_penalty": 0,
"stop": [],
"n": 1
},
"template": [
{
"role": "system",
"content": "Hello, {{ name }}!"
}
],
"template_inputs": {
"name": "world"
},
"tools": {
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"format": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
],
"description": "The temperature unit to use. Infer this from the users location."
}
},
"required": [
"location",
"format"
]
}
}
},
"tool_choice": "none",
"response_format": {
"type": "text"
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model_event: {
project: 'New Project',
model: 'gpt-4o',
provider: 'openai',
messages: [{role: 'system', content: 'Hello, world!'}],
response: {role: 'assistant', content: 'Hello, world!'},
duration: 42,
usage: {prompt_tokens: 10, completion_tokens: 10, total_tokens: 20},
cost: 0.00008,
error: null,
source: 'playground',
event_name: 'Model Completion',
hyperparameters: {
temperature: 0,
top_p: 1,
max_tokens: 1000,
presence_penalty: 0,
frequency_penalty: 0,
stop: [],
n: 1
},
template: [{role: 'system', content: 'Hello, {{ name }}!'}],
template_inputs: {name: 'world'},
tools: {
type: 'function',
function: {
name: 'get_current_weather',
description: 'Get the current weather',
parameters: {
type: 'object',
properties: {
location: {type: 'string', description: 'The city and state, e.g. San Francisco, CA'},
format: {
type: 'string',
enum: ['celsius', 'fahrenheit'],
description: 'The temperature unit to use. Infer this from the users location.'
}
},
required: ['location', 'format']
}
}
},
tool_choice: 'none',
response_format: {type: 'text'}
}
})
};
fetch('https://api.honeyhive.ai/events/model', 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.honeyhive.ai/events/model",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model_event' => [
'project' => 'New Project',
'model' => 'gpt-4o',
'provider' => 'openai',
'messages' => [
[
'role' => 'system',
'content' => 'Hello, world!'
]
],
'response' => [
'role' => 'assistant',
'content' => 'Hello, world!'
],
'duration' => 42,
'usage' => [
'prompt_tokens' => 10,
'completion_tokens' => 10,
'total_tokens' => 20
],
'cost' => 0.00008,
'error' => null,
'source' => 'playground',
'event_name' => 'Model Completion',
'hyperparameters' => [
'temperature' => 0,
'top_p' => 1,
'max_tokens' => 1000,
'presence_penalty' => 0,
'frequency_penalty' => 0,
'stop' => [
],
'n' => 1
],
'template' => [
[
'role' => 'system',
'content' => 'Hello, {{ name }}!'
]
],
'template_inputs' => [
'name' => 'world'
],
'tools' => [
'type' => 'function',
'function' => [
'name' => 'get_current_weather',
'description' => 'Get the current weather',
'parameters' => [
'type' => 'object',
'properties' => [
'location' => [
'type' => 'string',
'description' => 'The city and state, e.g. San Francisco, CA'
],
'format' => [
'type' => 'string',
'enum' => [
'celsius',
'fahrenheit'
],
'description' => 'The temperature unit to use. Infer this from the users location.'
]
],
'required' => [
'location',
'format'
]
]
]
],
'tool_choice' => 'none',
'response_format' => [
'type' => 'text'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.honeyhive.ai/events/model"
payload := strings.NewReader("{\n \"model_event\": {\n \"project\": \"New Project\",\n \"model\": \"gpt-4o\",\n \"provider\": \"openai\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"Hello, world!\"\n }\n ],\n \"response\": {\n \"role\": \"assistant\",\n \"content\": \"Hello, world!\"\n },\n \"duration\": 42,\n \"usage\": {\n \"prompt_tokens\": 10,\n \"completion_tokens\": 10,\n \"total_tokens\": 20\n },\n \"cost\": 0.00008,\n \"error\": null,\n \"source\": \"playground\",\n \"event_name\": \"Model Completion\",\n \"hyperparameters\": {\n \"temperature\": 0,\n \"top_p\": 1,\n \"max_tokens\": 1000,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"stop\": [],\n \"n\": 1\n },\n \"template\": [\n {\n \"role\": \"system\",\n \"content\": \"Hello, {{ name }}!\"\n }\n ],\n \"template_inputs\": {\n \"name\": \"world\"\n },\n \"tools\": {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"format\": {\n \"type\": \"string\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ],\n \"description\": \"The temperature unit to use. Infer this from the users location.\"\n }\n },\n \"required\": [\n \"location\",\n \"format\"\n ]\n }\n }\n },\n \"tool_choice\": \"none\",\n \"response_format\": {\n \"type\": \"text\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.honeyhive.ai/events/model")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model_event\": {\n \"project\": \"New Project\",\n \"model\": \"gpt-4o\",\n \"provider\": \"openai\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"Hello, world!\"\n }\n ],\n \"response\": {\n \"role\": \"assistant\",\n \"content\": \"Hello, world!\"\n },\n \"duration\": 42,\n \"usage\": {\n \"prompt_tokens\": 10,\n \"completion_tokens\": 10,\n \"total_tokens\": 20\n },\n \"cost\": 0.00008,\n \"error\": null,\n \"source\": \"playground\",\n \"event_name\": \"Model Completion\",\n \"hyperparameters\": {\n \"temperature\": 0,\n \"top_p\": 1,\n \"max_tokens\": 1000,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"stop\": [],\n \"n\": 1\n },\n \"template\": [\n {\n \"role\": \"system\",\n \"content\": \"Hello, {{ name }}!\"\n }\n ],\n \"template_inputs\": {\n \"name\": \"world\"\n },\n \"tools\": {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"format\": {\n \"type\": \"string\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ],\n \"description\": \"The temperature unit to use. Infer this from the users location.\"\n }\n },\n \"required\": [\n \"location\",\n \"format\"\n ]\n }\n }\n },\n \"tool_choice\": \"none\",\n \"response_format\": {\n \"type\": \"text\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.honeyhive.ai/events/model")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model_event\": {\n \"project\": \"New Project\",\n \"model\": \"gpt-4o\",\n \"provider\": \"openai\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"Hello, world!\"\n }\n ],\n \"response\": {\n \"role\": \"assistant\",\n \"content\": \"Hello, world!\"\n },\n \"duration\": 42,\n \"usage\": {\n \"prompt_tokens\": 10,\n \"completion_tokens\": 10,\n \"total_tokens\": 20\n },\n \"cost\": 0.00008,\n \"error\": null,\n \"source\": \"playground\",\n \"event_name\": \"Model Completion\",\n \"hyperparameters\": {\n \"temperature\": 0,\n \"top_p\": 1,\n \"max_tokens\": 1000,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"stop\": [],\n \"n\": 1\n },\n \"template\": [\n {\n \"role\": \"system\",\n \"content\": \"Hello, {{ name }}!\"\n }\n ],\n \"template_inputs\": {\n \"name\": \"world\"\n },\n \"tools\": {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"format\": {\n \"type\": \"string\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ],\n \"description\": \"The temperature unit to use. Infer this from the users location.\"\n }\n },\n \"required\": [\n \"location\",\n \"format\"\n ]\n }\n }\n },\n \"tool_choice\": \"none\",\n \"response_format\": {\n \"type\": \"text\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"event_id": "7f22137a-6911-4ed3-bc36-110f1dde6b66",
"success": true
}Events
Create a new model event (deprecated)
Deprecated. Use POST /v1/events with event_type="model" instead. The ModelEvent schema carries 14 field-level deprecations covering the model-specific fields the generic event route now expresses (model, messages, response, provider, usage, cost, hyperparameters, template, template_inputs, tools, tool_choice, response_format, duration, error), plus project inherited from LegacyEvent. The legacy route continues to serve traffic and remaps these fields into inputs.* / outputs.* before storage.
POST
/
events
/
model
Python
import honeyhive
from honeyhive.models import components, operations
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.events.create_model_event(request=operations.CreateModelEventRequestBody(
model_event=components.CreateModelEvent(
project='New Project',
model='gpt-4o',
provider='openai',
messages=[
{
'role': 'system',
'content': 'Hello, world!',
},
],
response={
'role': 'assistant',
'content': 'Hello, world!',
},
duration=42,
usage={
'prompt_tokens': 10,
'completion_tokens': 10,
'total_tokens': 20,
},
cost=0.00008,
error=None,
source='playground',
event_name='Model Completion',
hyperparameters={
'temperature': 0,
'top_p': 1,
'max_tokens': 1000,
'presence_penalty': 0,
'frequency_penalty': 0,
'stop': [
'<value>',
],
'n': 1,
},
template=[
{
'role': 'system',
'content': 'Hello, {{ name }}!',
},
],
template_inputs={
'name': 'world',
},
tools=[
{
'key': '<value>',
},
],
tool_choice='none',
response_format={
'type': 'text',
},
),
))
if res.object is not None:
# handle response
passimport { HoneyHive } from "honeyhive";
async function run() {
const sdk = new HoneyHive({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
const res = await sdk.events.createModelEvent({
modelEvent: {
project: "New Project",
model: "gpt-4o",
provider: "openai",
messages: [
{
"role": "system",
"content": "Hello, world!",
},
],
response: {
"role": "assistant",
"content": "Hello, world!",
},
duration: 42,
usage: {
"prompt_tokens": 10,
"completion_tokens": 10,
"total_tokens": 20,
},
cost: 0.00008,
error: null,
source: "playground",
eventName: "Model Completion",
hyperparameters: {
"temperature": 0,
"top_p": 1,
"max_tokens": 1000,
"presence_penalty": 0,
"frequency_penalty": 0,
"stop": [
"<value>",
],
"n": 1,
},
template: [
{
"role": "system",
"content": "Hello, {{ name }}!",
},
],
templateInputs: {
"name": "world",
},
tools: [
{
"key": "<value>",
},
],
toolChoice: "none",
responseFormat: {
"type": "text",
},
},
});
if (res.statusCode == 200) {
// handle response
}
}
run();curl --request POST \
--url https://api.honeyhive.ai/events/model \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model_event": {
"project": "New Project",
"model": "gpt-4o",
"provider": "openai",
"messages": [
{
"role": "system",
"content": "Hello, world!"
}
],
"response": {
"role": "assistant",
"content": "Hello, world!"
},
"duration": 42,
"usage": {
"prompt_tokens": 10,
"completion_tokens": 10,
"total_tokens": 20
},
"cost": 0.00008,
"error": null,
"source": "playground",
"event_name": "Model Completion",
"hyperparameters": {
"temperature": 0,
"top_p": 1,
"max_tokens": 1000,
"presence_penalty": 0,
"frequency_penalty": 0,
"stop": [],
"n": 1
},
"template": [
{
"role": "system",
"content": "Hello, {{ name }}!"
}
],
"template_inputs": {
"name": "world"
},
"tools": {
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"format": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
],
"description": "The temperature unit to use. Infer this from the users location."
}
},
"required": [
"location",
"format"
]
}
}
},
"tool_choice": "none",
"response_format": {
"type": "text"
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model_event: {
project: 'New Project',
model: 'gpt-4o',
provider: 'openai',
messages: [{role: 'system', content: 'Hello, world!'}],
response: {role: 'assistant', content: 'Hello, world!'},
duration: 42,
usage: {prompt_tokens: 10, completion_tokens: 10, total_tokens: 20},
cost: 0.00008,
error: null,
source: 'playground',
event_name: 'Model Completion',
hyperparameters: {
temperature: 0,
top_p: 1,
max_tokens: 1000,
presence_penalty: 0,
frequency_penalty: 0,
stop: [],
n: 1
},
template: [{role: 'system', content: 'Hello, {{ name }}!'}],
template_inputs: {name: 'world'},
tools: {
type: 'function',
function: {
name: 'get_current_weather',
description: 'Get the current weather',
parameters: {
type: 'object',
properties: {
location: {type: 'string', description: 'The city and state, e.g. San Francisco, CA'},
format: {
type: 'string',
enum: ['celsius', 'fahrenheit'],
description: 'The temperature unit to use. Infer this from the users location.'
}
},
required: ['location', 'format']
}
}
},
tool_choice: 'none',
response_format: {type: 'text'}
}
})
};
fetch('https://api.honeyhive.ai/events/model', 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.honeyhive.ai/events/model",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model_event' => [
'project' => 'New Project',
'model' => 'gpt-4o',
'provider' => 'openai',
'messages' => [
[
'role' => 'system',
'content' => 'Hello, world!'
]
],
'response' => [
'role' => 'assistant',
'content' => 'Hello, world!'
],
'duration' => 42,
'usage' => [
'prompt_tokens' => 10,
'completion_tokens' => 10,
'total_tokens' => 20
],
'cost' => 0.00008,
'error' => null,
'source' => 'playground',
'event_name' => 'Model Completion',
'hyperparameters' => [
'temperature' => 0,
'top_p' => 1,
'max_tokens' => 1000,
'presence_penalty' => 0,
'frequency_penalty' => 0,
'stop' => [
],
'n' => 1
],
'template' => [
[
'role' => 'system',
'content' => 'Hello, {{ name }}!'
]
],
'template_inputs' => [
'name' => 'world'
],
'tools' => [
'type' => 'function',
'function' => [
'name' => 'get_current_weather',
'description' => 'Get the current weather',
'parameters' => [
'type' => 'object',
'properties' => [
'location' => [
'type' => 'string',
'description' => 'The city and state, e.g. San Francisco, CA'
],
'format' => [
'type' => 'string',
'enum' => [
'celsius',
'fahrenheit'
],
'description' => 'The temperature unit to use. Infer this from the users location.'
]
],
'required' => [
'location',
'format'
]
]
]
],
'tool_choice' => 'none',
'response_format' => [
'type' => 'text'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.honeyhive.ai/events/model"
payload := strings.NewReader("{\n \"model_event\": {\n \"project\": \"New Project\",\n \"model\": \"gpt-4o\",\n \"provider\": \"openai\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"Hello, world!\"\n }\n ],\n \"response\": {\n \"role\": \"assistant\",\n \"content\": \"Hello, world!\"\n },\n \"duration\": 42,\n \"usage\": {\n \"prompt_tokens\": 10,\n \"completion_tokens\": 10,\n \"total_tokens\": 20\n },\n \"cost\": 0.00008,\n \"error\": null,\n \"source\": \"playground\",\n \"event_name\": \"Model Completion\",\n \"hyperparameters\": {\n \"temperature\": 0,\n \"top_p\": 1,\n \"max_tokens\": 1000,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"stop\": [],\n \"n\": 1\n },\n \"template\": [\n {\n \"role\": \"system\",\n \"content\": \"Hello, {{ name }}!\"\n }\n ],\n \"template_inputs\": {\n \"name\": \"world\"\n },\n \"tools\": {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"format\": {\n \"type\": \"string\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ],\n \"description\": \"The temperature unit to use. Infer this from the users location.\"\n }\n },\n \"required\": [\n \"location\",\n \"format\"\n ]\n }\n }\n },\n \"tool_choice\": \"none\",\n \"response_format\": {\n \"type\": \"text\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.honeyhive.ai/events/model")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model_event\": {\n \"project\": \"New Project\",\n \"model\": \"gpt-4o\",\n \"provider\": \"openai\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"Hello, world!\"\n }\n ],\n \"response\": {\n \"role\": \"assistant\",\n \"content\": \"Hello, world!\"\n },\n \"duration\": 42,\n \"usage\": {\n \"prompt_tokens\": 10,\n \"completion_tokens\": 10,\n \"total_tokens\": 20\n },\n \"cost\": 0.00008,\n \"error\": null,\n \"source\": \"playground\",\n \"event_name\": \"Model Completion\",\n \"hyperparameters\": {\n \"temperature\": 0,\n \"top_p\": 1,\n \"max_tokens\": 1000,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"stop\": [],\n \"n\": 1\n },\n \"template\": [\n {\n \"role\": \"system\",\n \"content\": \"Hello, {{ name }}!\"\n }\n ],\n \"template_inputs\": {\n \"name\": \"world\"\n },\n \"tools\": {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"format\": {\n \"type\": \"string\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ],\n \"description\": \"The temperature unit to use. Infer this from the users location.\"\n }\n },\n \"required\": [\n \"location\",\n \"format\"\n ]\n }\n }\n },\n \"tool_choice\": \"none\",\n \"response_format\": {\n \"type\": \"text\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.honeyhive.ai/events/model")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model_event\": {\n \"project\": \"New Project\",\n \"model\": \"gpt-4o\",\n \"provider\": \"openai\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"Hello, world!\"\n }\n ],\n \"response\": {\n \"role\": \"assistant\",\n \"content\": \"Hello, world!\"\n },\n \"duration\": 42,\n \"usage\": {\n \"prompt_tokens\": 10,\n \"completion_tokens\": 10,\n \"total_tokens\": 20\n },\n \"cost\": 0.00008,\n \"error\": null,\n \"source\": \"playground\",\n \"event_name\": \"Model Completion\",\n \"hyperparameters\": {\n \"temperature\": 0,\n \"top_p\": 1,\n \"max_tokens\": 1000,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"stop\": [],\n \"n\": 1\n },\n \"template\": [\n {\n \"role\": \"system\",\n \"content\": \"Hello, {{ name }}!\"\n }\n ],\n \"template_inputs\": {\n \"name\": \"world\"\n },\n \"tools\": {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_current_weather\",\n \"description\": \"Get the current weather\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"location\": {\n \"type\": \"string\",\n \"description\": \"The city and state, e.g. San Francisco, CA\"\n },\n \"format\": {\n \"type\": \"string\",\n \"enum\": [\n \"celsius\",\n \"fahrenheit\"\n ],\n \"description\": \"The temperature unit to use. Infer this from the users location.\"\n }\n },\n \"required\": [\n \"location\",\n \"format\"\n ]\n }\n }\n },\n \"tool_choice\": \"none\",\n \"response_format\": {\n \"type\": \"text\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"event_id": "7f22137a-6911-4ed3-bc36-110f1dde6b66",
"success": true
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Show child attributes
Show child attributes
Example:
{
"project": "New Project",
"model": "gpt-4o",
"provider": "openai",
"messages": [
{
"role": "system",
"content": "Hello, world!"
}
],
"response": {
"role": "assistant",
"content": "Hello, world!"
},
"duration": 42,
"usage": {
"prompt_tokens": 10,
"completion_tokens": 10,
"total_tokens": 20
},
"cost": 0.00008,
"error": null,
"source": "playground",
"event_name": "Model Completion",
"hyperparameters": {
"temperature": 0,
"top_p": 1,
"max_tokens": 1000,
"presence_penalty": 0,
"frequency_penalty": 0,
"stop": [],
"n": 1
},
"template": [
{
"role": "system",
"content": "Hello, {{ name }}!"
}
],
"template_inputs": { "name": "world" },
"tools": {
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"format": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "The temperature unit to use. Infer this from the users location."
}
},
"required": ["location", "format"]
}
}
},
"tool_choice": "none",
"response_format": { "type": "text" }
}
Was this page helpful?
⌘I

