Closed
Description
When using the DeepSeek model with LitellmModel, it always requires accessing the OpenAI platform:
import asyncio
import os
from agents import Agent, Runner
from agents.extensions.models.litellm_model import LitellmModel
os.environ["DEEPSEEK_API_KEY"] = "sk-74a*****************f131"
async def main():
model = LitellmModel(model="deepseek/deepseek-chat", api_key=os.environ["DEEPSEEK_API_KEY"])
agent = Agent(
name="Assistant",
instructions="You only respond in haikus.",
model=model,
)
result = await Runner.run(agent, "Tell me about recursion in programming.")
print(result.final_output)
if __name__ == "__main__":
asyncio.run(main())
This script output these:
[non-fatal] Tracing client error 401: {
"error": {
"message": "Incorrect API key provided: sk-74a47***********************f131. You can find your API key at https://platform.openai.com/account/api-keys.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
}
}
Recursion calls self,
Like a loop but with functions,
Base case ends the chain.
[non-fatal] Tracing client error 401: {
"error": {
"message": "Incorrect API key provided: sk-74a47***********************f131. You can find your API key at https://platform.openai.com/account/api-keys.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_api_key"
}
}
Debug information
- Agents SDK version: (
v0.0.16
) - Python version (
3.11
)
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
dongxiaohuang commentedon Jun 8, 2025
from agents import Agent, Runner, RawResponsesStreamEvent, function_tool, set_tracing_disabled
set_tracing_disabled(disabled=True)