mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
573 lines
16 KiB
Go
573 lines
16 KiB
Go
/*
|
|
Hanzo Cloud API
|
|
|
|
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
|
|
API version: v1
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package hanzoai
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// checks if the UsageLLM type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &UsageLLM{}
|
|
|
|
// UsageLLM struct for UsageLLM
|
|
type UsageLLM struct {
|
|
// Available is false when the warehouse was not connected or a query blipped. The totals below are then honest zeros, NOT measured ones.
|
|
Available *bool `json:"available,omitempty"`
|
|
// CacheReadTokens is how many of the prompt tokens the provider's prompt cache served, at the cache-read price.
|
|
CacheReadTokens *int64 `json:"cacheReadTokens,omitempty"`
|
|
// CacheSavedCents is what the prompt cache took off the bill, in US cents: each call's cache-read tokens at the model's input price less the same tokens at its cache-read price, from the price that call was billed at. A call recorded before this was measured counts 0, so it is a floor.
|
|
CacheSavedCents *int64 `json:"cacheSavedCents,omitempty"`
|
|
// CacheWriteTokens is how many prompt tokens were written to the prompt cache.
|
|
CacheWriteTokens *int64 `json:"cacheWriteTokens,omitempty"`
|
|
// CachedShare is CacheReadTokens over PromptTokens, 0 to 1 at four decimals; 0 when nothing was prompted.
|
|
CachedShare *float64 `json:"cachedShare,omitempty"`
|
|
// CompletionTokens is the output half.
|
|
CompletionTokens *int64 `json:"completionTokens,omitempty"`
|
|
// CostCents is what they cost the org, in US cents. This IS a Hanzo charge.
|
|
CostCents *int64 `json:"costCents,omitempty"`
|
|
// Models is how many distinct models were used.
|
|
Models *int64 `json:"models,omitempty"`
|
|
// PromptTokens is the input half of that total.
|
|
PromptTokens *int64 `json:"promptTokens,omitempty"`
|
|
// Requests is how many completions the org made in the window.
|
|
Requests *int64 `json:"requests,omitempty"`
|
|
// Source names the warehouse table the totals came from.
|
|
Source *string `json:"source,omitempty"`
|
|
// Tokens is the total tokens those completions consumed.
|
|
Tokens *int64 `json:"tokens,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _UsageLLM UsageLLM
|
|
|
|
// NewUsageLLM instantiates a new UsageLLM object
|
|
// This constructor will assign default values to properties that have it defined,
|
|
// and makes sure properties required by API are set, but the set of arguments
|
|
// will change when the set of required properties is changed
|
|
func NewUsageLLM() *UsageLLM {
|
|
this := UsageLLM{}
|
|
return &this
|
|
}
|
|
|
|
// NewUsageLLMWithDefaults instantiates a new UsageLLM object
|
|
// This constructor will only assign default values to properties that have it defined,
|
|
// but it doesn't guarantee that properties required by API are set
|
|
func NewUsageLLMWithDefaults() *UsageLLM {
|
|
this := UsageLLM{}
|
|
return &this
|
|
}
|
|
|
|
// GetAvailable returns the Available field value if set, zero value otherwise.
|
|
func (o *UsageLLM) GetAvailable() bool {
|
|
if o == nil || IsNil(o.Available) {
|
|
var ret bool
|
|
return ret
|
|
}
|
|
return *o.Available
|
|
}
|
|
|
|
// GetAvailableOk returns a tuple with the Available field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageLLM) GetAvailableOk() (*bool, bool) {
|
|
if o == nil || IsNil(o.Available) {
|
|
return nil, false
|
|
}
|
|
return o.Available, true
|
|
}
|
|
|
|
// HasAvailable returns a boolean if a field has been set.
|
|
func (o *UsageLLM) HasAvailable() bool {
|
|
if o != nil && !IsNil(o.Available) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetAvailable gets a reference to the given bool and assigns it to the Available field.
|
|
func (o *UsageLLM) SetAvailable(v bool) {
|
|
o.Available = &v
|
|
}
|
|
|
|
// GetCacheReadTokens returns the CacheReadTokens field value if set, zero value otherwise.
|
|
func (o *UsageLLM) GetCacheReadTokens() int64 {
|
|
if o == nil || IsNil(o.CacheReadTokens) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.CacheReadTokens
|
|
}
|
|
|
|
// GetCacheReadTokensOk returns a tuple with the CacheReadTokens field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageLLM) GetCacheReadTokensOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.CacheReadTokens) {
|
|
return nil, false
|
|
}
|
|
return o.CacheReadTokens, true
|
|
}
|
|
|
|
// HasCacheReadTokens returns a boolean if a field has been set.
|
|
func (o *UsageLLM) HasCacheReadTokens() bool {
|
|
if o != nil && !IsNil(o.CacheReadTokens) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCacheReadTokens gets a reference to the given int64 and assigns it to the CacheReadTokens field.
|
|
func (o *UsageLLM) SetCacheReadTokens(v int64) {
|
|
o.CacheReadTokens = &v
|
|
}
|
|
|
|
// GetCacheSavedCents returns the CacheSavedCents field value if set, zero value otherwise.
|
|
func (o *UsageLLM) GetCacheSavedCents() int64 {
|
|
if o == nil || IsNil(o.CacheSavedCents) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.CacheSavedCents
|
|
}
|
|
|
|
// GetCacheSavedCentsOk returns a tuple with the CacheSavedCents field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageLLM) GetCacheSavedCentsOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.CacheSavedCents) {
|
|
return nil, false
|
|
}
|
|
return o.CacheSavedCents, true
|
|
}
|
|
|
|
// HasCacheSavedCents returns a boolean if a field has been set.
|
|
func (o *UsageLLM) HasCacheSavedCents() bool {
|
|
if o != nil && !IsNil(o.CacheSavedCents) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCacheSavedCents gets a reference to the given int64 and assigns it to the CacheSavedCents field.
|
|
func (o *UsageLLM) SetCacheSavedCents(v int64) {
|
|
o.CacheSavedCents = &v
|
|
}
|
|
|
|
// GetCacheWriteTokens returns the CacheWriteTokens field value if set, zero value otherwise.
|
|
func (o *UsageLLM) GetCacheWriteTokens() int64 {
|
|
if o == nil || IsNil(o.CacheWriteTokens) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.CacheWriteTokens
|
|
}
|
|
|
|
// GetCacheWriteTokensOk returns a tuple with the CacheWriteTokens field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageLLM) GetCacheWriteTokensOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.CacheWriteTokens) {
|
|
return nil, false
|
|
}
|
|
return o.CacheWriteTokens, true
|
|
}
|
|
|
|
// HasCacheWriteTokens returns a boolean if a field has been set.
|
|
func (o *UsageLLM) HasCacheWriteTokens() bool {
|
|
if o != nil && !IsNil(o.CacheWriteTokens) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCacheWriteTokens gets a reference to the given int64 and assigns it to the CacheWriteTokens field.
|
|
func (o *UsageLLM) SetCacheWriteTokens(v int64) {
|
|
o.CacheWriteTokens = &v
|
|
}
|
|
|
|
// GetCachedShare returns the CachedShare field value if set, zero value otherwise.
|
|
func (o *UsageLLM) GetCachedShare() float64 {
|
|
if o == nil || IsNil(o.CachedShare) {
|
|
var ret float64
|
|
return ret
|
|
}
|
|
return *o.CachedShare
|
|
}
|
|
|
|
// GetCachedShareOk returns a tuple with the CachedShare field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageLLM) GetCachedShareOk() (*float64, bool) {
|
|
if o == nil || IsNil(o.CachedShare) {
|
|
return nil, false
|
|
}
|
|
return o.CachedShare, true
|
|
}
|
|
|
|
// HasCachedShare returns a boolean if a field has been set.
|
|
func (o *UsageLLM) HasCachedShare() bool {
|
|
if o != nil && !IsNil(o.CachedShare) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCachedShare gets a reference to the given float64 and assigns it to the CachedShare field.
|
|
func (o *UsageLLM) SetCachedShare(v float64) {
|
|
o.CachedShare = &v
|
|
}
|
|
|
|
// GetCompletionTokens returns the CompletionTokens field value if set, zero value otherwise.
|
|
func (o *UsageLLM) GetCompletionTokens() int64 {
|
|
if o == nil || IsNil(o.CompletionTokens) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.CompletionTokens
|
|
}
|
|
|
|
// GetCompletionTokensOk returns a tuple with the CompletionTokens field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageLLM) GetCompletionTokensOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.CompletionTokens) {
|
|
return nil, false
|
|
}
|
|
return o.CompletionTokens, true
|
|
}
|
|
|
|
// HasCompletionTokens returns a boolean if a field has been set.
|
|
func (o *UsageLLM) HasCompletionTokens() bool {
|
|
if o != nil && !IsNil(o.CompletionTokens) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCompletionTokens gets a reference to the given int64 and assigns it to the CompletionTokens field.
|
|
func (o *UsageLLM) SetCompletionTokens(v int64) {
|
|
o.CompletionTokens = &v
|
|
}
|
|
|
|
// GetCostCents returns the CostCents field value if set, zero value otherwise.
|
|
func (o *UsageLLM) GetCostCents() int64 {
|
|
if o == nil || IsNil(o.CostCents) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.CostCents
|
|
}
|
|
|
|
// GetCostCentsOk returns a tuple with the CostCents field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageLLM) GetCostCentsOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.CostCents) {
|
|
return nil, false
|
|
}
|
|
return o.CostCents, true
|
|
}
|
|
|
|
// HasCostCents returns a boolean if a field has been set.
|
|
func (o *UsageLLM) HasCostCents() bool {
|
|
if o != nil && !IsNil(o.CostCents) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCostCents gets a reference to the given int64 and assigns it to the CostCents field.
|
|
func (o *UsageLLM) SetCostCents(v int64) {
|
|
o.CostCents = &v
|
|
}
|
|
|
|
// GetModels returns the Models field value if set, zero value otherwise.
|
|
func (o *UsageLLM) GetModels() int64 {
|
|
if o == nil || IsNil(o.Models) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Models
|
|
}
|
|
|
|
// GetModelsOk returns a tuple with the Models field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageLLM) GetModelsOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Models) {
|
|
return nil, false
|
|
}
|
|
return o.Models, true
|
|
}
|
|
|
|
// HasModels returns a boolean if a field has been set.
|
|
func (o *UsageLLM) HasModels() bool {
|
|
if o != nil && !IsNil(o.Models) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetModels gets a reference to the given int64 and assigns it to the Models field.
|
|
func (o *UsageLLM) SetModels(v int64) {
|
|
o.Models = &v
|
|
}
|
|
|
|
// GetPromptTokens returns the PromptTokens field value if set, zero value otherwise.
|
|
func (o *UsageLLM) GetPromptTokens() int64 {
|
|
if o == nil || IsNil(o.PromptTokens) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.PromptTokens
|
|
}
|
|
|
|
// GetPromptTokensOk returns a tuple with the PromptTokens field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageLLM) GetPromptTokensOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.PromptTokens) {
|
|
return nil, false
|
|
}
|
|
return o.PromptTokens, true
|
|
}
|
|
|
|
// HasPromptTokens returns a boolean if a field has been set.
|
|
func (o *UsageLLM) HasPromptTokens() bool {
|
|
if o != nil && !IsNil(o.PromptTokens) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetPromptTokens gets a reference to the given int64 and assigns it to the PromptTokens field.
|
|
func (o *UsageLLM) SetPromptTokens(v int64) {
|
|
o.PromptTokens = &v
|
|
}
|
|
|
|
// GetRequests returns the Requests field value if set, zero value otherwise.
|
|
func (o *UsageLLM) GetRequests() int64 {
|
|
if o == nil || IsNil(o.Requests) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Requests
|
|
}
|
|
|
|
// GetRequestsOk returns a tuple with the Requests field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageLLM) GetRequestsOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Requests) {
|
|
return nil, false
|
|
}
|
|
return o.Requests, true
|
|
}
|
|
|
|
// HasRequests returns a boolean if a field has been set.
|
|
func (o *UsageLLM) HasRequests() bool {
|
|
if o != nil && !IsNil(o.Requests) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetRequests gets a reference to the given int64 and assigns it to the Requests field.
|
|
func (o *UsageLLM) SetRequests(v int64) {
|
|
o.Requests = &v
|
|
}
|
|
|
|
// GetSource returns the Source field value if set, zero value otherwise.
|
|
func (o *UsageLLM) GetSource() string {
|
|
if o == nil || IsNil(o.Source) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Source
|
|
}
|
|
|
|
// GetSourceOk returns a tuple with the Source field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageLLM) GetSourceOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Source) {
|
|
return nil, false
|
|
}
|
|
return o.Source, true
|
|
}
|
|
|
|
// HasSource returns a boolean if a field has been set.
|
|
func (o *UsageLLM) HasSource() bool {
|
|
if o != nil && !IsNil(o.Source) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetSource gets a reference to the given string and assigns it to the Source field.
|
|
func (o *UsageLLM) SetSource(v string) {
|
|
o.Source = &v
|
|
}
|
|
|
|
// GetTokens returns the Tokens field value if set, zero value otherwise.
|
|
func (o *UsageLLM) GetTokens() int64 {
|
|
if o == nil || IsNil(o.Tokens) {
|
|
var ret int64
|
|
return ret
|
|
}
|
|
return *o.Tokens
|
|
}
|
|
|
|
// GetTokensOk returns a tuple with the Tokens field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UsageLLM) GetTokensOk() (*int64, bool) {
|
|
if o == nil || IsNil(o.Tokens) {
|
|
return nil, false
|
|
}
|
|
return o.Tokens, true
|
|
}
|
|
|
|
// HasTokens returns a boolean if a field has been set.
|
|
func (o *UsageLLM) HasTokens() bool {
|
|
if o != nil && !IsNil(o.Tokens) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetTokens gets a reference to the given int64 and assigns it to the Tokens field.
|
|
func (o *UsageLLM) SetTokens(v int64) {
|
|
o.Tokens = &v
|
|
}
|
|
|
|
func (o UsageLLM) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o UsageLLM) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if !IsNil(o.Available) {
|
|
toSerialize["available"] = o.Available
|
|
}
|
|
if !IsNil(o.CacheReadTokens) {
|
|
toSerialize["cacheReadTokens"] = o.CacheReadTokens
|
|
}
|
|
if !IsNil(o.CacheSavedCents) {
|
|
toSerialize["cacheSavedCents"] = o.CacheSavedCents
|
|
}
|
|
if !IsNil(o.CacheWriteTokens) {
|
|
toSerialize["cacheWriteTokens"] = o.CacheWriteTokens
|
|
}
|
|
if !IsNil(o.CachedShare) {
|
|
toSerialize["cachedShare"] = o.CachedShare
|
|
}
|
|
if !IsNil(o.CompletionTokens) {
|
|
toSerialize["completionTokens"] = o.CompletionTokens
|
|
}
|
|
if !IsNil(o.CostCents) {
|
|
toSerialize["costCents"] = o.CostCents
|
|
}
|
|
if !IsNil(o.Models) {
|
|
toSerialize["models"] = o.Models
|
|
}
|
|
if !IsNil(o.PromptTokens) {
|
|
toSerialize["promptTokens"] = o.PromptTokens
|
|
}
|
|
if !IsNil(o.Requests) {
|
|
toSerialize["requests"] = o.Requests
|
|
}
|
|
if !IsNil(o.Source) {
|
|
toSerialize["source"] = o.Source
|
|
}
|
|
if !IsNil(o.Tokens) {
|
|
toSerialize["tokens"] = o.Tokens
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *UsageLLM) UnmarshalJSON(data []byte) (err error) {
|
|
varUsageLLM := _UsageLLM{}
|
|
|
|
err = json.Unmarshal(data, &varUsageLLM)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = UsageLLM(varUsageLLM)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "available")
|
|
delete(additionalProperties, "cacheReadTokens")
|
|
delete(additionalProperties, "cacheSavedCents")
|
|
delete(additionalProperties, "cacheWriteTokens")
|
|
delete(additionalProperties, "cachedShare")
|
|
delete(additionalProperties, "completionTokens")
|
|
delete(additionalProperties, "costCents")
|
|
delete(additionalProperties, "models")
|
|
delete(additionalProperties, "promptTokens")
|
|
delete(additionalProperties, "requests")
|
|
delete(additionalProperties, "source")
|
|
delete(additionalProperties, "tokens")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableUsageLLM struct {
|
|
value *UsageLLM
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableUsageLLM) Get() *UsageLLM {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableUsageLLM) Set(val *UsageLLM) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableUsageLLM) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableUsageLLM) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableUsageLLM(val *UsageLLM) *NullableUsageLLM {
|
|
return &NullableUsageLLM{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableUsageLLM) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableUsageLLM) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|