Documentation Index
Fetch the complete documentation index at: https://docs.tokenfactory.nebius.com/llms.txt
Use this file to discover all available pages before exploring further.
Pydantic AI is a Python agent framework
Pydantic docs
Pydantic + Nebius AI docs
Prerequisites
-
Create an API key to authorize requests to Nebius Token Factory.
-
Save the API key into a
NEBIUS_API_KEY environment variable:
export NEBIUS_API_KEY="<API_key>"
-
Install the
pydantic package:
Create an Agent Application
Simplest application. NEBIUS_API_KEY will be inferred from env variables.
from pydantic_ai import Agent
agent = Agent('nebius:Qwen/Qwen3-32B-fast')
result = agent.run_sync('What is the capital of France?')
print(result.output)
#> The capital of France is Paris.
You can use also use the NebiusProvider class:
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.nebius import NebiusProvider
model = OpenAIChatModel(
'Qwen/Qwen3-32B-fast',
provider=NebiusProvider(api_key='your-nebius-api-key'),
)
agent = Agent(model)
result = agent.run_sync('What is the capital of France?')
print(result.output)
#> The capital of France is Paris.
More Examples
View more examples in our cookbook