Help us shape the future of Go! Take the 2026 Go Developer Survey

convert

package
v0.17.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

README

convert

Package convert provides utilities for converting AI model specifications between different formats including OpenAI and OpenRouter formats.

convert

import "github.com/agentstation/starmap/internal/cli/convert"

Index

func OpenRouterSupportedParameters

func OpenRouterSupportedParameters(m *catalogs.Model) []string

OpenRouterSupportedParameters returns a list of parameters that this model supports. This matches the OpenRouter API format for supported_parameters.

type OpenAIModel

OpenAIModel represents a model in OpenAI API format. Field order matches the OpenAI API response schema.

type OpenAIModel struct {
    ID      string `json:"id"`
    Object  string `json:"object"`
    Created int64  `json:"created"`
    OwnedBy string `json:"owned_by"`
}

func ToOpenAIModel
func ToOpenAIModel(m *catalogs.Model) OpenAIModel

ToOpenAIModel converts a Model to OpenAI format.

type OpenAIModelsResponse

OpenAIModelsResponse represents the root response object for OpenAI models list API.

type OpenAIModelsResponse struct {
    Object string        `json:"object"`
    Data   []OpenAIModel `json:"data"`
}

type OpenRouterArchitecture

OpenRouterArchitecture represents the architecture object in OpenRouter format.

type OpenRouterArchitecture struct {
    InputModalities  []string `json:"input_modalities"`
    OutputModalities []string `json:"output_modalities"`
    Tokenizer        string   `json:"tokenizer"`
    InstructType     *string  `json:"instruct_type"`
}

type OpenRouterModel

OpenRouterModel represents a model in OpenRouter API format. Field order matches the OpenRouter API response schema.

type OpenRouterModel struct {
    ID                  string                 `json:"id"`
    Name                string                 `json:"name"`
    Created             int64                  `json:"created"`
    Description         string                 `json:"description"`
    Architecture        OpenRouterArchitecture `json:"architecture"`
    TopProvider         OpenRouterTopProvider  `json:"top_provider"`
    Pricing             OpenRouterPricing      `json:"pricing"`
    CanonicalSlug       string                 `json:"canonical_slug"`
    ContextLength       int64                  `json:"context_length"`
    HuggingFaceID       string                 `json:"hugging_face_id,omitempty"`
    PerRequestLimits    any                    `json:"per_request_limits"`
    SupportedParameters []string               `json:"supported_parameters"`
}

func ToOpenRouterModel
func ToOpenRouterModel(m *catalogs.Model) OpenRouterModel

ToOpenRouterModel converts a Model to OpenRouter format.

type OpenRouterModelsResponse

OpenRouterModelsResponse represents the root response object for OpenRouter models API.

type OpenRouterModelsResponse struct {
    Data []OpenRouterModel `json:"data"`
}

type OpenRouterPricing

OpenRouterPricing represents the pricing object in OpenRouter format.

type OpenRouterPricing struct {
    Prompt            string `json:"prompt"`
    Completion        string `json:"completion"`
    Request           string `json:"request"`
    Image             string `json:"image"`
    WebSearch         string `json:"web_search"`
    InternalReasoning string `json:"internal_reasoning"`
    InputCacheRead    string `json:"input_cache_read"`
    InputCacheWrite   string `json:"input_cache_write"`
}

type OpenRouterTopProvider

OpenRouterTopProvider represents the top provider object in OpenRouter format.

type OpenRouterTopProvider struct {
    ContextLength       int64 `json:"context_length"`
    MaxCompletionTokens int64 `json:"max_completion_tokens"`
    IsModerated         bool  `json:"is_moderated"`
}

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenRouterSupportedParameters

func OpenRouterSupportedParameters(m *catalogs.Model) []string

OpenRouterSupportedParameters returns a list of parameters that this model supports. This matches the OpenRouter API format for supported_parameters.

Types

type OpenAIModel

type OpenAIModel struct {
	ID      string `json:"id"`
	Object  string `json:"object"`
	Created int64  `json:"created"`
	OwnedBy string `json:"owned_by"`
}

OpenAIModel represents a model in OpenAI API format. Field order matches the OpenAI API response schema.

func ToOpenAIModel

func ToOpenAIModel(m *catalogs.Model) OpenAIModel

ToOpenAIModel converts a Model to OpenAI format.

type OpenAIModelsResponse

type OpenAIModelsResponse struct {
	Object string        `json:"object"`
	Data   []OpenAIModel `json:"data"`
}

OpenAIModelsResponse represents the root response object for OpenAI models list API.

type OpenRouterArchitecture

type OpenRouterArchitecture struct {
	InputModalities  []string `json:"input_modalities"`
	OutputModalities []string `json:"output_modalities"`
	Tokenizer        string   `json:"tokenizer"`
	InstructType     *string  `json:"instruct_type"`
}

OpenRouterArchitecture represents the architecture object in OpenRouter format.

type OpenRouterModel

type OpenRouterModel struct {
	ID                  string                 `json:"id"`
	Name                string                 `json:"name"`
	Created             int64                  `json:"created"`
	Description         string                 `json:"description"`
	Architecture        OpenRouterArchitecture `json:"architecture"`
	TopProvider         OpenRouterTopProvider  `json:"top_provider"`
	Pricing             OpenRouterPricing      `json:"pricing"`
	CanonicalSlug       string                 `json:"canonical_slug"`
	ContextLength       int64                  `json:"context_length"`
	HuggingFaceID       string                 `json:"hugging_face_id,omitempty"`
	PerRequestLimits    any                    `json:"per_request_limits"`
	SupportedParameters []string               `json:"supported_parameters"`
}

OpenRouterModel represents a model in OpenRouter API format. Field order matches the OpenRouter API response schema.

func ToOpenRouterModel

func ToOpenRouterModel(m *catalogs.Model) OpenRouterModel

ToOpenRouterModel converts a Model to OpenRouter format.

type OpenRouterModelsResponse

type OpenRouterModelsResponse struct {
	Data []OpenRouterModel `json:"data"`
}

OpenRouterModelsResponse represents the root response object for OpenRouter models API.

type OpenRouterPricing

type OpenRouterPricing struct {
	Prompt            string `json:"prompt"`
	Completion        string `json:"completion"`
	Request           string `json:"request"`
	Image             string `json:"image"`
	WebSearch         string `json:"web_search"`
	InternalReasoning string `json:"internal_reasoning"`
	InputCacheRead    string `json:"input_cache_read"`
	InputCacheWrite   string `json:"input_cache_write"`
}

OpenRouterPricing represents the pricing object in OpenRouter format.

type OpenRouterTopProvider

type OpenRouterTopProvider struct {
	ContextLength       int64 `json:"context_length"`
	MaxCompletionTokens int64 `json:"max_completion_tokens"`
	IsModerated         bool  `json:"is_moderated"`
}

OpenRouterTopProvider represents the top provider object in OpenRouter format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL