{"openapi":"3.0.3","info":{"description":"Pryon Generative API.","title":"Generative API","version":"1.0"},"servers":[{"url":"/"}],"tags":[{"name":"Generative"}],"paths":{"/api/generative/v1alpha1/chat/completions":{"post":{"description":"\nA generic text-generation interface to external LLM providers and Pryon-hosted LLMs.\n implements a subset of the OpenAI /v1/chat/completions API specification\n as defined here: https://platform.openai.com/docs/api-reference/chat\n Using the official OpenAI client SDK for your language is recommended.\n The following providers are supported currently:\n - pryon\n - openai\n - anthropic\n - vertex ai\n Please check the respective provider's documentation\n for supported text-generation models and accepted sampling params.\n If streaming is enabled, responses will follow the SSE standard\n https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events.","operationId":"Generative_CreateChatCompletions","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionsRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionsResponse"}}},"description":"OK"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}},"description":"Default error response"}},"tags":["Generative"],"summary":"CreateChatCompletions","parameters":[{"name":"Authentication","in":"header","required":true,"schema":{"type":"string"},"example":"Authorization: Bearer {base64-encoded-token}"}]}},"/api/generative/v1alpha1/chat/completions/models":{"get":{"description":"\nLists the models available for our Chat Completions API","operationId":"Generative_ListChatCompletionsModels","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListChatCompletionsModelsRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListChatCompletionsModelsResponse"}}},"description":"OK"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}},"description":"Default error response"}},"tags":["Generative"],"summary":"List Models","parameters":[{"name":"Authentication","in":"header","required":true,"schema":{"type":"string"},"example":"Authorization: Bearer {base64-encoded-token}"}]}},"/api/generative/v1alpha1/tasks/complete-query":{"post":{"description":"\nGenerates a completed query by replacing references to entities / information\n in prior turns of the conversation.","operationId":"Generative_CompleteQuery","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteQueryRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteQueryResponse"}}},"description":"OK"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}},"description":"Default error response"}},"tags":["Generative"],"summary":"CompleteQuery","parameters":[{"name":"Authentication","in":"header","required":true,"schema":{"type":"string"},"example":"Authorization: Bearer {base64-encoded-token}"}]}},"/api/generative/v1alpha1/tasks/route-query":{"post":{"description":"\nReturn query out-of-domain classifications given a query","operationId":"Generative_RouteQuery","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteQueryRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteQueryResponse"}}},"description":"OK"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}},"description":"Default error response"}},"tags":["Generative"],"summary":"RouteQuery","parameters":[{"name":"Authentication","in":"header","required":true,"schema":{"type":"string"},"example":"Authorization: Bearer {base64-encoded-token}"}]}}},"components":{"schemas":{"ChatCompletionsModel":{"description":"An individual Chat Completions model","properties":{"id":{"description":"Model ID; in or format.","type":"string"},"displayName":{"description":"Model name; for model selection on the Pryon platform.","type":"string"}},"type":"object"},"ChatCompletionsModels":{"properties":{"models":{"description":"Available models for the Chat Completions API; listed by provider.","items":{"$ref":"#/components/schemas/ChatCompletionsModel"},"type":"array"}},"type":"object"},"ChatCompletionsRequest":{"properties":{"messages":{"description":"List of messages that form the conversation","items":{"$ref":"#/components/schemas/Message"},"type":"array"},"model":{"description":"ID of the model to use, following the / format.\n e.g pryon/pryon-zeus-1, openai/gpt-4o, openai/o1-mini,\n anthropic/claude-3-5-sonnet-latest etc.","type":"string"},"temperature":{"description":"Sampling temperature.\n Range will depend on the specific model being called,\n Please check provider / model documentation.","format":"float","type":"number"},"topP":{"description":"Alternative to temperature for nucleus sampling","format":"float","type":"number"},"stream":{"description":"Whether to stream partial message deltas","type":"boolean"},"stop":{"description":"Stop sequences where the API should stop generating","items":{"type":"string"},"type":"array"},"maxCompletionTokens":{"description":"Maximum number of tokens to generate","format":"int32","type":"integer"},"logprobs":{"description":"Whether to return log probabilities of the output tokens or not.\n If true, returns the log probabilities of each output token returned in the content of message.","type":"boolean"},"topLogprobs":{"description":"An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.\n logprobs must be set to true if this parameter is used.","format":"int32","type":"integer"}},"type":"object"},"ChatCompletionsResponse":{"description":"Response for chat completion\n non-streaming: https://platform.openai.com/docs/api-reference/chat/object\n streaming: https://platform.openai.com/docs/api-reference/chat/streaming","properties":{"id":{"description":"Unique identifier for the chat completion","type":"string"},"choices":{"description":"A list of chat completion choices. Can be more than one if n is greater than 1.","items":{"$ref":"#/components/schemas/Choice"},"type":"array"},"created":{"description":"The Unix timestamp (in seconds) of when the chat completion was created.","type":"string"},"model":{"description":"Model used for completion","type":"string"},"object":{"description":"The object type, which can be either\n chat.completion OR\n chat.completion.chunk","type":"string"},"usage":{"allOf":[{"$ref":"#/components/schemas/Usage"}],"description":"Usage statistics for the completion"}},"type":"object"},"Choice":{"description":"Individual completion choice","properties":{"index":{"description":"Index of the choice","format":"int32","type":"integer"},"message":{"allOf":[{"$ref":"#/components/schemas/Message"}],"description":"The message containing the completion.\n Present only if stream=false in request."},"delta":{"allOf":[{"$ref":"#/components/schemas/Delta"}],"description":"The delta for a streaming chunk.\n Present only if stream=true in request."},"logprobs":{"description":"Log probability information for the choice.","items":{"$ref":"#/components/schemas/LogProbs"},"type":"array"},"finishReason":{"description":"Reason why the completion finished","type":"string"}},"type":"object"},"CompleteQueryRequest":{"properties":{"query":{"description":"Query to complete given context.","type":"string"},"conversationContext":{"description":"Context for prior turns in the conversation.","type":"string"},"conversationId":{"description":"Retrieve context history (question-answer pairs)\n from previous exchanges in the conversation.","type":"string"}},"type":"object"},"CompleteQueryResponse":{"properties":{"completedQuery":{"type":"string"}},"type":"object"},"Delta":{"description":"Delta of a message for streaming","properties":{"role":{"description":"Role of the message sender (if changed)","type":"string"},"content":{"description":"Content delta of the message","type":"string"}},"type":"object"},"GoogleProtobufAny":{"additionalProperties":true,"description":"Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.","properties":{"@type":{"description":"Serialized message type.","type":"string"}},"type":"object"},"ListChatCompletionsModelsRequest":{"description":"The request schema for our ListChatCompletionsModels endpoint","properties":{},"type":"object"},"ListChatCompletionsModelsResponse":{"description":"Response for ListChatCompletionsModels\n Provides all the available models for our Chat Completions API","properties":{"items":{"additionalProperties":{"$ref":"#/components/schemas/ChatCompletionsModels"},"description":"Available models for the Chat Completions API; listed by provider.","type":"object"}},"type":"object"},"LogProbToken":{"properties":{"token":{"description":"The token.","type":"string"},"logprob":{"description":"The log probability of this token, if it is within the top 20 most likely tokens.\n Otherwise, the value -9999.0 is used to signify that the token is very unlikely.","format":"float","type":"number"},"bytes":{"description":"A list of integers representing the UTF-8 bytes representation of the token.\n Useful in instances where characters are represented by multiple tokens\n and their byte representations must be combined to generate\n the correct text representation.\n Can be null if there is no bytes representation for the token.","items":{"format":"int32","type":"integer"},"type":"array"}},"type":"object"},"LogProbTokenWithTop":{"properties":{"token":{"description":"The token.","type":"string"},"logprob":{"description":"The log probability of this token, if it is within the top 20 most likely tokens.\n Otherwise, the value -9999.0 is used to signify that the token is very unlikely.","format":"float","type":"number"},"bytes":{"description":"A list of integers representing the UTF-8 bytes representation of the token.\n Useful in instances where characters are represented by multiple tokens\n and their byte representations must be combined to generate\n the correct text representation.\n Can be null if there is no bytes representation for the token.","items":{"format":"int32","type":"integer"},"type":"array"},"topLogprobs":{"description":"List of the most likely tokens and their log probability, at this token position.\n In rare cases, there may be fewer than the number of requested top_logprobs returned.","items":{"$ref":"#/components/schemas/LogProbToken"},"type":"array"}},"type":"object"},"LogProbs":{"properties":{"content":{"description":"A list of message content tokens with log probability information.","items":{"$ref":"#/components/schemas/LogProbTokenWithTop"},"type":"array"},"refusal":{"description":"A list of message refusal tokens with log probability information.","items":{"$ref":"#/components/schemas/LogProbTokenWithTop"},"type":"array"}},"type":"object"},"Message":{"description":"Individual message in the conversation","properties":{"role":{"description":"Role of the message sender (system, user, assistant)\n Please check provider documentation on what's supported\n for a particular model.","type":"string"},"content":{"description":"Content of the message","type":"string"}},"type":"object"},"RouteQueryRequest":{"properties":{"query":{"description":"Required: Query string","type":"string"},"domain":{"description":"Modification to query classification prompt. Defaults to \"the company you provide support for\",\n but can be modified to define any domain, e.g. \"a medical device manufacturer\", \"municipal public resources\", etc.","type":"string"},"enableGenerativeConversationalResponse":{"description":"Whether or not conversational responses are generated or canned","type":"boolean"}},"type":"object"},"RouteQueryResponse":{"properties":{"isIntelligible":{"description":"Whether or not the given query is intelligible","type":"boolean"},"isEnglish":{"description":"Whether or not the given query is in a supported language","type":"boolean"},"isConversational":{"description":"Whether or not the given query is conversational","type":"boolean"},"conversationalResponse":{"description":"The LLM-generated response if the query is indeed conversational","type":"string"}},"type":"object"},"Status":{"description":"The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).","properties":{"code":{"description":"The status code; an enum value of the Google Remote Procedure Call (RPC).","format":"int32","type":"integer"},"message":{"description":"Developer-facing error message; user-facing error messages are localized.","type":"string"},"details":{"description":"List of error detail messages.","items":{"$ref":"#/components/schemas/GoogleProtobufAny"},"type":"array"}},"type":"object"},"Usage":{"description":"Usage statistics\n TODO: if we're going out to reasoning models,\n do we need to include those tokens separately?","properties":{"promptTokens":{"description":"Tokens in the prompt","format":"int32","type":"integer"},"completionTokens":{"description":"Tokens in the completion","format":"int32","type":"integer"},"totalTokens":{"description":"Total tokens used","format":"int32","type":"integer"}},"type":"object"}}}}