Chat Completions
Generate chat completions using an OpenAI-style chat completions API or the eighty80 sdk.
The 8080 chat completions endpoint is designed to match the OpenAI API for generating chat completions. To learn more, refer to the OpenAI docs.
curl https://api.8080.io/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $_8080_API_KEY" \ -d '{ "model": "8080/taalas/llama3.1-8b-instruct", "messages": [ { "role": "user", "content": "Tell me a joke" } ] }'import requestsimport jsonimport os
response = requests.post( "https://api.8080.io/v1/chat/completions", headers={ "Authorization": f"Bearer ${os.environ.get("_8080_API_KEY")}", "Content-Type": "application/json" }, json={ "model": "8080/taalas/llama3.1-8b-instruct", "messages": [ { "role": "developer", "content": "why is the sky blue?" } ] })
if not response.ok: raise Exception(f"API Error {response.status_code}: {response.json()}")
print(response.json())Request body
Section titled “Request body”Required Parameters
Section titled “Required Parameters”Parameter | Type | Description |
|---|---|---|
messages required | array | A list of messages comprising the conversation so far. Supports different message types like text, images, and audio depending on the model. |
model required | string | Model ID used to generate the response, like 8080/llama-8b. |
frequency_penalty | number | 0 |
logit_bias | map | null |
max_completion_tokens | integer | null |
n | integer | 1 |
presence_penalty | number | 0 |
reasoning_effort | string | ”medium” |
seed | integer | null |
stop | string/array | null |
stream | boolean | false |
temperature | number | 1 |
top_p | number | 1 |
tools | array | null |
Message Types
Section titled “Message Types”The messages array can contain different types of messages:
- Developer message: Instructions for the model to follow, replacing system messages in newer models
- System message: Legacy instructions for the model (prefer developer messages for newer models)
- User message: Messages from end users containing prompts or context
- Assistant message: Model-generated responses
- Tool message: Messages related to tool/function calling
Tool calling
Section titled “Tool calling”Pass a tools array in the request to let the model call your functions. When the model returns tool_calls, add tool messages with the results and call the API again until the model sends a final text response. See the Tool Calling guide for the request format and a full Python example.