import json
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.naga.ac/v1", api_key=os.environ["NAGAAI_API_KEY"])
completion = client.chat.completions.create(
model="deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Name one European capital and its country."}],
response_format={
"type": "json_schema",
"json_schema": {
"name": "capital",
"strict": True,
"schema": {
"type": "object",
"properties": {"city": {"type": "string"}, "country": {"type": "string"}},
"required": ["city", "country"],
"additionalProperties": False,
},
},
},
)
print(json.loads(completion.choices[0].message.content))