The API supports using fine-tuned models hosted by OpenAI. To use your fine-tuned model, you need to:
Specify your fine-tuned model name in the model field. For example: ft:gpt-4o-2024-08-06:personal::abcdefg
Add an extra header Fine-Tune-Authorization with your OpenAI API key that has the correct access to your model in Bearer format(see code examples below).
Copy
from openai import OpenAIclient = OpenAI( base_url="https://api.galadriel.com/v1/verified", api_key=GALADRIEL_API_KEY)completion = client.chat.completions.create( model="ft:gpt-4o-2024-08-06:personal::abcdefg", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello!"} ], extra_headers={ "Fine-Tune-Authorization": "Bearer your-openai-fine-tune-api-key" })print(f"Message: {completion.choices[0].message}")print(f"Hash: {completion.hash}")print(f"Signed public key: {completion.public_key}")print(f"Signature: {completion.signature}")print(f"Tx hash: {completion.tx_hash}")print(f"Attestation: {completion.attestation}")