{"openapi":"3.0.0","info":{"description":"Groq provides ultra-fast AI inference with hardware-accelerated compute for large language models and AI applications.","version":[{"name":"v1","value":"v1"}]},"servers":[{"description":"Groq provides ultra-fast AI inference with hardware-accelerated compute for large language models and AI applications.","url":"https://api.apirails.com/groq"}],"paths":{"/v1/chat/completions":{"post":{"tags":["Chat"],"parameters":[],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://console.groq.com/docs/chat-completions","api_endpoint":"https://api.groq.com/v1/chat/completions"},"summary":"Create chat completion","description":"Creates a model response for the given chat conversation. Groq provides ultra-fast inference for large language models with hardware-accelerated compute.","security":[{"bearerAuth":[]}],"requestBody":{"description":"","required":true,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"frequency_penalty":{"type":"number","description":"Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim"},"logit_bias":{"type":"object","description":"Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100","properties":{}},"logprobs":{"type":"boolean","description":"Whether to return log probabilities of the output tokens or not","enum":[true,false]},"max_tokens":{"type":"number","description":"The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length"},"messages":{"type":"array","description":"The messages to generate chat completions for, in the chat format","required":true,"items":{"type":"string"}},"model":{"type":"string","description":"ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API.","required":true},"n":{"type":"number","description":"How many chat completion choices to generate for each input message"},"presence_penalty":{"type":"number","description":"Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics"},"response_format":{"type":"object","description":"An object specifying the format that the model must output. Setting to { \"type\": \"json_object\" } enables JSON mode, which guarantees the message the model generates is valid JSON","properties":{}},"seed":{"type":"number","description":"This feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result"},"stop":{"type":"array","description":"Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence","items":{"type":"string"}},"stream":{"type":"boolean","description":"If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message","enum":[true,false]},"stream_options":{"type":"object","description":"Options for streaming response. Only set this when you set stream: true","properties":{}},"temperature":{"type":"number","description":"What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both"},"tool_choice":{"type":"string","description":"Controls which (if any) tool is called by the model. 'none' means the model will not call any tool and instead generates a message. 'auto' means the model can pick between generating a message or calling a tool. Specifying a particular tool via {'type': 'function', 'function': {'name': 'my_function'}} forces the model to call that tool","enum":["none","auto"]},"tools":{"type":"array","description":"A list of tools the model may call. Currently, only functions are supported as a tool","items":{"type":"string"}},"top_logprobs":{"type":"number","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"},"top_p":{"type":"number","description":"An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both"},"user":{"type":"string","description":"A unique identifier representing your end-user, which can help Groq to monitor and detect abuse"}}},"example":{"frequency_penalty":"","logit_bias":{},"logprobs":"","max_tokens":"","messages":[{"content":"What is the capital of France?","role":"user"}],"model":"llama-3.1-8b-instant|llama-3.1-70b-versatile|llama-3-8b-8192|llama-3-70b-8192|mixtral-8x7b-32768|gemma-7b-it","n":"","presence_penalty":"","response_format":{},"seed":"","stop":[],"stream":"","stream_options":{},"temperature":0.7,"tool_choice":"","tools":[],"top_logprobs":"","top_p":"","user":""}}}}}},"/v1/models":{"get":{"tags":["Models"],"parameters":[],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://console.groq.com/docs/models","api_endpoint":"https://api.groq.com/v1/models"},"summary":"List models","description":"Lists the currently available models, and provides basic information about each one such as the owner and availability.","security":[{"bearerAuth":[]}]}},"/v1/batch":{"post":{"tags":["Batch"],"parameters":[],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://console.groq.com/docs/batch","api_endpoint":"https://api.groq.com/v1/batch"},"summary":"Create batch request","description":"Creates and executes a batch request from an uploaded file of requests. The Batch API allows you to process multiple requests in a single batch, which can be more efficient than making individual requests.","security":[{"bearerAuth":[]}],"requestBody":{"description":"","required":true,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"completion_window":{"type":"string","description":"The time frame within which the batch should be processed. Currently only 24h is supported.","enum":["24h"]},"endpoint":{"type":"string","description":"The endpoint to use for all requests in the batch. Currently only /v1/chat/completions is supported.","required":true},"input_file_id":{"type":"string","description":"The ID of an uploaded file that contains requests for the new batch. See upload file for how to upload a file. Your input file must be formatted as a JSONL file, where each line is a request object. The requests in the file must be for the same API endpoint.","required":true},"metadata":{"type":"object","description":"Optional custom metadata for the batch","properties":{}}}},"example":{"completion_window":"","endpoint":"/v1/chat/completions","input_file_id":"","metadata":{}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"security":[{"bearerAuth":[]}]}