Skip to content

Models

Every tracked request is classified into a model type that determines which metrics are extracted, which pricing formula is applied, and how the request is rendered in the dashboard. The provider's handler automatically detects the model type from the endpoint and response shape, so no additional configuration is needed.

Supported Providers

  • OpenAI
  • Anthropic
  • Google AI
  • Groq
  • xAI
  • OpenRouter
  • Ollama
  • Replicate
  • Cohere
  • Mistral

To support a provider not listed here, see Custom Providers.

Model Types

Text Completions

Text generation is the most widely supported model type, covering chat completions, message generation, and content generation across all major providers.

MetricColumnDescription
Prompt tokensprompt_tokensNumber of input tokens sent to the model
Completion tokenscompletion_tokensNumber of output tokens generated by the model
Cached tokensDeducted from prompt costTokens served from the provider's prompt cache at a discounted rate
Reasoning tokensreasoning_tokensTokens used for internal reasoning (o-series, thinking models)
Finish reasonfinish_reasonWhy generation stopped — stop, length, tool_calls, end_turn, etc.

Cached Token Pricing

Providers such as OpenAI, Anthropic, Google, and xAI offer prompt caching, where previously seen input tokens are served at a reduced rate. Spectra detects cached tokens automatically and applies the discounted price:

regular_prompt_tokens = prompt_tokens - cached_tokens
prompt_cost = (regular_tokens × input_price + cached_tokens × cached_price) / 1,000,000

Embeddings

Embeddings convert text into dense vector representations used for semantic search, clustering, and similarity comparisons. Unlike text completions, embedding models produce no output tokens — the cost is based entirely on input token count.

MetricColumnDescription
Prompt tokensprompt_tokensNumber of input tokens in the text being embedded
Completion tokenscompletion_tokensAlways 0 for embeddings

When embedding multiple texts in a single request (batch embeddings), Spectra tracks the total token count across all inputs.

Image Generation

Image generation APIs typically return temporary URLs that expire after a set period. When media persistence is enabled, Spectra downloads and stores generated images before the URLs expire.

MetricColumnDescription
Image countimage_countNumber of images generated in the request

Image models are priced per image. The cost depends on the model, image dimensions, and quality settings.

Video Generation

Video generation is typically asynchronous — you submit a creation request and then poll for the result. Spectra's video handlers implement the SkipsResponse interface, persisting only the final completed response with full metrics.

MetricColumnDescription
Video countvideo_countNumber of videos generated
Durationduration_secondsTotal duration of the generated video in seconds

Video models are priced per video generated. Media persistence works the same way as for images.

Text-to-Speech

TTS endpoints return binary audio data (MP3, Opus, etc.) rather than JSON. The response payload is not stored in the database — only the request parameters and extracted metrics are recorded.

MetricColumnDescription
Input charactersinput_charactersNumber of characters in the input text

TTS models are priced per character or per million characters, depending on the provider.

Speech-to-Text

STT requests use multipart form data rather than JSON — the audio file is sent as a file attachment. Spectra handles this automatically.

MetricColumnDescription
Durationduration_secondsLength of the input audio in seconds
Prompt tokensprompt_tokensToken count from the transcription (when available)
Completion tokenscompletion_tokensToken count from the output (when available)

STT models are priced per minute of input audio.

Not Yet Supported

CategoryExample ModelsReason
Realtime (WebSocket)gpt-4o-realtime-preview, gpt-4o-mini-realtime-previewRealtime models use persistent WebSocket connections rather than HTTP request/response cycles

Released under the MIT License.