Compatibility
Use the OpenAI client with 8080 by setting the base URL and API key.
OpenAI Compatibility
Section titled “OpenAI Compatibility”The 8080 API provides partial compatibility with the OpenAI API specification to facilitate easy integration with existing applications and commonly used tools.
Environment variables
Section titled “Environment variables”Most applications that are compatible with the OpenAI API or require an OpenAI key to run can be easily configured to use the 8080 API by setting these two variables:
export OPENAI_API_KEY="your_8080_api_key_here"export OPENAI_BASE_URL="https://api.8080.io/v1"Python Client
Section titled “Python Client”By replacing your API client’s base URL with https://api.8080.io/v1 and your OpenAI access token with an 8080 API key, you can use the standard OpenAI Python client as you would normally:
from openai import OpenAIimport os
client = OpenAI( base_url="https://api.8080.io/v1", # optionally set the OpenAI env var OPENAI_API_KEY and omit this line api_key=os.environ.get('_8080_API_KEY'),)
completion = client.chat.completions.create( model="8080/taalas/llama3.1-8b-instruct", messages=[ { "role": "user", "content": "How do I output all files in a directory using Python?", }, ],)
print(completion.choices[0].message.content)Currently supported
Section titled “Currently supported”The 8080 API currently supports the following endpoints that are compatible with the OpenAI-style API:
/v1/chat/completions— Chat-based text completions, with support for tool calling and structured outputs using the same format options available in the OpenAI API/v1/responses— Generate text completions using the Responses format/v1/models— List models available for text completions/v1/batches— Create batch jobs for completions to be executed at a lower priority/v1/files— Upload batch input files, download results files, deploy file assets for Edge apps
8080 does not currently support any other API functionality not included above.
Further reading
Section titled “Further reading”- Read more about the OpenAI Python library
- Check out the OpenAI API reference