Skip to content

Always access the OpenAI platform when using the DeepSeek model with LitellmModel #773

Closed
@qianxiaoming

Description

@qianxiaoming

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)

Activity

dongxiaohuang

dongxiaohuang commented on Jun 8, 2025

@dongxiaohuang

from agents import Agent, Runner, RawResponsesStreamEvent, function_tool, set_tracing_disabled

set_tracing_disabled(disabled=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @qianxiaoming@dongxiaohuang

        Issue actions

          Always access the OpenAI platform when using the DeepSeek model with LitellmModel · Issue #773 · openai/openai-agents-python