Text

Text Generation Quickstart

This quickstart walks you through making your first text generation request with Infron.

Using the OpenAI SDK

Get started with just a few lines of code using your preferred SDK or framework.

from openai import OpenAI

client = OpenAI(
  base_url="https://llm.onerouter.pro/v1",
  api_key="<API_KEY>",
)

completion = client.chat.completions.create(
  model="claude-3-5-sonnet@20240620",
  messages=[
    {
      "role": "user",
      "content": "What is the meaning of life?"
    }
  ]
)

print(completion.choices[0].message.content)

Using the Infron API directly

The API also supports streaming.

Using third-party SDKs

For information about using third-party SDKs and frameworks with Infron, please see our frameworks documentation.

Next steps

Last updated