Interference OpenAI-Proxy API

The Interference API allows you to serve other OpenAI integrations with G4F. It acts as a proxy, translating requests to the OpenAI API into requests to the G4F providers.

Run Interference API from PyPI Package

You can run the Interference API directly from the G4F PyPI package:

from g4f.api import run_api

run_api()

Run Interference API from Repository

Alternatively, you can run the Interference API from the cloned repository.

Run the server with:

g4f api

or

python -m g4f.api.run

Usage with OpenAI Library

Usage with Requests Library

You can also send requests directly to the Interference API using the requests library.

Key Points

  • The Interference API translates OpenAI API requests into G4F provider requests
  • You can run it from the PyPI package or the cloned repository
  • It supports usage with the OpenAI Python library by changing the base_url
  • Direct requests can be sent to the API endpoints using libraries like requests

The Interference API allows easy integration of G4F with existing OpenAI-based applications and tools.